当前位置:网站首页>Haas506 2.0 development tutorial - Advanced Component Library -modem Voicecall (only supports versions above 2.2)
Haas506 2.0 development tutorial - Advanced Component Library -modem Voicecall (only supports versions above 2.2)
2022-06-23 06:38:00 【Zhiyunfu】
haas506 2.0 Development tutorial - Advanced component library -modem.voiceCall
1. Make a phone call
Case description :
- Use the development board to talk with mobile phones .
- Need to insert SIM card
- Be careful : ‘phonenumber’ Need to change to a phone number (str Format )
main.py
from modem import voiceCall
from audio import Audio
import utime
if __name__ == '__main__':
# Instantiation
vc = voiceCall()
ad = Audio()
ad.set_pa() # The telephone function needs to turn on the power amplifier in advance
ad.setVolume(10) # set volume
utime.sleep(3)
# Make a phone call
vc.callStart('phonenumber')
2. Answer the phone
main.py
from modem import voiceCall
from audio import Audio
import utime
def voice_callback(args):
if args[0] == 10:
print('voicecall incoming call, PhoneNO.: ', args[6])
elif args[0] == 11:
print('voicecall connected, PhoneNO.: ', args[6])
elif args[0] == 12:
print('voicecall disconnect')
elif args[0] == 13:
print('voicecall is waiting, PhoneNO.: ', args[6])
elif args[0] == 14:
print('voicecall dialing, PhoneNO.: ', args[6])
elif args[0] == 15:
print('voicecall alerting, PhoneNO.: ', args[6])
elif args[0] == 16:
print('voicecall holding, PhoneNO.: ', args[6])
if __name__ == '__main__':
# Instantiation
vc = voiceCall()
ad = Audio()
# The telephone function needs to turn on the power amplifier in advance
ad.set_pa()
# set volume
ad.setVolume(10)
utime.sleep(3)
# Set the listening callback function
vc.setCallback(voice_callback)
utime.sleep(2)
vc.callAnswer()
# Hang up
utime.sleep(10)
vc.callEnd()
3.Class-sim
| setCallback | setAutoAnswer | callStart | callAnswer | callEnd |
|---|---|---|---|---|
| Set the listening callback function | Set auto response time | Make a phone call | Answer the phone when you call | Hang up |
voiceCall - Call function
- The function prototype :
modem.voiceCall()
- Parameter description : nothing
setCallback - Set the listening callback function
The functionality : Set the listening callback function
The function prototype :
voiceCall.setCallback(voice_callback)
- Parameter description :
| Parameters | explain ? |
|---|---|
| voice_callback | Listen for callback functions |
- Return value : The registration is successful and the integer is returned 0, Failure returns an integer -1 .
setAutoAnswer - Set auto response time
The functionality : Set auto response time , Auto connect when incoming
The function prototype :
voiceCall.setAutoAnswer(ms)
- Parameter description :
| Parameters | explain |
|---|---|
| ms | Automatic response time , Company ms |
callStart- Make a phone call
The functionality : Make a phone call
The function prototype :
voiceCall.voiceCall.callStart(phonenumber)
- Parameter description :
| Parameters | explain ? |
|---|---|
| phonenumber | The phone number you dialed |
callAnswer - Answer the phone when you call
The functionality : Answer the phone when you call
The function prototype :
voiceCall.callAnswer()
- Parameter description : nothing
callEnd - Hang up
The functionality : Hang up
The function prototype :
voiceCall.callEnd()
- Parameter description : nothing
边栏推荐
- Topic35——34. Find the first and last positions of elements in a sorted array
- 数值计算方法 Chapter7. 计算矩阵的特征值和特征向量
- js创建数组(元素都是对象)
- The softing datafeed OPC suite stores Siemens PLC data in an Oracle Database
- 开源生态|超实用开源License基础知识扫盲帖(下)
- minio单节点部署 minio分布式部署 傻瓜式部署过程 (一)
- phpStudy设置301重定向
- Day_ 03 smart communication health project - appointment management - inspection team management
- Fastdata pole | insight report on e-commerce consumption of young Chinese users 2021
- Xray linkage crawlergo automatic scanning pit climbing record
猜你喜欢

Softing dataFEED OPC Suite将西门子PLC数据存储到Oracle数据库中

Docker实战 -- 部署Redis集群与部署微服务项目

sklearn sklearn中classification_report&精确度/召回率/F1值

Easy EDA #学习笔记09# | ESP32-WROOM-32E模组ESP32-DevKitC-V4开发板 一键下载电路

Vs+qt project transferred to QT Creator

Day_13 傳智健康項目-第13章

Day_ 11 smart communication health project - graphic report and poi Report

Day_ 13 smart health project - Chapter 13

Synchronous switching power supply reduces EMI layout dv/dt di/dt

Day_ 03 smart communication health project - appointment management - inspection team management
随机推荐
Day_ 08 smart health project - mobile terminal development - physical examination appointment
问题:访问组件中数据object(定义的数据)中属性也为object对象中的属性时,报错现象
mongodb 4. X binding multiple IP startup errors
C # database reports errors. Let's have a look
Summary of business logic security ideas
【已解决】“The Unity environment took too long to respond. Make sure that :\n“
聚焦智慧城市,华为携手中科星图共同开拓数字化新蓝海
Day_13 傳智健康項目-第13章
Link of Baidu URL Parameters? Recherche sur le chiffrement et le décryptage des paramètres d'URL (exemple de Code)
Day_10 传智健康项目-权限控制、图形报表
Test of ers function under the supplier consignment purchase mode of SAP mm
什么是PDCA循环?如何整合 PDCA 循环和 OKR
English语法_形容词比较级 - 3级变化
解读创客教育中的团结协作精神
haas506 2.0开发教程-高级组件库-modem.sim(仅支持2.2以上版本)
Repeated DNA sequences for leetcode topic resolution
Day_05 传智健康项目-预约管理-预约设置
Day_ 12 smart health project jasperreports
C language stepping on the pit: document coding error, resulting in Base64 Chinese coding error
Day_08 传智健康项目-移动端开发-体检预约