diff --git a/en-us/api/QuecPythonClasslib.md b/en-us/api/QuecPythonClasslib.md index 030938d..0eb8bed 100644 --- a/en-us/api/QuecPythonClasslib.md +++ b/en-us/api/QuecPythonClasslib.md @@ -487,7 +487,7 @@ This function enables PIN authentication, and then you need to enter the correct 0 Successful execution. -1 Failed execution. - + * note The BC25PA platform pin password supports up to eight digits. @@ -518,7 +518,7 @@ This function disables PIN authentication 0 Successful execution. -1 Failed execution. - + * note The BC25PA platform pin password supports up to eight digits. @@ -549,7 +549,7 @@ PIN authentication. Only can be called after sim.enablePin(pin) is executed succ 0 Successful execution. -1 Failed execution. - + * note The BC25PA platform pin password supports up to eight digits. @@ -581,7 +581,7 @@ This function unlocks the SIM card. When PIN/PIN2 code is wrongly input for time 0 Successful execution. -1 Failed execution. - + * note The BC25PA platform pin password supports up to eight digits. @@ -613,7 +613,7 @@ Changes PIN. 0 Successful execution. -1 Failed execution. - + * note The BC25PA platform pin password supports up to eight digits. @@ -807,6 +807,7 @@ Description: The BC25PA platform does not support this method. + Example ```python @@ -1023,7 +1024,7 @@ def voice_callback(args): Function: Provides SMS related APIs. Note: The BC25PA platform does not support this module function. - + ##### Send the Message in TEXT Mode > **sms.sendTextMsg(phoneNumber, msg, codeMode)** @@ -1505,7 +1506,7 @@ This function obtains the current APN. * note The BC25PA platform does not support this module function. - + ##### Obtain CSQ > **net.csqQueryPoll()** @@ -1614,7 +1615,7 @@ If the execution is failed, -1 is returned. If the execution is successful, a tu * note The BC25PA platform does not support this module function. - + RAT | Value | RAT | @@ -1670,7 +1671,7 @@ The function sets the current RAT and the roaming configuration. * note The BC25PA platform does not support this module function. - + ##### Obtain the Network Mode @@ -7797,19 +7798,258 @@ Results: +#### NB Internet of things cloud platform + +Module function: it provides the function of connecting to the Internet of things cloud platform and connecting to the Internet of things cloud platform. Through the communication function of IOT cloud platform and module equipment, it currently supports China Telecom lot IOT platform, China Telecom AEP IOT platform and China Mobile onenet IOT platform. + +Module name: nb(lowercase) + +Support platform: BC25PA + +Introduction: it includes three sub modules OC, AEP. The two sub modules all use lwm2m for data interaction. + +##### OC + +###### Create OC object +> **oc=OC(ip,port,psk)** +- **Parameter** + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------ | +| ip | string | The server IP address of the Internet of things platform, with a maximum length of 16. | +| port | string | Server port of Internet of things platform, maximum length 5. | +| psk | string | PSK code module will be used for communication with dtls protocol (it is OK not to enter it now, but it cannot be empty). The maximum length is 64. | + +- Example + +```python +>>> from nb import OC +>>> oc=OC("180.101.147.115","5683","763c9692c6639541e1ddcd6769fc9e33") +``` + +###### Connect to OC cloud platform + +> **oc.connect()** +- **Parameter** +None. +- **Return Value** + Success - 0 + Failed - not 0 +- Example +```python +>>> oc.connect() +0 +``` + +###### Receive data +> **oc.recv(data_len,data)** +- **Parameter** + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------ | +| data_len | int | Expected accepted data length (note that this parameter is adjusted according to the actual length of data, and the minimum value is taken according to the comparison between the capacity of data variable and data_len) | +| data | string | Store received data | + +- Note + +The received data is a hexadecimal string, so the data length must be even. + +- **Return Value** + +Success - 0 + +Failed - not 0 + +- Example + +```python +>>> oc.recv(6,data) +0 +``` + +###### Send data + +> **oc.send(data_len,data,type)** + +- **Parameter** + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------ | +| data_len | int | Expected Send data length (note that this parameter is adjusted according to the actual length of data, and the minimum value is taken according to the comparison between the capacity of data variable and data_len) | +| data | string | Data to be sent | +| type | int | Sending method: 0, 1 and 2 do not need response confirmation, and 100, 101 and 102 need response confirmation. Only 0, 1 and 2 sending methods are supported temporarily. | + +- Note + +The sent data is a hexadecimal string, and the data length is even. + +- **Return Value** + +Success - 0 + +Failed - not 0 + +- Example + +```python +>>> print(data) +bytearray(b'313233') +>>> oc.send(6,data,0) +0 +``` + +###### Close connection + +- **Parameter** + +None + +- **Return Value** + +Success -True + +Failed -False + +- Example + +```python +>>> oc.close() +True +``` + +##### AEP + +###### Create AEP object + +> **aep=AEP(ip,port)** + +- **Parameter** + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------ | +| ip | string | The server IP address of the Internet of things platform, with a maximum length of 16. | +| port | string | Server port of Internet of things platform, maximum length 5. | + +- Example + +```python +>>> from nb import AEP +>>> aep=AEP("221.229.214.202","5683") +``` + +###### Connect to AEP cloud platform + +> **aep.connect()** + +- **Parameter** + +None. + +- **Return Value** + + Success - 0 + + Failed - not 0 + +- Example + +```python +>>> aep.connect() +0 +``` + +###### Receive data + +> **aep.recv(data_len,data)** + +- **Parameter** + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------ | +| data_len | int | Expected accepted data length (note that this parameter is adjusted according to the actual length of data, and the minimum value is taken according to the comparison between the capacity of data variable and data_len) | +| data | string | Store received data | + +- Note + +The received data is a hexadecimal string, so the data length must be even. + +- **Return Value** + +Success - 0 + +Failed - not 0 + +- Example + +```python +>>> aep.recv(6,data) +0 +``` + +###### Send data + +> **aep.send(data_len,data,type)** + +- **Parameter** + +| Parameter | Type | Description | +| --------- | ------ | ------------------------------------------------------------ | +| data_len | int | Expected Send data length (note that this parameter is adjusted according to the actual length of data, and the minimum value is taken according to the comparison between the capacity of data variable and data_len) | +| data | string | Data to be sent | +| type | int | Sending method: 0, 1 and 2 do not need response confirmation, and 100, 101 and 102 need response confirmation. Only 0, 1 and 2 sending methods are supported temporarily. | + +- Note + +The sent data is a hexadecimal string, and the data length is even. + +- **Return Value** + +Success - 0 + +Failed - not 0 + +- Example + +```python +>>> print(data) +bytearray(b'313233') +>>> aep.send(6,data,0) +0 +``` + +###### Close connection + +- **Parameter** + +None + +- **Return Value** + +Success -True + +Failed -False + +- Example + +```python +>>> aep.close() +True +``` +##### +###### diff --git a/zh-cn/api/QuecPythonClasslib.md b/zh-cn/api/QuecPythonClasslib.md index c455060..35e2188 100644 --- a/zh-cn/api/QuecPythonClasslib.md +++ b/zh-cn/api/QuecPythonClasslib.md @@ -1985,7 +1985,7 @@ LTE list: 模块功能:checkNet模块主要用于【开机自动运行】的用户脚本程序,该模块提供API用来阻塞等待网络就绪,如果超时或者其他异常退出会返回错误码,所以如果用户的程序中有涉及网络相关的操作,那么在用户程序的开始应该调用 checkNet 模块中的方法以等待网络就绪。当然,用户也可以自己实现这个模块的功能。 注意:BC25PA平台不支持此模块。 - + ##### 创建checkNet对象 > **import checkNet** @@ -2391,7 +2391,7 @@ if __name__ == '__main__': 模块功能:用户文件升级 注意:BC25PA平台不支持此模块。 - + ##### 创建app_fota对象 1. 导入app_fota模块 @@ -2468,7 +2468,7 @@ download_list = [{'url': 'http://www.example.com/app.py', 'file_name': '/usr/app 模块功能:音频播放,支持TTS、mp3以及AMR文件播放。 注意:BC25PA平台不支持此模块。 - + ##### TTS ###### 创建TTS对象 @@ -5929,7 +5929,7 @@ print(r.group(0)) #### wifiScan 注意:BC25PA平台不支持此方法。 - + ##### 判断是否支持 wifiScan > **wifiScan.support()** @@ -6175,7 +6175,7 @@ wifi list:(2, [('F0:B4:29:86:95:C7': -79),('44:00:4D:D5:26:E0', -92)]) 模块功能:提供 BLE GATT Server 端功能。目前仅200U/600U平台支持。 注意:BC25PA平台不支持模块功能。 - + ##### 初始化 BLE 并注册回调函数 > **ble.serverInit(user_cb)** @@ -7277,7 +7277,7 @@ if __name__ == '__main__': 模块功能:实现摄像头预览,照相机,录像机,扫码功能(目前仅支持预览和扫码功能) 注意:BC25PA平台不支持模块功能。 - + ##### 预览 @@ -7748,3 +7748,254 @@ print(buf[:len]) bytearray(b'12345678') >>> ``` + +#### nb-物联网云平台 + +模块功能:提供对接物联网云平台功能,提供连接物联网云平台。通过物联网云平台和模块设备的通信功能,目前支持中国电信lot物联网平台、中国电信AEP物联网平台和中国移动onenet物联网平台。 + +模块名:nb(小写) + +支持平台:BC25PA + +介绍:其包含了三个子模块OC、AEP。此两个子模块均用lwm2m进行数据的交互。 + +##### OC + +###### 创建OC对象 + +> **oc=OC(ip,port,psk)** + +- 参数 + +| 参数 | 类型 | 说明 | +| ---- | ------ | ------------------------------------------------------------ | +| ip | string | 物联网平台的服务器ip地址,最大长度16. | +| port | string | 物联网平台的服务器端口,最大长度5. | +| psk | string | psk码模块用dtls协议通信会用到(现在不输入也是可以的,但是不能为空),最大长度64. | + +- 示例 + +```python +>>> from nb import OC +>>> oc=OC("180.101.147.115","5683","763c9692c6639541e1ddcd6769fc9e33") +``` + +###### 连接OC云平台 + +> **oc.connect()** + +- 参数 + +无 + +- 返回值 + +成功-0 + +失败-非0 + +- 示例 + +```python +>>> oc.connect() +0 +``` + +###### 接收数据 + +> **oc.recv(data_len,data)** + +- 参数 + +| 参数 | 类型 | 说明 | +| -------- | ------ | ------------------------------------------------------------ | +| data_len | int | 期望接受的数据长度(注意此参数根据data的实际长度进行调整,按照data变量的容量和data_len的比较取最小值) | +| data | string | 存储接收到的数据 | + +- 说明 + +接收数据为16进制字符串,故数据长度必定是偶数。 + +- 返回值 + +成功-0 + +失败-非0 + +- 示例 + +```python +>>> oc.recv(6,data) +0 +``` + +###### 发送数据 + +> **oc.send(data_len,data,type)** + +- 参数 + +| 参数 | 类型 | 说明 | +| -------- | ------ | ------------------------------------------------------------ | +| data_len | int | 期望接受的数据长度(注意此参数根据data的实际长度进行调整,按照data变量的容量和data_len的比较取最小值) | +| data | string | 存储接收到的数据 | +| type | int | 发送方式:0、1、2为无需响应确认,100、101、102需要响应确认。暂时仅支持0、1、2发送方式。 | + +- 说明 + +发送数据为16进制字符串,数据长度为偶数。 + +- 返回值 + +成功-0 + +失败-非0 + +- 示例 + +```python +>>> print(data) +bytearray(b'313233') +>>> oc.send(6,data,0) +0 +``` + +###### 关闭连接 + +- 参数 + +无 + +- 返回值 + +成功-True + +失败-False + +- 示例 + +```python +>>> oc.close() +True +``` + +##### AEP + +###### 创建AEP对象 + +> **aep=AEP(ip,port)** + +- 参数 + +| 参数 | 类型 | 说明 | +| ---- | ------ | ------------------------------------ | +| ip | string | 物联网平台的服务器ip地址,最大长度16. | +| port | string | 物联网平台的服务器端口,最大长度5. | + +- 示例 + +```python +>>> from nb import AEP +>>> aep=AEP("221.229.214.202","5683") +``` + +###### 连接AEP云平台 + +> **aep.connect()** + +- 参数 + +无 + +- 返回值 + +成功-0 + +失败-非0 + +- 示例 + +```python +>>> aep.connect() +0 +``` + +###### 接收数据 + +> **aep.recv(data_len,data)** + +- 参数 + +| 参数 | 类型 | 说明 | +| -------- | ------ | ------------------------------------------------------------ | +| data_len | int | 期望接受的数据长度(注意此参数根据data的实际长度进行调整,按照data变量的容量和data_len的比较取最小值) | +| data | string | 存储接收到的数据 | + +- 说明 + +接收数据为16进制字符串,故数据长度必定是偶数。 + +- 返回值 + +成功-0 + +失败-非0 + +- 示例 + +```python +>>> aep.recv(6,data) +0 +``` + +###### 发送数据 + +> **aep.send(data_len,data,type)** + +- 参数 + +| 参数 | 类型 | 说明 | +| -------- | ------ | ------------------------------------------------------------ | +| data_len | int | 期望发送的数据长度(注意此参数根据data的实际长度进行调整,按照data变量的容量和data_len的比较取最小值) | +| data | string | 待发送数据 | +| type | int | 发送方式:0、1、2为无需响应确认,100、101、102需要响应确认。暂时仅支持0、1、2发送方式。 | + +- 说明 + +发送数据为16进制字符串,数据长度为偶数。 + +- 返回值 + +成功-0 + +失败-非0 + +- 示例 + +```python +>>> print(data) +bytearray(b'313233') +>>> aep.send(6,data,0) +0 +``` + +###### 关闭连接 + +- 参数 + +无 + +- 返回值 + +成功-True + +失败-False + +- 示例 + +```python +>>> aep.close() +True +``` + +#####