github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/webcamprivate/bindings/ffi_bindings.ts (about) 1 import { importModule, Application, heap, Pointer } from "@ffi"; 2 3 importModule("plat/js/webext/webcamprivate", (A: Application) => { 4 const WEBEXT = typeof globalThis.browser === "undefined" ? globalThis.chrome : globalThis.browser; 5 6 return { 7 "constof_AutofocusState": (ref: heap.Ref<string>): number => { 8 const idx = ["on", "off"].indexOf(A.H.get(ref)); 9 return idx < 0 ? 0 : idx + 1; 10 }, 11 "constof_PanDirection": (ref: heap.Ref<string>): number => { 12 const idx = ["stop", "right", "left"].indexOf(A.H.get(ref)); 13 return idx < 0 ? 0 : idx + 1; 14 }, 15 "constof_Protocol": (ref: heap.Ref<string>): number => { 16 const idx = ["visca"].indexOf(A.H.get(ref)); 17 return idx < 0 ? 0 : idx + 1; 18 }, 19 20 "store_ProtocolConfiguration": (ptr: Pointer, ref: heap.Ref<any>) => { 21 const x = A.H.get<any>(ref); 22 23 if (typeof x === "undefined") { 24 A.store.Bool(ptr + 4, false); 25 A.store.Enum(ptr + 0, -1); 26 } else { 27 A.store.Bool(ptr + 4, true); 28 A.store.Enum(ptr + 0, ["visca"].indexOf(x["protocol"] as string)); 29 } 30 }, 31 "load_ProtocolConfiguration": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 32 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 33 34 x["protocol"] = A.load.Enum(ptr + 0, ["visca"]); 35 return create === A.H.TRUE ? A.H.push(x) : ref; 36 }, 37 38 "store_Range": (ptr: Pointer, ref: heap.Ref<any>) => { 39 const x = A.H.get<any>(ref); 40 41 if (typeof x === "undefined") { 42 A.store.Bool(ptr + 18, false); 43 A.store.Bool(ptr + 16, false); 44 A.store.Float64(ptr + 0, 0); 45 A.store.Bool(ptr + 17, false); 46 A.store.Float64(ptr + 8, 0); 47 } else { 48 A.store.Bool(ptr + 18, true); 49 A.store.Bool(ptr + 16, "min" in x ? true : false); 50 A.store.Float64(ptr + 0, x["min"] === undefined ? 0 : (x["min"] as number)); 51 A.store.Bool(ptr + 17, "max" in x ? true : false); 52 A.store.Float64(ptr + 8, x["max"] === undefined ? 0 : (x["max"] as number)); 53 } 54 }, 55 "load_Range": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 56 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 57 58 if (A.load.Bool(ptr + 16)) { 59 x["min"] = A.load.Float64(ptr + 0); 60 } else { 61 delete x["min"]; 62 } 63 if (A.load.Bool(ptr + 17)) { 64 x["max"] = A.load.Float64(ptr + 8); 65 } else { 66 delete x["max"]; 67 } 68 return create === A.H.TRUE ? A.H.push(x) : ref; 69 }, 70 "constof_TiltDirection": (ref: heap.Ref<string>): number => { 71 const idx = ["stop", "up", "down"].indexOf(A.H.get(ref)); 72 return idx < 0 ? 0 : idx + 1; 73 }, 74 75 "store_WebcamConfiguration": (ptr: Pointer, ref: heap.Ref<any>) => { 76 const x = A.H.get<any>(ref); 77 78 if (typeof x === "undefined") { 79 A.store.Bool(ptr + 78, false); 80 A.store.Bool(ptr + 72, false); 81 A.store.Float64(ptr + 0, 0); 82 A.store.Bool(ptr + 73, false); 83 A.store.Float64(ptr + 8, 0); 84 A.store.Enum(ptr + 16, -1); 85 A.store.Bool(ptr + 74, false); 86 A.store.Float64(ptr + 24, 0); 87 A.store.Bool(ptr + 75, false); 88 A.store.Float64(ptr + 32, 0); 89 A.store.Enum(ptr + 40, -1); 90 A.store.Bool(ptr + 76, false); 91 A.store.Float64(ptr + 48, 0); 92 A.store.Enum(ptr + 56, -1); 93 A.store.Bool(ptr + 77, false); 94 A.store.Float64(ptr + 64, 0); 95 } else { 96 A.store.Bool(ptr + 78, true); 97 A.store.Bool(ptr + 72, "pan" in x ? true : false); 98 A.store.Float64(ptr + 0, x["pan"] === undefined ? 0 : (x["pan"] as number)); 99 A.store.Bool(ptr + 73, "panSpeed" in x ? true : false); 100 A.store.Float64(ptr + 8, x["panSpeed"] === undefined ? 0 : (x["panSpeed"] as number)); 101 A.store.Enum(ptr + 16, ["stop", "right", "left"].indexOf(x["panDirection"] as string)); 102 A.store.Bool(ptr + 74, "tilt" in x ? true : false); 103 A.store.Float64(ptr + 24, x["tilt"] === undefined ? 0 : (x["tilt"] as number)); 104 A.store.Bool(ptr + 75, "tiltSpeed" in x ? true : false); 105 A.store.Float64(ptr + 32, x["tiltSpeed"] === undefined ? 0 : (x["tiltSpeed"] as number)); 106 A.store.Enum(ptr + 40, ["stop", "up", "down"].indexOf(x["tiltDirection"] as string)); 107 A.store.Bool(ptr + 76, "zoom" in x ? true : false); 108 A.store.Float64(ptr + 48, x["zoom"] === undefined ? 0 : (x["zoom"] as number)); 109 A.store.Enum(ptr + 56, ["on", "off"].indexOf(x["autofocusState"] as string)); 110 A.store.Bool(ptr + 77, "focus" in x ? true : false); 111 A.store.Float64(ptr + 64, x["focus"] === undefined ? 0 : (x["focus"] as number)); 112 } 113 }, 114 "load_WebcamConfiguration": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 115 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 116 117 if (A.load.Bool(ptr + 72)) { 118 x["pan"] = A.load.Float64(ptr + 0); 119 } else { 120 delete x["pan"]; 121 } 122 if (A.load.Bool(ptr + 73)) { 123 x["panSpeed"] = A.load.Float64(ptr + 8); 124 } else { 125 delete x["panSpeed"]; 126 } 127 x["panDirection"] = A.load.Enum(ptr + 16, ["stop", "right", "left"]); 128 if (A.load.Bool(ptr + 74)) { 129 x["tilt"] = A.load.Float64(ptr + 24); 130 } else { 131 delete x["tilt"]; 132 } 133 if (A.load.Bool(ptr + 75)) { 134 x["tiltSpeed"] = A.load.Float64(ptr + 32); 135 } else { 136 delete x["tiltSpeed"]; 137 } 138 x["tiltDirection"] = A.load.Enum(ptr + 40, ["stop", "up", "down"]); 139 if (A.load.Bool(ptr + 76)) { 140 x["zoom"] = A.load.Float64(ptr + 48); 141 } else { 142 delete x["zoom"]; 143 } 144 x["autofocusState"] = A.load.Enum(ptr + 56, ["on", "off"]); 145 if (A.load.Bool(ptr + 77)) { 146 x["focus"] = A.load.Float64(ptr + 64); 147 } else { 148 delete x["focus"]; 149 } 150 return create === A.H.TRUE ? A.H.push(x) : ref; 151 }, 152 153 "store_WebcamCurrentConfiguration": (ptr: Pointer, ref: heap.Ref<any>) => { 154 const x = A.H.get<any>(ref); 155 156 if (typeof x === "undefined") { 157 A.store.Bool(ptr + 127, false); 158 A.store.Bool(ptr + 123, false); 159 A.store.Float64(ptr + 0, 0); 160 A.store.Bool(ptr + 124, false); 161 A.store.Float64(ptr + 8, 0); 162 A.store.Bool(ptr + 125, false); 163 A.store.Float64(ptr + 16, 0); 164 A.store.Bool(ptr + 126, false); 165 A.store.Float64(ptr + 24, 0); 166 167 A.store.Bool(ptr + 32 + 18, false); 168 A.store.Bool(ptr + 32 + 16, false); 169 A.store.Float64(ptr + 32 + 0, 0); 170 A.store.Bool(ptr + 32 + 17, false); 171 A.store.Float64(ptr + 32 + 8, 0); 172 173 A.store.Bool(ptr + 56 + 18, false); 174 A.store.Bool(ptr + 56 + 16, false); 175 A.store.Float64(ptr + 56 + 0, 0); 176 A.store.Bool(ptr + 56 + 17, false); 177 A.store.Float64(ptr + 56 + 8, 0); 178 179 A.store.Bool(ptr + 80 + 18, false); 180 A.store.Bool(ptr + 80 + 16, false); 181 A.store.Float64(ptr + 80 + 0, 0); 182 A.store.Bool(ptr + 80 + 17, false); 183 A.store.Float64(ptr + 80 + 8, 0); 184 185 A.store.Bool(ptr + 104 + 18, false); 186 A.store.Bool(ptr + 104 + 16, false); 187 A.store.Float64(ptr + 104 + 0, 0); 188 A.store.Bool(ptr + 104 + 17, false); 189 A.store.Float64(ptr + 104 + 8, 0); 190 } else { 191 A.store.Bool(ptr + 127, true); 192 A.store.Bool(ptr + 123, "pan" in x ? true : false); 193 A.store.Float64(ptr + 0, x["pan"] === undefined ? 0 : (x["pan"] as number)); 194 A.store.Bool(ptr + 124, "tilt" in x ? true : false); 195 A.store.Float64(ptr + 8, x["tilt"] === undefined ? 0 : (x["tilt"] as number)); 196 A.store.Bool(ptr + 125, "zoom" in x ? true : false); 197 A.store.Float64(ptr + 16, x["zoom"] === undefined ? 0 : (x["zoom"] as number)); 198 A.store.Bool(ptr + 126, "focus" in x ? true : false); 199 A.store.Float64(ptr + 24, x["focus"] === undefined ? 0 : (x["focus"] as number)); 200 201 if (typeof x["panRange"] === "undefined") { 202 A.store.Bool(ptr + 32 + 18, false); 203 A.store.Bool(ptr + 32 + 16, false); 204 A.store.Float64(ptr + 32 + 0, 0); 205 A.store.Bool(ptr + 32 + 17, false); 206 A.store.Float64(ptr + 32 + 8, 0); 207 } else { 208 A.store.Bool(ptr + 32 + 18, true); 209 A.store.Bool(ptr + 32 + 16, "min" in x["panRange"] ? true : false); 210 A.store.Float64(ptr + 32 + 0, x["panRange"]["min"] === undefined ? 0 : (x["panRange"]["min"] as number)); 211 A.store.Bool(ptr + 32 + 17, "max" in x["panRange"] ? true : false); 212 A.store.Float64(ptr + 32 + 8, x["panRange"]["max"] === undefined ? 0 : (x["panRange"]["max"] as number)); 213 } 214 215 if (typeof x["tiltRange"] === "undefined") { 216 A.store.Bool(ptr + 56 + 18, false); 217 A.store.Bool(ptr + 56 + 16, false); 218 A.store.Float64(ptr + 56 + 0, 0); 219 A.store.Bool(ptr + 56 + 17, false); 220 A.store.Float64(ptr + 56 + 8, 0); 221 } else { 222 A.store.Bool(ptr + 56 + 18, true); 223 A.store.Bool(ptr + 56 + 16, "min" in x["tiltRange"] ? true : false); 224 A.store.Float64(ptr + 56 + 0, x["tiltRange"]["min"] === undefined ? 0 : (x["tiltRange"]["min"] as number)); 225 A.store.Bool(ptr + 56 + 17, "max" in x["tiltRange"] ? true : false); 226 A.store.Float64(ptr + 56 + 8, x["tiltRange"]["max"] === undefined ? 0 : (x["tiltRange"]["max"] as number)); 227 } 228 229 if (typeof x["zoomRange"] === "undefined") { 230 A.store.Bool(ptr + 80 + 18, false); 231 A.store.Bool(ptr + 80 + 16, false); 232 A.store.Float64(ptr + 80 + 0, 0); 233 A.store.Bool(ptr + 80 + 17, false); 234 A.store.Float64(ptr + 80 + 8, 0); 235 } else { 236 A.store.Bool(ptr + 80 + 18, true); 237 A.store.Bool(ptr + 80 + 16, "min" in x["zoomRange"] ? true : false); 238 A.store.Float64(ptr + 80 + 0, x["zoomRange"]["min"] === undefined ? 0 : (x["zoomRange"]["min"] as number)); 239 A.store.Bool(ptr + 80 + 17, "max" in x["zoomRange"] ? true : false); 240 A.store.Float64(ptr + 80 + 8, x["zoomRange"]["max"] === undefined ? 0 : (x["zoomRange"]["max"] as number)); 241 } 242 243 if (typeof x["focusRange"] === "undefined") { 244 A.store.Bool(ptr + 104 + 18, false); 245 A.store.Bool(ptr + 104 + 16, false); 246 A.store.Float64(ptr + 104 + 0, 0); 247 A.store.Bool(ptr + 104 + 17, false); 248 A.store.Float64(ptr + 104 + 8, 0); 249 } else { 250 A.store.Bool(ptr + 104 + 18, true); 251 A.store.Bool(ptr + 104 + 16, "min" in x["focusRange"] ? true : false); 252 A.store.Float64(ptr + 104 + 0, x["focusRange"]["min"] === undefined ? 0 : (x["focusRange"]["min"] as number)); 253 A.store.Bool(ptr + 104 + 17, "max" in x["focusRange"] ? true : false); 254 A.store.Float64(ptr + 104 + 8, x["focusRange"]["max"] === undefined ? 0 : (x["focusRange"]["max"] as number)); 255 } 256 } 257 }, 258 "load_WebcamCurrentConfiguration": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 259 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 260 261 if (A.load.Bool(ptr + 123)) { 262 x["pan"] = A.load.Float64(ptr + 0); 263 } else { 264 delete x["pan"]; 265 } 266 if (A.load.Bool(ptr + 124)) { 267 x["tilt"] = A.load.Float64(ptr + 8); 268 } else { 269 delete x["tilt"]; 270 } 271 if (A.load.Bool(ptr + 125)) { 272 x["zoom"] = A.load.Float64(ptr + 16); 273 } else { 274 delete x["zoom"]; 275 } 276 if (A.load.Bool(ptr + 126)) { 277 x["focus"] = A.load.Float64(ptr + 24); 278 } else { 279 delete x["focus"]; 280 } 281 if (A.load.Bool(ptr + 32 + 18)) { 282 x["panRange"] = {}; 283 if (A.load.Bool(ptr + 32 + 16)) { 284 x["panRange"]["min"] = A.load.Float64(ptr + 32 + 0); 285 } else { 286 delete x["panRange"]["min"]; 287 } 288 if (A.load.Bool(ptr + 32 + 17)) { 289 x["panRange"]["max"] = A.load.Float64(ptr + 32 + 8); 290 } else { 291 delete x["panRange"]["max"]; 292 } 293 } else { 294 delete x["panRange"]; 295 } 296 if (A.load.Bool(ptr + 56 + 18)) { 297 x["tiltRange"] = {}; 298 if (A.load.Bool(ptr + 56 + 16)) { 299 x["tiltRange"]["min"] = A.load.Float64(ptr + 56 + 0); 300 } else { 301 delete x["tiltRange"]["min"]; 302 } 303 if (A.load.Bool(ptr + 56 + 17)) { 304 x["tiltRange"]["max"] = A.load.Float64(ptr + 56 + 8); 305 } else { 306 delete x["tiltRange"]["max"]; 307 } 308 } else { 309 delete x["tiltRange"]; 310 } 311 if (A.load.Bool(ptr + 80 + 18)) { 312 x["zoomRange"] = {}; 313 if (A.load.Bool(ptr + 80 + 16)) { 314 x["zoomRange"]["min"] = A.load.Float64(ptr + 80 + 0); 315 } else { 316 delete x["zoomRange"]["min"]; 317 } 318 if (A.load.Bool(ptr + 80 + 17)) { 319 x["zoomRange"]["max"] = A.load.Float64(ptr + 80 + 8); 320 } else { 321 delete x["zoomRange"]["max"]; 322 } 323 } else { 324 delete x["zoomRange"]; 325 } 326 if (A.load.Bool(ptr + 104 + 18)) { 327 x["focusRange"] = {}; 328 if (A.load.Bool(ptr + 104 + 16)) { 329 x["focusRange"]["min"] = A.load.Float64(ptr + 104 + 0); 330 } else { 331 delete x["focusRange"]["min"]; 332 } 333 if (A.load.Bool(ptr + 104 + 17)) { 334 x["focusRange"]["max"] = A.load.Float64(ptr + 104 + 8); 335 } else { 336 delete x["focusRange"]["max"]; 337 } 338 } else { 339 delete x["focusRange"]; 340 } 341 return create === A.H.TRUE ? A.H.push(x) : ref; 342 }, 343 "has_CloseWebcam": (): heap.Ref<boolean> => { 344 if (WEBEXT?.webcamPrivate && "closeWebcam" in WEBEXT?.webcamPrivate) { 345 return A.H.TRUE; 346 } 347 return A.H.FALSE; 348 }, 349 "func_CloseWebcam": (fn: Pointer): void => { 350 A.store.Ref(fn, WEBEXT.webcamPrivate.closeWebcam); 351 }, 352 "call_CloseWebcam": (retPtr: Pointer, webcamId: heap.Ref<object>): void => { 353 const _ret = WEBEXT.webcamPrivate.closeWebcam(A.H.get<object>(webcamId)); 354 }, 355 "try_CloseWebcam": (retPtr: Pointer, errPtr: Pointer, webcamId: heap.Ref<object>): heap.Ref<boolean> => { 356 try { 357 const _ret = WEBEXT.webcamPrivate.closeWebcam(A.H.get<object>(webcamId)); 358 return A.H.TRUE; 359 } catch (err: any) { 360 A.store.Ref(errPtr, err); 361 return A.H.FALSE; 362 } 363 }, 364 "has_Get": (): heap.Ref<boolean> => { 365 if (WEBEXT?.webcamPrivate && "get" in WEBEXT?.webcamPrivate) { 366 return A.H.TRUE; 367 } 368 return A.H.FALSE; 369 }, 370 "func_Get": (fn: Pointer): void => { 371 A.store.Ref(fn, WEBEXT.webcamPrivate.get); 372 }, 373 "call_Get": (retPtr: Pointer, webcamId: heap.Ref<object>): void => { 374 const _ret = WEBEXT.webcamPrivate.get(A.H.get<object>(webcamId)); 375 A.store.Ref(retPtr, _ret); 376 }, 377 "try_Get": (retPtr: Pointer, errPtr: Pointer, webcamId: heap.Ref<object>): heap.Ref<boolean> => { 378 try { 379 const _ret = WEBEXT.webcamPrivate.get(A.H.get<object>(webcamId)); 380 A.store.Ref(retPtr, _ret); 381 return A.H.TRUE; 382 } catch (err: any) { 383 A.store.Ref(errPtr, err); 384 return A.H.FALSE; 385 } 386 }, 387 "has_OpenSerialWebcam": (): heap.Ref<boolean> => { 388 if (WEBEXT?.webcamPrivate && "openSerialWebcam" in WEBEXT?.webcamPrivate) { 389 return A.H.TRUE; 390 } 391 return A.H.FALSE; 392 }, 393 "func_OpenSerialWebcam": (fn: Pointer): void => { 394 A.store.Ref(fn, WEBEXT.webcamPrivate.openSerialWebcam); 395 }, 396 "call_OpenSerialWebcam": (retPtr: Pointer, path: heap.Ref<object>, protocol: Pointer): void => { 397 const protocol_ffi = {}; 398 399 protocol_ffi["protocol"] = A.load.Enum(protocol + 0, ["visca"]); 400 401 const _ret = WEBEXT.webcamPrivate.openSerialWebcam(A.H.get<object>(path), protocol_ffi); 402 A.store.Ref(retPtr, _ret); 403 }, 404 "try_OpenSerialWebcam": ( 405 retPtr: Pointer, 406 errPtr: Pointer, 407 path: heap.Ref<object>, 408 protocol: Pointer 409 ): heap.Ref<boolean> => { 410 try { 411 const protocol_ffi = {}; 412 413 protocol_ffi["protocol"] = A.load.Enum(protocol + 0, ["visca"]); 414 415 const _ret = WEBEXT.webcamPrivate.openSerialWebcam(A.H.get<object>(path), protocol_ffi); 416 A.store.Ref(retPtr, _ret); 417 return A.H.TRUE; 418 } catch (err: any) { 419 A.store.Ref(errPtr, err); 420 return A.H.FALSE; 421 } 422 }, 423 "has_Reset": (): heap.Ref<boolean> => { 424 if (WEBEXT?.webcamPrivate && "reset" in WEBEXT?.webcamPrivate) { 425 return A.H.TRUE; 426 } 427 return A.H.FALSE; 428 }, 429 "func_Reset": (fn: Pointer): void => { 430 A.store.Ref(fn, WEBEXT.webcamPrivate.reset); 431 }, 432 "call_Reset": (retPtr: Pointer, webcamId: heap.Ref<object>, config: Pointer): void => { 433 const config_ffi = {}; 434 435 if (A.load.Bool(config + 72)) { 436 config_ffi["pan"] = A.load.Float64(config + 0); 437 } 438 if (A.load.Bool(config + 73)) { 439 config_ffi["panSpeed"] = A.load.Float64(config + 8); 440 } 441 config_ffi["panDirection"] = A.load.Enum(config + 16, ["stop", "right", "left"]); 442 if (A.load.Bool(config + 74)) { 443 config_ffi["tilt"] = A.load.Float64(config + 24); 444 } 445 if (A.load.Bool(config + 75)) { 446 config_ffi["tiltSpeed"] = A.load.Float64(config + 32); 447 } 448 config_ffi["tiltDirection"] = A.load.Enum(config + 40, ["stop", "up", "down"]); 449 if (A.load.Bool(config + 76)) { 450 config_ffi["zoom"] = A.load.Float64(config + 48); 451 } 452 config_ffi["autofocusState"] = A.load.Enum(config + 56, ["on", "off"]); 453 if (A.load.Bool(config + 77)) { 454 config_ffi["focus"] = A.load.Float64(config + 64); 455 } 456 457 const _ret = WEBEXT.webcamPrivate.reset(A.H.get<object>(webcamId), config_ffi); 458 A.store.Ref(retPtr, _ret); 459 }, 460 "try_Reset": (retPtr: Pointer, errPtr: Pointer, webcamId: heap.Ref<object>, config: Pointer): heap.Ref<boolean> => { 461 try { 462 const config_ffi = {}; 463 464 if (A.load.Bool(config + 72)) { 465 config_ffi["pan"] = A.load.Float64(config + 0); 466 } 467 if (A.load.Bool(config + 73)) { 468 config_ffi["panSpeed"] = A.load.Float64(config + 8); 469 } 470 config_ffi["panDirection"] = A.load.Enum(config + 16, ["stop", "right", "left"]); 471 if (A.load.Bool(config + 74)) { 472 config_ffi["tilt"] = A.load.Float64(config + 24); 473 } 474 if (A.load.Bool(config + 75)) { 475 config_ffi["tiltSpeed"] = A.load.Float64(config + 32); 476 } 477 config_ffi["tiltDirection"] = A.load.Enum(config + 40, ["stop", "up", "down"]); 478 if (A.load.Bool(config + 76)) { 479 config_ffi["zoom"] = A.load.Float64(config + 48); 480 } 481 config_ffi["autofocusState"] = A.load.Enum(config + 56, ["on", "off"]); 482 if (A.load.Bool(config + 77)) { 483 config_ffi["focus"] = A.load.Float64(config + 64); 484 } 485 486 const _ret = WEBEXT.webcamPrivate.reset(A.H.get<object>(webcamId), config_ffi); 487 A.store.Ref(retPtr, _ret); 488 return A.H.TRUE; 489 } catch (err: any) { 490 A.store.Ref(errPtr, err); 491 return A.H.FALSE; 492 } 493 }, 494 "has_RestoreCameraPreset": (): heap.Ref<boolean> => { 495 if (WEBEXT?.webcamPrivate && "restoreCameraPreset" in WEBEXT?.webcamPrivate) { 496 return A.H.TRUE; 497 } 498 return A.H.FALSE; 499 }, 500 "func_RestoreCameraPreset": (fn: Pointer): void => { 501 A.store.Ref(fn, WEBEXT.webcamPrivate.restoreCameraPreset); 502 }, 503 "call_RestoreCameraPreset": (retPtr: Pointer, webcamId: heap.Ref<object>, presetNumber: number): void => { 504 const _ret = WEBEXT.webcamPrivate.restoreCameraPreset(A.H.get<object>(webcamId), presetNumber); 505 A.store.Ref(retPtr, _ret); 506 }, 507 "try_RestoreCameraPreset": ( 508 retPtr: Pointer, 509 errPtr: Pointer, 510 webcamId: heap.Ref<object>, 511 presetNumber: number 512 ): heap.Ref<boolean> => { 513 try { 514 const _ret = WEBEXT.webcamPrivate.restoreCameraPreset(A.H.get<object>(webcamId), presetNumber); 515 A.store.Ref(retPtr, _ret); 516 return A.H.TRUE; 517 } catch (err: any) { 518 A.store.Ref(errPtr, err); 519 return A.H.FALSE; 520 } 521 }, 522 "has_Set": (): heap.Ref<boolean> => { 523 if (WEBEXT?.webcamPrivate && "set" in WEBEXT?.webcamPrivate) { 524 return A.H.TRUE; 525 } 526 return A.H.FALSE; 527 }, 528 "func_Set": (fn: Pointer): void => { 529 A.store.Ref(fn, WEBEXT.webcamPrivate.set); 530 }, 531 "call_Set": (retPtr: Pointer, webcamId: heap.Ref<object>, config: Pointer): void => { 532 const config_ffi = {}; 533 534 if (A.load.Bool(config + 72)) { 535 config_ffi["pan"] = A.load.Float64(config + 0); 536 } 537 if (A.load.Bool(config + 73)) { 538 config_ffi["panSpeed"] = A.load.Float64(config + 8); 539 } 540 config_ffi["panDirection"] = A.load.Enum(config + 16, ["stop", "right", "left"]); 541 if (A.load.Bool(config + 74)) { 542 config_ffi["tilt"] = A.load.Float64(config + 24); 543 } 544 if (A.load.Bool(config + 75)) { 545 config_ffi["tiltSpeed"] = A.load.Float64(config + 32); 546 } 547 config_ffi["tiltDirection"] = A.load.Enum(config + 40, ["stop", "up", "down"]); 548 if (A.load.Bool(config + 76)) { 549 config_ffi["zoom"] = A.load.Float64(config + 48); 550 } 551 config_ffi["autofocusState"] = A.load.Enum(config + 56, ["on", "off"]); 552 if (A.load.Bool(config + 77)) { 553 config_ffi["focus"] = A.load.Float64(config + 64); 554 } 555 556 const _ret = WEBEXT.webcamPrivate.set(A.H.get<object>(webcamId), config_ffi); 557 A.store.Ref(retPtr, _ret); 558 }, 559 "try_Set": (retPtr: Pointer, errPtr: Pointer, webcamId: heap.Ref<object>, config: Pointer): heap.Ref<boolean> => { 560 try { 561 const config_ffi = {}; 562 563 if (A.load.Bool(config + 72)) { 564 config_ffi["pan"] = A.load.Float64(config + 0); 565 } 566 if (A.load.Bool(config + 73)) { 567 config_ffi["panSpeed"] = A.load.Float64(config + 8); 568 } 569 config_ffi["panDirection"] = A.load.Enum(config + 16, ["stop", "right", "left"]); 570 if (A.load.Bool(config + 74)) { 571 config_ffi["tilt"] = A.load.Float64(config + 24); 572 } 573 if (A.load.Bool(config + 75)) { 574 config_ffi["tiltSpeed"] = A.load.Float64(config + 32); 575 } 576 config_ffi["tiltDirection"] = A.load.Enum(config + 40, ["stop", "up", "down"]); 577 if (A.load.Bool(config + 76)) { 578 config_ffi["zoom"] = A.load.Float64(config + 48); 579 } 580 config_ffi["autofocusState"] = A.load.Enum(config + 56, ["on", "off"]); 581 if (A.load.Bool(config + 77)) { 582 config_ffi["focus"] = A.load.Float64(config + 64); 583 } 584 585 const _ret = WEBEXT.webcamPrivate.set(A.H.get<object>(webcamId), config_ffi); 586 A.store.Ref(retPtr, _ret); 587 return A.H.TRUE; 588 } catch (err: any) { 589 A.store.Ref(errPtr, err); 590 return A.H.FALSE; 591 } 592 }, 593 "has_SetCameraPreset": (): heap.Ref<boolean> => { 594 if (WEBEXT?.webcamPrivate && "setCameraPreset" in WEBEXT?.webcamPrivate) { 595 return A.H.TRUE; 596 } 597 return A.H.FALSE; 598 }, 599 "func_SetCameraPreset": (fn: Pointer): void => { 600 A.store.Ref(fn, WEBEXT.webcamPrivate.setCameraPreset); 601 }, 602 "call_SetCameraPreset": (retPtr: Pointer, webcamId: heap.Ref<object>, presetNumber: number): void => { 603 const _ret = WEBEXT.webcamPrivate.setCameraPreset(A.H.get<object>(webcamId), presetNumber); 604 A.store.Ref(retPtr, _ret); 605 }, 606 "try_SetCameraPreset": ( 607 retPtr: Pointer, 608 errPtr: Pointer, 609 webcamId: heap.Ref<object>, 610 presetNumber: number 611 ): heap.Ref<boolean> => { 612 try { 613 const _ret = WEBEXT.webcamPrivate.setCameraPreset(A.H.get<object>(webcamId), presetNumber); 614 A.store.Ref(retPtr, _ret); 615 return A.H.TRUE; 616 } catch (err: any) { 617 A.store.Ref(errPtr, err); 618 return A.H.FALSE; 619 } 620 }, 621 "has_SetHome": (): heap.Ref<boolean> => { 622 if (WEBEXT?.webcamPrivate && "setHome" in WEBEXT?.webcamPrivate) { 623 return A.H.TRUE; 624 } 625 return A.H.FALSE; 626 }, 627 "func_SetHome": (fn: Pointer): void => { 628 A.store.Ref(fn, WEBEXT.webcamPrivate.setHome); 629 }, 630 "call_SetHome": (retPtr: Pointer, webcamId: heap.Ref<object>): void => { 631 const _ret = WEBEXT.webcamPrivate.setHome(A.H.get<object>(webcamId)); 632 A.store.Ref(retPtr, _ret); 633 }, 634 "try_SetHome": (retPtr: Pointer, errPtr: Pointer, webcamId: heap.Ref<object>): heap.Ref<boolean> => { 635 try { 636 const _ret = WEBEXT.webcamPrivate.setHome(A.H.get<object>(webcamId)); 637 A.store.Ref(retPtr, _ret); 638 return A.H.TRUE; 639 } catch (err: any) { 640 A.store.Ref(errPtr, err); 641 return A.H.FALSE; 642 } 643 }, 644 }; 645 });