Skip to content
This repository was archived by the owner on Feb 12, 2023. It is now read-only.

Commit c6543cd

Browse files
author
Ke, Mingze
committed
Completed chrome.serial apis
1 parent 544d83b commit c6543cd

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

‎lib/chrome.serial.js

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,38 @@ chrome.serial = chrome.serial || (function (_api) {
66
undef = undefined,
77
proxyRequest = _api.proxyRequest,
88
proxyAddListener = _api.proxyAddListener,
9-
proxyRemoveListener = _api.proxyRemoveListener;
9+
proxyRemoveListener = _api.proxyRemoveListener,
10+
proxiedSend = proxyRequest('chrome.serial.send');
1011

1112
return {
1213
getDevices: proxyRequest('chrome.serial.getDevices'),
1314

14-
getConnections: proxyRequest('chrome.serial.getConnections'),
15-
1615
connect: proxyRequest('chrome.serial.connect'),
1716

17+
update: proxyRequest('chrome.serial.update'),
18+
1819
disconnect: proxyRequest('chrome.serial.disconnect'),
1920

21+
setPaused: proxyRequest('chrome.serial.setPaused'),
22+
23+
getInfo: proxyRequest('chrome.serial.getInfo'),
24+
25+
getConnections: proxyRequest('chrome.serial.getConnections'),
26+
2027
send: function (connectionId, data, callback) {
21-
proxyRequest('chrome.serial.send')
22-
.apply(undef, [connectionId, slice.call(new Uint8Array(data)), callback]);
28+
proxiedSend.apply(undef, [connectionId, slice.call(new Uint8Array(data)), callback]);
2329
},
2430

31+
flush: proxyRequest('chrome.serial.flush'),
32+
33+
getControlSignals: proxyRequest('chrome.serial.getControlSignals'),
34+
35+
setControlSignals: proxyRequest('chrome.serial.setControlSignals'),
36+
37+
setBreak: proxyRequest('chrome.serial.setBreak'),
38+
39+
clearBreak: proxyRequest('chrome.serial.clearBreak'),
40+
2541
onReceive: {
2642
addListener: proxyAddListener('chrome.serial.onReceive.addListener'),
2743
removeListener: proxyRemoveListener('chrome.serial.onReceive.removeListener')

0 commit comments

Comments
 (0)