OLD | NEW |
1 <h1>Accessing Hardware Devices</h1> | 1 <h1>Accessing Hardware Devices</h1> |
2 | 2 |
3 <p> | 3 <p> |
4 This doc shows you how packaged apps can connect to USB devices | 4 This doc shows you how packaged apps can connect to USB devices |
5 and read from and write to a user's serial ports. | 5 and read from and write to a user's serial ports. |
6 See also the reference docs for the | 6 See also the reference docs for the |
7 <a href="usb.html">USB API</a> | 7 <a href="usb.html">USB API</a> |
8 and the | 8 and the |
9 <a href="serial.html">Serial API</a>. | 9 <a href="serial.html">Serial API</a>. |
10 The <a href="bluetooth.html">Bluetooth API</a> is also available; | 10 The <a href="bluetooth.html">Bluetooth API</a> is also available; |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 | 57 |
58 <table class="simple"> | 58 <table class="simple"> |
59 <tr> | 59 <tr> |
60 <th scope="col"> Parameter (type) </th> | 60 <th scope="col"> Parameter (type) </th> |
61 <th scope="col"> Description </th> | 61 <th scope="col"> Description </th> |
62 </tr> | 62 </tr> |
63 <tr> | 63 <tr> |
64 <td>FindDeviceOptions (object)</td> | 64 <td>FindDeviceOptions (object)</td> |
65 <td>An object specifying both a <code>vendorId</code> (long) and | 65 <td>An object specifying both a <code>vendorId</code> (long) and |
66 <code>productId</code> (long) used to find the correct type of device on | 66 <code>productId</code> (long) used to find the correct type of device on |
67 the bus. Before calling this, your extension manifest must declare the | 67 the bus. Your manifest must declare the<code>usbDevices</code> permission |
68 <code>optional_permissons</code> with a <code>usbDevices</code> | 68 section listing all the <code>vendorId</code> and |
69 section containing the same <code>vendorId</code> and | 69 <code>deviceId</code> pairs your app wants to access. |
70 <code>deviceId</code> combination and must have received user consent | |
71 via <code>chrome.permissions.request(...)</code>. | |
72 </td> | 70 </td> |
73 </tr> | 71 </tr> |
74 <tr> | 72 <tr> |
75 <td>callback (function)</td> | 73 <td>callback (function)</td> |
76 <td>Called when the device scan is finished. | 74 <td>Called when the device scan is finished. |
77 The callback will be executed with one parameter, an array of device objec
ts | 75 The callback will be executed with one parameter, an array of device objec
ts |
78 with three properties: <code>handle</code>, | 76 with three properties: <code>handle</code>, |
79 <code>vendorId</code>, | 77 <code>vendorId</code>, |
80 <code>productId</code>. If the optional permissions for this USB device | 78 <code>productId</code>. If the optional permissions for this USB device |
81 were not declared in the extension manifest or the user did not consent | 79 were not declared in the extension manifest or the user did not consent |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 | 680 |
683 <p> | 681 <p> |
684 You can flush your serial port buffer by issuing the flush command: | 682 You can flush your serial port buffer by issuing the flush command: |
685 </p> | 683 </p> |
686 | 684 |
687 <pre> | 685 <pre> |
688 chrome.serial.flush(connectionId, onFlush); | 686 chrome.serial.flush(connectionId, onFlush); |
689 </pre> | 687 </pre> |
690 | 688 |
691 <p class="backtotop"><a href="#top">Back to top</a></p> | 689 <p class="backtotop"><a href="#top">Back to top</a></p> |
OLD | NEW |