From 9201ebad069578fe5f1d96df63674b7da68d116c Mon Sep 17 00:00:00 2001 From: Mia1234567890 Date: Tue, 17 Aug 2021 11:56:12 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=80=81=E6=9E=B6=E6=9E=84?= =?UTF-8?q?=E7=9F=AD=E4=BF=A1=E5=9B=9E=E8=B0=83=E7=A4=BA=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- en-us/api/QuecPythonClasslib.md | 33 ++++++++++++++++++++++++++++++++- zh-cn/api/QuecPythonClasslib.md | 31 ++++++++++++++++++++++++++++++- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/en-us/api/QuecPythonClasslib.md b/en-us/api/QuecPythonClasslib.md index d4d798e..ae65c67 100644 --- a/en-us/api/QuecPythonClasslib.md +++ b/en-us/api/QuecPythonClasslib.md @@ -1247,7 +1247,7 @@ This function sets the short message center number. And it is not recommended to | Parameter | Type | Description | | --------- | ------ | ------------------------------------------------------------ | -| addr | string | The short message center number to be set. The maximum length is 30 bytes. | +| addr | string | The short message center number to be set.| * Return Value @@ -1353,6 +1353,10 @@ This function registers the listening callback function. This function will be t * Example +The new architecture refers to example 1, and the old architecture refers to example 2 + +example 1: + ```python import sms @@ -1364,6 +1368,33 @@ def cb(args): sms.setCallback(cb) ``` +example 2: + +```python +import sms + +def cb(args): + ind_flag = args[0] + if ind_flag == 4097: + mes_buf = args[1] + mes_len = args[2] + print('New message! ind_flag:{},mes_buf:{},mes_len:{}'.format(ind_flag, mes_buf, mes_len)) + elif ind_flag == 4099: + mes_type = args[1] + storage = args[2] + index = args[3] + print('New message! ind_flag:{},mes_type:{},storage:{},index:{}'.format(ind_flag, mes_type, storage, index)) + elif ind_flag == 4100: + mes_buf = args[1] + print('New message! ind_flag:{},mes_buf:{}'.format(ind_flag, mes_buf)) + elif ind_flag == 4101: + storage = args[1] + index = args[2] + print('New message! ind_flag:{},storage:{},index:{}'.format(ind_flag, storage, index)) + +sms.setCallback(cb) +``` + #### net - Network diff --git a/zh-cn/api/QuecPythonClasslib.md b/zh-cn/api/QuecPythonClasslib.md index ec99173..190a4a2 100644 --- a/zh-cn/api/QuecPythonClasslib.md +++ b/zh-cn/api/QuecPythonClasslib.md @@ -1200,7 +1200,7 @@ if __name__ == '__main__': | 参数 | 参数类型 | 参数说明 | | ---- | -------- | ---------------------------------------------- | -| addr | string | 需要设置的短信中心号码,最大长度不超过30字节。 | +| addr | string | 需要设置的短信中心号码 | * 返回值 @@ -1296,6 +1296,8 @@ PDU解码 * 示例 +示例一: + ```python import sms @@ -1307,6 +1309,33 @@ def cb(args): sms.setCallback(cb) ``` +示例二: + +```python +import sms + +def cb(args): + ind_flag = args[0] + if ind_flag == 4097: + mes_buf = args[1] + mes_len = args[2] + print('New message! ind_flag:{},mes_buf:{},mes_len:{}'.format(ind_flag, mes_buf, mes_len)) + elif ind_flag == 4099: + mes_type = args[1] + storage = args[2] + index = args[3] + print('New message! ind_flag:{},mes_type:{},storage:{},index:{}'.format(ind_flag, mes_type, storage, index)) + elif ind_flag == 4100: + mes_buf = args[1] + print('New message! ind_flag:{},mes_buf:{}'.format(ind_flag, mes_buf)) + elif ind_flag == 4101: + storage = args[1] + index = args[2] + print('New message! ind_flag:{},storage:{},index:{}'.format(ind_flag, storage, index)) + +sms.setCallback(cb) +``` + #### net - 网络相关功能