Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 32 additions & 1 deletion en-us/api/QuecPythonClasslib.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand All @@ -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
Expand Down
31 changes: 30 additions & 1 deletion zh-cn/api/QuecPythonClasslib.md
Original file line number Diff line number Diff line change
Expand Up @@ -1200,7 +1200,7 @@ if __name__ == '__main__':

| 参数 | 参数类型 | 参数说明 |
| ---- | -------- | ---------------------------------------------- |
| addr | string | 需要设置的短信中心号码,最大长度不超过30字节。 |
| addr | string | 需要设置的短信中心号码 |

* 返回值

Expand Down Expand Up @@ -1296,6 +1296,8 @@ PDU解码

* 示例

示例一:

```python
import sms

Expand All @@ -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 - 网络相关功能
Expand Down