提交 28228c9e 编写于 作者: D dongbinbin

Fix example code.

Signed-off-by: Ndongbinbin <dongbinbin@huawei.com>
上级 d8a597aa
...@@ -82,6 +82,7 @@ bindDevice(deviceId: number, onDisconnect: AsyncCallback&lt;number&gt;, ...@@ -82,6 +82,7 @@ bindDevice(deviceId: number, onDisconnect: AsyncCallback&lt;number&gt;,
```js ```js
try { try {
// 12345678为示例deviceId,应用开发时可通过queryDevices查询到相应设备的deviceId作为入参
deviceManager.bindDevice(12345678, (error, data) => { deviceManager.bindDevice(12345678, (error, data) => {
console.error('Device is disconnected'); console.error('Device is disconnected');
}, (error, data) => { }, (error, data) => {
...@@ -131,6 +132,7 @@ bindDevice(deviceId: number, onDisconnect: AsyncCallback&lt;number&gt;): Promise ...@@ -131,6 +132,7 @@ bindDevice(deviceId: number, onDisconnect: AsyncCallback&lt;number&gt;): Promise
```js ```js
try { try {
// 12345678为示例deviceId,应用开发时可通过queryDevices查询到相应设备的deviceId作为入参
deviceManager.bindDevice(12345678, (error, data) => { deviceManager.bindDevice(12345678, (error, data) => {
console.error('Device is disconnected'); console.error('Device is disconnected');
}).then(data => { }).then(data => {
...@@ -169,6 +171,7 @@ unbindDevice(deviceId: number, callback: AsyncCallback&lt;number&gt;): void ...@@ -169,6 +171,7 @@ unbindDevice(deviceId: number, callback: AsyncCallback&lt;number&gt;): void
```js ```js
try { try {
// 12345678为示例deviceId,应用开发时可通过queryDevices查询到相应设备的deviceId作为入参
deviceManager.unbindDevice(12345678, (error, data) => { deviceManager.unbindDevice(12345678, (error, data) => {
if (error) { if (error) {
console.error('unbindDevice async fail. Code is ${error.code}, message is ${error.message}'); console.error('unbindDevice async fail. Code is ${error.code}, message is ${error.message}');
...@@ -211,6 +214,7 @@ unbindDevice(deviceId: number): Promise&lt;number&gt; ...@@ -211,6 +214,7 @@ unbindDevice(deviceId: number): Promise&lt;number&gt;
```js ```js
try { try {
// 12345678为示例deviceId,应用开发时可通过queryDevices查询到相应设备的deviceId作为入参
deviceManager.unbindDevice(12345678).then(data => { deviceManager.unbindDevice(12345678).then(data => {
console.info('unbindDevice success'); console.info('unbindDevice success');
}, error => { }, error => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册