github.com/primecitizens/pcz/std@v0.2.1/plat/js/webext/hid/bindings/ffi_bindings.ts (about) 1 import { importModule, Application, heap, Pointer } from "@ffi"; 2 3 importModule("plat/js/webext/hid", (A: Application) => { 4 const WEBEXT = typeof globalThis.browser === "undefined" ? globalThis.chrome : globalThis.browser; 5 6 return { 7 "store_HidConnectInfo": (ptr: Pointer, ref: heap.Ref<any>) => { 8 const x = A.H.get<any>(ref); 9 10 if (typeof x === "undefined") { 11 A.store.Bool(ptr + 5, false); 12 A.store.Bool(ptr + 4, false); 13 A.store.Int32(ptr + 0, 0); 14 } else { 15 A.store.Bool(ptr + 5, true); 16 A.store.Bool(ptr + 4, "connectionId" in x ? true : false); 17 A.store.Int32(ptr + 0, x["connectionId"] === undefined ? 0 : (x["connectionId"] as number)); 18 } 19 }, 20 "load_HidConnectInfo": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 21 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 22 23 if (A.load.Bool(ptr + 4)) { 24 x["connectionId"] = A.load.Int32(ptr + 0); 25 } else { 26 delete x["connectionId"]; 27 } 28 return create === A.H.TRUE ? A.H.push(x) : ref; 29 }, 30 31 "store_DeviceFilter": (ptr: Pointer, ref: heap.Ref<any>) => { 32 const x = A.H.get<any>(ref); 33 34 if (typeof x === "undefined") { 35 A.store.Bool(ptr + 20, false); 36 A.store.Bool(ptr + 16, false); 37 A.store.Int32(ptr + 0, 0); 38 A.store.Bool(ptr + 17, false); 39 A.store.Int32(ptr + 4, 0); 40 A.store.Bool(ptr + 18, false); 41 A.store.Int32(ptr + 8, 0); 42 A.store.Bool(ptr + 19, false); 43 A.store.Int32(ptr + 12, 0); 44 } else { 45 A.store.Bool(ptr + 20, true); 46 A.store.Bool(ptr + 16, "vendorId" in x ? true : false); 47 A.store.Int32(ptr + 0, x["vendorId"] === undefined ? 0 : (x["vendorId"] as number)); 48 A.store.Bool(ptr + 17, "productId" in x ? true : false); 49 A.store.Int32(ptr + 4, x["productId"] === undefined ? 0 : (x["productId"] as number)); 50 A.store.Bool(ptr + 18, "usagePage" in x ? true : false); 51 A.store.Int32(ptr + 8, x["usagePage"] === undefined ? 0 : (x["usagePage"] as number)); 52 A.store.Bool(ptr + 19, "usage" in x ? true : false); 53 A.store.Int32(ptr + 12, x["usage"] === undefined ? 0 : (x["usage"] as number)); 54 } 55 }, 56 "load_DeviceFilter": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 57 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 58 59 if (A.load.Bool(ptr + 16)) { 60 x["vendorId"] = A.load.Int32(ptr + 0); 61 } else { 62 delete x["vendorId"]; 63 } 64 if (A.load.Bool(ptr + 17)) { 65 x["productId"] = A.load.Int32(ptr + 4); 66 } else { 67 delete x["productId"]; 68 } 69 if (A.load.Bool(ptr + 18)) { 70 x["usagePage"] = A.load.Int32(ptr + 8); 71 } else { 72 delete x["usagePage"]; 73 } 74 if (A.load.Bool(ptr + 19)) { 75 x["usage"] = A.load.Int32(ptr + 12); 76 } else { 77 delete x["usage"]; 78 } 79 return create === A.H.TRUE ? A.H.push(x) : ref; 80 }, 81 82 "store_HidCollectionInfo": (ptr: Pointer, ref: heap.Ref<any>) => { 83 const x = A.H.get<any>(ref); 84 85 if (typeof x === "undefined") { 86 A.store.Bool(ptr + 14, false); 87 A.store.Bool(ptr + 12, false); 88 A.store.Int32(ptr + 0, 0); 89 A.store.Bool(ptr + 13, false); 90 A.store.Int32(ptr + 4, 0); 91 A.store.Ref(ptr + 8, undefined); 92 } else { 93 A.store.Bool(ptr + 14, true); 94 A.store.Bool(ptr + 12, "usagePage" in x ? true : false); 95 A.store.Int32(ptr + 0, x["usagePage"] === undefined ? 0 : (x["usagePage"] as number)); 96 A.store.Bool(ptr + 13, "usage" in x ? true : false); 97 A.store.Int32(ptr + 4, x["usage"] === undefined ? 0 : (x["usage"] as number)); 98 A.store.Ref(ptr + 8, x["reportIds"]); 99 } 100 }, 101 "load_HidCollectionInfo": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 102 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 103 104 if (A.load.Bool(ptr + 12)) { 105 x["usagePage"] = A.load.Int32(ptr + 0); 106 } else { 107 delete x["usagePage"]; 108 } 109 if (A.load.Bool(ptr + 13)) { 110 x["usage"] = A.load.Int32(ptr + 4); 111 } else { 112 delete x["usage"]; 113 } 114 x["reportIds"] = A.load.Ref(ptr + 8, undefined); 115 return create === A.H.TRUE ? A.H.push(x) : ref; 116 }, 117 118 "store_HidDeviceInfo": (ptr: Pointer, ref: heap.Ref<any>) => { 119 const x = A.H.get<any>(ref); 120 121 if (typeof x === "undefined") { 122 A.store.Bool(ptr + 46, false); 123 A.store.Bool(ptr + 40, false); 124 A.store.Int32(ptr + 0, 0); 125 A.store.Bool(ptr + 41, false); 126 A.store.Int32(ptr + 4, 0); 127 A.store.Bool(ptr + 42, false); 128 A.store.Int32(ptr + 8, 0); 129 A.store.Ref(ptr + 12, undefined); 130 A.store.Ref(ptr + 16, undefined); 131 A.store.Ref(ptr + 20, undefined); 132 A.store.Bool(ptr + 43, false); 133 A.store.Int32(ptr + 24, 0); 134 A.store.Bool(ptr + 44, false); 135 A.store.Int32(ptr + 28, 0); 136 A.store.Bool(ptr + 45, false); 137 A.store.Int32(ptr + 32, 0); 138 A.store.Ref(ptr + 36, undefined); 139 } else { 140 A.store.Bool(ptr + 46, true); 141 A.store.Bool(ptr + 40, "deviceId" in x ? true : false); 142 A.store.Int32(ptr + 0, x["deviceId"] === undefined ? 0 : (x["deviceId"] as number)); 143 A.store.Bool(ptr + 41, "vendorId" in x ? true : false); 144 A.store.Int32(ptr + 4, x["vendorId"] === undefined ? 0 : (x["vendorId"] as number)); 145 A.store.Bool(ptr + 42, "productId" in x ? true : false); 146 A.store.Int32(ptr + 8, x["productId"] === undefined ? 0 : (x["productId"] as number)); 147 A.store.Ref(ptr + 12, x["productName"]); 148 A.store.Ref(ptr + 16, x["serialNumber"]); 149 A.store.Ref(ptr + 20, x["collections"]); 150 A.store.Bool(ptr + 43, "maxInputReportSize" in x ? true : false); 151 A.store.Int32(ptr + 24, x["maxInputReportSize"] === undefined ? 0 : (x["maxInputReportSize"] as number)); 152 A.store.Bool(ptr + 44, "maxOutputReportSize" in x ? true : false); 153 A.store.Int32(ptr + 28, x["maxOutputReportSize"] === undefined ? 0 : (x["maxOutputReportSize"] as number)); 154 A.store.Bool(ptr + 45, "maxFeatureReportSize" in x ? true : false); 155 A.store.Int32(ptr + 32, x["maxFeatureReportSize"] === undefined ? 0 : (x["maxFeatureReportSize"] as number)); 156 A.store.Ref(ptr + 36, x["reportDescriptor"]); 157 } 158 }, 159 "load_HidDeviceInfo": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 160 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 161 162 if (A.load.Bool(ptr + 40)) { 163 x["deviceId"] = A.load.Int32(ptr + 0); 164 } else { 165 delete x["deviceId"]; 166 } 167 if (A.load.Bool(ptr + 41)) { 168 x["vendorId"] = A.load.Int32(ptr + 4); 169 } else { 170 delete x["vendorId"]; 171 } 172 if (A.load.Bool(ptr + 42)) { 173 x["productId"] = A.load.Int32(ptr + 8); 174 } else { 175 delete x["productId"]; 176 } 177 x["productName"] = A.load.Ref(ptr + 12, undefined); 178 x["serialNumber"] = A.load.Ref(ptr + 16, undefined); 179 x["collections"] = A.load.Ref(ptr + 20, undefined); 180 if (A.load.Bool(ptr + 43)) { 181 x["maxInputReportSize"] = A.load.Int32(ptr + 24); 182 } else { 183 delete x["maxInputReportSize"]; 184 } 185 if (A.load.Bool(ptr + 44)) { 186 x["maxOutputReportSize"] = A.load.Int32(ptr + 28); 187 } else { 188 delete x["maxOutputReportSize"]; 189 } 190 if (A.load.Bool(ptr + 45)) { 191 x["maxFeatureReportSize"] = A.load.Int32(ptr + 32); 192 } else { 193 delete x["maxFeatureReportSize"]; 194 } 195 x["reportDescriptor"] = A.load.Ref(ptr + 36, undefined); 196 return create === A.H.TRUE ? A.H.push(x) : ref; 197 }, 198 199 "store_GetDevicesOptions": (ptr: Pointer, ref: heap.Ref<any>) => { 200 const x = A.H.get<any>(ref); 201 202 if (typeof x === "undefined") { 203 A.store.Bool(ptr + 14, false); 204 A.store.Bool(ptr + 12, false); 205 A.store.Int32(ptr + 0, 0); 206 A.store.Bool(ptr + 13, false); 207 A.store.Int32(ptr + 4, 0); 208 A.store.Ref(ptr + 8, undefined); 209 } else { 210 A.store.Bool(ptr + 14, true); 211 A.store.Bool(ptr + 12, "vendorId" in x ? true : false); 212 A.store.Int32(ptr + 0, x["vendorId"] === undefined ? 0 : (x["vendorId"] as number)); 213 A.store.Bool(ptr + 13, "productId" in x ? true : false); 214 A.store.Int32(ptr + 4, x["productId"] === undefined ? 0 : (x["productId"] as number)); 215 A.store.Ref(ptr + 8, x["filters"]); 216 } 217 }, 218 "load_GetDevicesOptions": (ptr: Pointer, create: heap.Ref<boolean>, ref: heap.Ref<any>): heap.Ref<any> => { 219 const x = create === A.H.TRUE ? {} : A.H.get<any>(ref); 220 221 if (A.load.Bool(ptr + 12)) { 222 x["vendorId"] = A.load.Int32(ptr + 0); 223 } else { 224 delete x["vendorId"]; 225 } 226 if (A.load.Bool(ptr + 13)) { 227 x["productId"] = A.load.Int32(ptr + 4); 228 } else { 229 delete x["productId"]; 230 } 231 x["filters"] = A.load.Ref(ptr + 8, undefined); 232 return create === A.H.TRUE ? A.H.push(x) : ref; 233 }, 234 "has_Connect": (): heap.Ref<boolean> => { 235 if (WEBEXT?.hid && "connect" in WEBEXT?.hid) { 236 return A.H.TRUE; 237 } 238 return A.H.FALSE; 239 }, 240 "func_Connect": (fn: Pointer): void => { 241 A.store.Ref(fn, WEBEXT.hid.connect); 242 }, 243 "call_Connect": (retPtr: Pointer, deviceId: number): void => { 244 const _ret = WEBEXT.hid.connect(deviceId); 245 A.store.Ref(retPtr, _ret); 246 }, 247 "try_Connect": (retPtr: Pointer, errPtr: Pointer, deviceId: number): heap.Ref<boolean> => { 248 try { 249 const _ret = WEBEXT.hid.connect(deviceId); 250 A.store.Ref(retPtr, _ret); 251 return A.H.TRUE; 252 } catch (err: any) { 253 A.store.Ref(errPtr, err); 254 return A.H.FALSE; 255 } 256 }, 257 "has_Disconnect": (): heap.Ref<boolean> => { 258 if (WEBEXT?.hid && "disconnect" in WEBEXT?.hid) { 259 return A.H.TRUE; 260 } 261 return A.H.FALSE; 262 }, 263 "func_Disconnect": (fn: Pointer): void => { 264 A.store.Ref(fn, WEBEXT.hid.disconnect); 265 }, 266 "call_Disconnect": (retPtr: Pointer, connectionId: number): void => { 267 const _ret = WEBEXT.hid.disconnect(connectionId); 268 A.store.Ref(retPtr, _ret); 269 }, 270 "try_Disconnect": (retPtr: Pointer, errPtr: Pointer, connectionId: number): heap.Ref<boolean> => { 271 try { 272 const _ret = WEBEXT.hid.disconnect(connectionId); 273 A.store.Ref(retPtr, _ret); 274 return A.H.TRUE; 275 } catch (err: any) { 276 A.store.Ref(errPtr, err); 277 return A.H.FALSE; 278 } 279 }, 280 "has_GetDevices": (): heap.Ref<boolean> => { 281 if (WEBEXT?.hid && "getDevices" in WEBEXT?.hid) { 282 return A.H.TRUE; 283 } 284 return A.H.FALSE; 285 }, 286 "func_GetDevices": (fn: Pointer): void => { 287 A.store.Ref(fn, WEBEXT.hid.getDevices); 288 }, 289 "call_GetDevices": (retPtr: Pointer, options: Pointer): void => { 290 const options_ffi = {}; 291 292 if (A.load.Bool(options + 12)) { 293 options_ffi["vendorId"] = A.load.Int32(options + 0); 294 } 295 if (A.load.Bool(options + 13)) { 296 options_ffi["productId"] = A.load.Int32(options + 4); 297 } 298 options_ffi["filters"] = A.load.Ref(options + 8, undefined); 299 300 const _ret = WEBEXT.hid.getDevices(options_ffi); 301 A.store.Ref(retPtr, _ret); 302 }, 303 "try_GetDevices": (retPtr: Pointer, errPtr: Pointer, options: Pointer): heap.Ref<boolean> => { 304 try { 305 const options_ffi = {}; 306 307 if (A.load.Bool(options + 12)) { 308 options_ffi["vendorId"] = A.load.Int32(options + 0); 309 } 310 if (A.load.Bool(options + 13)) { 311 options_ffi["productId"] = A.load.Int32(options + 4); 312 } 313 options_ffi["filters"] = A.load.Ref(options + 8, undefined); 314 315 const _ret = WEBEXT.hid.getDevices(options_ffi); 316 A.store.Ref(retPtr, _ret); 317 return A.H.TRUE; 318 } catch (err: any) { 319 A.store.Ref(errPtr, err); 320 return A.H.FALSE; 321 } 322 }, 323 "has_OnDeviceAdded": (): heap.Ref<boolean> => { 324 if (WEBEXT?.hid?.onDeviceAdded && "addListener" in WEBEXT?.hid?.onDeviceAdded) { 325 return A.H.TRUE; 326 } 327 return A.H.FALSE; 328 }, 329 "func_OnDeviceAdded": (fn: Pointer): void => { 330 A.store.Ref(fn, WEBEXT.hid.onDeviceAdded.addListener); 331 }, 332 "call_OnDeviceAdded": (retPtr: Pointer, callback: heap.Ref<object>): void => { 333 const _ret = WEBEXT.hid.onDeviceAdded.addListener(A.H.get<object>(callback)); 334 }, 335 "try_OnDeviceAdded": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 336 try { 337 const _ret = WEBEXT.hid.onDeviceAdded.addListener(A.H.get<object>(callback)); 338 return A.H.TRUE; 339 } catch (err: any) { 340 A.store.Ref(errPtr, err); 341 return A.H.FALSE; 342 } 343 }, 344 "has_OffDeviceAdded": (): heap.Ref<boolean> => { 345 if (WEBEXT?.hid?.onDeviceAdded && "removeListener" in WEBEXT?.hid?.onDeviceAdded) { 346 return A.H.TRUE; 347 } 348 return A.H.FALSE; 349 }, 350 "func_OffDeviceAdded": (fn: Pointer): void => { 351 A.store.Ref(fn, WEBEXT.hid.onDeviceAdded.removeListener); 352 }, 353 "call_OffDeviceAdded": (retPtr: Pointer, callback: heap.Ref<object>): void => { 354 const _ret = WEBEXT.hid.onDeviceAdded.removeListener(A.H.get<object>(callback)); 355 }, 356 "try_OffDeviceAdded": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 357 try { 358 const _ret = WEBEXT.hid.onDeviceAdded.removeListener(A.H.get<object>(callback)); 359 return A.H.TRUE; 360 } catch (err: any) { 361 A.store.Ref(errPtr, err); 362 return A.H.FALSE; 363 } 364 }, 365 "has_HasOnDeviceAdded": (): heap.Ref<boolean> => { 366 if (WEBEXT?.hid?.onDeviceAdded && "hasListener" in WEBEXT?.hid?.onDeviceAdded) { 367 return A.H.TRUE; 368 } 369 return A.H.FALSE; 370 }, 371 "func_HasOnDeviceAdded": (fn: Pointer): void => { 372 A.store.Ref(fn, WEBEXT.hid.onDeviceAdded.hasListener); 373 }, 374 "call_HasOnDeviceAdded": (retPtr: Pointer, callback: heap.Ref<object>): void => { 375 const _ret = WEBEXT.hid.onDeviceAdded.hasListener(A.H.get<object>(callback)); 376 A.store.Bool(retPtr, _ret); 377 }, 378 "try_HasOnDeviceAdded": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 379 try { 380 const _ret = WEBEXT.hid.onDeviceAdded.hasListener(A.H.get<object>(callback)); 381 A.store.Bool(retPtr, _ret); 382 return A.H.TRUE; 383 } catch (err: any) { 384 A.store.Ref(errPtr, err); 385 return A.H.FALSE; 386 } 387 }, 388 "has_OnDeviceRemoved": (): heap.Ref<boolean> => { 389 if (WEBEXT?.hid?.onDeviceRemoved && "addListener" in WEBEXT?.hid?.onDeviceRemoved) { 390 return A.H.TRUE; 391 } 392 return A.H.FALSE; 393 }, 394 "func_OnDeviceRemoved": (fn: Pointer): void => { 395 A.store.Ref(fn, WEBEXT.hid.onDeviceRemoved.addListener); 396 }, 397 "call_OnDeviceRemoved": (retPtr: Pointer, callback: heap.Ref<object>): void => { 398 const _ret = WEBEXT.hid.onDeviceRemoved.addListener(A.H.get<object>(callback)); 399 }, 400 "try_OnDeviceRemoved": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 401 try { 402 const _ret = WEBEXT.hid.onDeviceRemoved.addListener(A.H.get<object>(callback)); 403 return A.H.TRUE; 404 } catch (err: any) { 405 A.store.Ref(errPtr, err); 406 return A.H.FALSE; 407 } 408 }, 409 "has_OffDeviceRemoved": (): heap.Ref<boolean> => { 410 if (WEBEXT?.hid?.onDeviceRemoved && "removeListener" in WEBEXT?.hid?.onDeviceRemoved) { 411 return A.H.TRUE; 412 } 413 return A.H.FALSE; 414 }, 415 "func_OffDeviceRemoved": (fn: Pointer): void => { 416 A.store.Ref(fn, WEBEXT.hid.onDeviceRemoved.removeListener); 417 }, 418 "call_OffDeviceRemoved": (retPtr: Pointer, callback: heap.Ref<object>): void => { 419 const _ret = WEBEXT.hid.onDeviceRemoved.removeListener(A.H.get<object>(callback)); 420 }, 421 "try_OffDeviceRemoved": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 422 try { 423 const _ret = WEBEXT.hid.onDeviceRemoved.removeListener(A.H.get<object>(callback)); 424 return A.H.TRUE; 425 } catch (err: any) { 426 A.store.Ref(errPtr, err); 427 return A.H.FALSE; 428 } 429 }, 430 "has_HasOnDeviceRemoved": (): heap.Ref<boolean> => { 431 if (WEBEXT?.hid?.onDeviceRemoved && "hasListener" in WEBEXT?.hid?.onDeviceRemoved) { 432 return A.H.TRUE; 433 } 434 return A.H.FALSE; 435 }, 436 "func_HasOnDeviceRemoved": (fn: Pointer): void => { 437 A.store.Ref(fn, WEBEXT.hid.onDeviceRemoved.hasListener); 438 }, 439 "call_HasOnDeviceRemoved": (retPtr: Pointer, callback: heap.Ref<object>): void => { 440 const _ret = WEBEXT.hid.onDeviceRemoved.hasListener(A.H.get<object>(callback)); 441 A.store.Bool(retPtr, _ret); 442 }, 443 "try_HasOnDeviceRemoved": (retPtr: Pointer, errPtr: Pointer, callback: heap.Ref<object>): heap.Ref<boolean> => { 444 try { 445 const _ret = WEBEXT.hid.onDeviceRemoved.hasListener(A.H.get<object>(callback)); 446 A.store.Bool(retPtr, _ret); 447 return A.H.TRUE; 448 } catch (err: any) { 449 A.store.Ref(errPtr, err); 450 return A.H.FALSE; 451 } 452 }, 453 "has_Receive": (): heap.Ref<boolean> => { 454 if (WEBEXT?.hid && "receive" in WEBEXT?.hid) { 455 return A.H.TRUE; 456 } 457 return A.H.FALSE; 458 }, 459 "func_Receive": (fn: Pointer): void => { 460 A.store.Ref(fn, WEBEXT.hid.receive); 461 }, 462 "call_Receive": (retPtr: Pointer, connectionId: number, callback: heap.Ref<object>): void => { 463 const _ret = WEBEXT.hid.receive(connectionId, A.H.get<object>(callback)); 464 }, 465 "try_Receive": ( 466 retPtr: Pointer, 467 errPtr: Pointer, 468 connectionId: number, 469 callback: heap.Ref<object> 470 ): heap.Ref<boolean> => { 471 try { 472 const _ret = WEBEXT.hid.receive(connectionId, A.H.get<object>(callback)); 473 return A.H.TRUE; 474 } catch (err: any) { 475 A.store.Ref(errPtr, err); 476 return A.H.FALSE; 477 } 478 }, 479 "has_ReceiveFeatureReport": (): heap.Ref<boolean> => { 480 if (WEBEXT?.hid && "receiveFeatureReport" in WEBEXT?.hid) { 481 return A.H.TRUE; 482 } 483 return A.H.FALSE; 484 }, 485 "func_ReceiveFeatureReport": (fn: Pointer): void => { 486 A.store.Ref(fn, WEBEXT.hid.receiveFeatureReport); 487 }, 488 "call_ReceiveFeatureReport": (retPtr: Pointer, connectionId: number, reportId: number): void => { 489 const _ret = WEBEXT.hid.receiveFeatureReport(connectionId, reportId); 490 A.store.Ref(retPtr, _ret); 491 }, 492 "try_ReceiveFeatureReport": ( 493 retPtr: Pointer, 494 errPtr: Pointer, 495 connectionId: number, 496 reportId: number 497 ): heap.Ref<boolean> => { 498 try { 499 const _ret = WEBEXT.hid.receiveFeatureReport(connectionId, reportId); 500 A.store.Ref(retPtr, _ret); 501 return A.H.TRUE; 502 } catch (err: any) { 503 A.store.Ref(errPtr, err); 504 return A.H.FALSE; 505 } 506 }, 507 "has_Send": (): heap.Ref<boolean> => { 508 if (WEBEXT?.hid && "send" in WEBEXT?.hid) { 509 return A.H.TRUE; 510 } 511 return A.H.FALSE; 512 }, 513 "func_Send": (fn: Pointer): void => { 514 A.store.Ref(fn, WEBEXT.hid.send); 515 }, 516 "call_Send": (retPtr: Pointer, connectionId: number, reportId: number, data: heap.Ref<object>): void => { 517 const _ret = WEBEXT.hid.send(connectionId, reportId, A.H.get<object>(data)); 518 A.store.Ref(retPtr, _ret); 519 }, 520 "try_Send": ( 521 retPtr: Pointer, 522 errPtr: Pointer, 523 connectionId: number, 524 reportId: number, 525 data: heap.Ref<object> 526 ): heap.Ref<boolean> => { 527 try { 528 const _ret = WEBEXT.hid.send(connectionId, reportId, A.H.get<object>(data)); 529 A.store.Ref(retPtr, _ret); 530 return A.H.TRUE; 531 } catch (err: any) { 532 A.store.Ref(errPtr, err); 533 return A.H.FALSE; 534 } 535 }, 536 "has_SendFeatureReport": (): heap.Ref<boolean> => { 537 if (WEBEXT?.hid && "sendFeatureReport" in WEBEXT?.hid) { 538 return A.H.TRUE; 539 } 540 return A.H.FALSE; 541 }, 542 "func_SendFeatureReport": (fn: Pointer): void => { 543 A.store.Ref(fn, WEBEXT.hid.sendFeatureReport); 544 }, 545 "call_SendFeatureReport": ( 546 retPtr: Pointer, 547 connectionId: number, 548 reportId: number, 549 data: heap.Ref<object> 550 ): void => { 551 const _ret = WEBEXT.hid.sendFeatureReport(connectionId, reportId, A.H.get<object>(data)); 552 A.store.Ref(retPtr, _ret); 553 }, 554 "try_SendFeatureReport": ( 555 retPtr: Pointer, 556 errPtr: Pointer, 557 connectionId: number, 558 reportId: number, 559 data: heap.Ref<object> 560 ): heap.Ref<boolean> => { 561 try { 562 const _ret = WEBEXT.hid.sendFeatureReport(connectionId, reportId, A.H.get<object>(data)); 563 A.store.Ref(retPtr, _ret); 564 return A.H.TRUE; 565 } catch (err: any) { 566 A.store.Ref(errPtr, err); 567 return A.H.FALSE; 568 } 569 }, 570 }; 571 });