当前位置:网站首页>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
边栏推荐
- Docker practice - redis cluster deployment and micro service deployment project
- Set tensorflow1 X to pytorch
- CPU的功能和基本结构
- Day_ 12 smart health project jasperreports
- Open source to the world (Part 2): the power of open source from the evolution of database technology BDTC 2021
- 如何实现与FDA保持邮件通信安全加密?
- Day_05 传智健康项目-预约管理-预约设置
- Dora's Google SEO tutorial (1) SEO novice guide: establishment of preliminary optimization thinking
- 【已解决】“The Unity environment took too long to respond. Make sure that :\n“
- Day_01 传智健康项目-项目概述和环境搭建
猜你喜欢

Qt 中 QVariant 使用总结

如何实现与FDA保持邮件通信安全加密?

Programmers' real ideas | daily anecdotes

Index - MySQL

解析创客教育中的个性化学习进度

Day_02 传智健康项目-预约管理-检查项管理

解读创客教育中的团结协作精神

sklearn sklearn中的模型调参利器 gridSearchCV(网格搜索)

haas506 2.0开发教程-高级组件库-modem.sms(仅支持2.2以上版本)

Measurement principle and thickness measurement mode of spectral confocal
随机推荐
Day_ 03 smart communication health project - appointment management - inspection team management
数值计算方法 Chapter7. 计算矩阵的特征值和特征向量
c#数据库报错问题大家帮我看看吧
【踩坑记录】数据库连接未关闭连接,释放资源的坑
Qt使用多线程编译项目的方法
SAP execution transaction code mrrl error -no message was found for partner 100065-
haas506 2.0开发教程-sntp(仅支持2.2以上版本)
Day_ 13 smart health project - Chapter 13
图解 Google V8 # 17:消息队列:V8是怎么实现回调函数的?
Day_ 01 smart communication health project - project overview and environmental construction
ffplay实现自定义输入流播放
C语言去除字符串尾部的换行(或其他字符)
【接口自动化】软件测试涨薪核心技能、让薪资涨幅200%
Day_07 传智健康项目-Freemarker
Xray linkage crawlergo automatic scanning pit climbing record
百度URL参数之LINK?URL参数加密解密研究(代码实例)
Coordinate transformation
sklearn sklearn中的模型调参利器 gridSearchCV(网格搜索)
C language stepping on the pit: document coding error, resulting in Base64 Chinese coding error
Gridsearchcv (grid search), a model parameter adjuster in sklearn