modem_ver = modem.getDevFwVersion()
self.reply_cmd('00',"pyVer:{}@modemVer:{}".format(PROJECT_VERSION,modem_ver))
elif cmd == "01":
- print("{}{}".format(cmd,parm))
# UDP_CMD_DIAL_NUMB
- voiceCall.callStart(parm)
+ ret = voiceCall.callStart(str(parm))
+ print("ret={} {} {}".format(ret,cmd,parm))
elif cmd == "02":
print(cmd)
# UDP_CMD_HUNGUP
eventMesh.publish("set_factory_status",int(parm))
elif cmd == "18":
eventMesh.publish("set_dmp_cm_address",str(parm))
-
+ elif cmd == "19": #DTMF功能
+ voiceCall.startDtmf(str(parm),100) #100ms 持续时间 100-1000
+
def telecom_recv_cmd(self,cmd,parm): #电信入库
if cmd == "10":
self.software_version = str(parm)
headers_T ={"Content-Type":"application/json"}
print("ujson.dumps(config_data):{}".format(ujson.dumps(config_data)))
request_result = 0
+ result_json = ""
try:
response = request.post(url, data=ujson.dumps(config_data),headers =headers_T)
request_result = 1
+ if response.status_code == 200:#服务器响应成功并返回数据
+ content = response.content
+ c = next(content)
+ result_json = ujson.loads(c)
+ print("response.json:{}".format(ujson.loads(c)))
except Exception as e:
print("response:{}".format(e))
request_result = 0
- result_json = ""
+
if request_result == 0: #请求出错了
- return result_json
+ return ""
- if response.status_code == 200:#服务器响应成功并返回数据
- content = response.content
- c = next(content)
- result_json = ujson.loads(c)
- print("response.json:{}".format(ujson.loads(c)))
+
return result_json
test_data = ujson.dumps(send_autoregist)#需要转义的字符串
print("test_data:{}".format(test_data))
headers_T ={"Content-Type":"application/json"}
- response = 0
request_result = 0
print("shangbao address:{}\r\n".format(url))
try:
response = request.post(url, data=ujson.dumps(send_autoregist),headers =headers_T)
request_result = 1
- print("response success:\r\n")
- except Exception as e:
- print("response:{}".format(e))
- request_result = 0
-
- if request_result == 0:#请求出错了
- dev_autoregist_result = 0
- return dev_autoregist_result
- else:
result_json = ""
if response.status_code == 200:
else:
dev_autoregist_result = 0
return dev_autoregist_result
+ print("response success:\r\n")
+ except Exception as e:
+ print("response:{}".format(e))
+ request_result = 0
+
+ if request_result == 0:#请求出错了
+ dev_autoregist_result = 0
+ return dev_autoregist_result
+
def read_config_file(self):#获取配置文件,一开机是没有配置文件的
data_encode = base64.b64encode(json_bytes)#再转换成base64的编码格式 密文
print("data_infor:{} data:{}".format(data_encode,data))
headers_T = {'Content-Type':'application/encrypted-json'} #请求头信息 按照实际要求填写
-
request_result = 0
try:
response = request.post("http://zzhc.vnet.cn:9998/", data=data_encode,headers =headers_T)
request_result = 1
+ if response.status_code == 200 : #返回状态码 200服务器正常解析数据
+ content = response.content#后台返回的结果
+ c = next(content)
+
+ jsload_data = ujson.loads(c)
+ print("jsload_data:{}".format(ujson.loads(c))) #{"resultCode": "0","resultDesc": "Success"}
+ if "resultCode" in jsload_data or "resultDesc" in jsload_data:#返回结果码值
+ resultCode = jsload_data["resultCode"]#结果解析 "0" 成功 "1" 解码错误 "2" 校验错误
+ resultDesc = jsload_data["resultDesc"]#Success 表示自注册成功
+
+ if resultCode == "0" or resultDesc == "Success":#注册成功退出当前注册 保存当前的ICCID 不在进行自注册了
+ iccid = self.get_sim_iccid()#获取当前SIM的ICCID
+ if iccid != -1:#读到ICCID
+ self.timer_count = 0
+ self.check_timer.stop()
+ self.isRegistOk = 1#已完成自注册的标识
+ iccid_buf =str("ICCID:")+str(str(iccid))
+ eventMesh.publish("save_iccid_data",iccid_buf)
+ self.multiple_day_resend()
+ #上报成功后 需要29.5或者30.5天后重发 初始值为0.5也就是12小时 30天后再重发一次也是一个月后重发数据自注册域
+ print("regist success:!!!!!")
+ return 1
+ if resultCode == "1":
+ print("Decode error")#解码错误 设备编码不正确
+ return 0
+
+ if resultCode == "2":#
+ print("Check error")#校验错误 设备里面数据不正确 有些数据不应该为空
+ return 0
+
except Exception as e:
print("response:{}".format(e))
request_result = 0
- print("response.status_code:{}".format(response.status_code))
- if response.status_code == 200 and request_result == 1: #返回状态码 200服务器正常解析数据
- content = response.content#后台返回的结果
- c = next(content)
-
- jsload_data = ujson.loads(c)
- print("jsload_data:{}".format(ujson.loads(c))) #{"resultCode": "0","resultDesc": "Success"}
- if "resultCode" in jsload_data or "resultDesc" in jsload_data:#返回结果码值
- resultCode = jsload_data["resultCode"]#结果解析 "0" 成功 "1" 解码错误 "2" 校验错误
- resultDesc = jsload_data["resultDesc"]#Success 表示自注册成功
-
- if resultCode == "0" or resultDesc == "Success":#注册成功退出当前注册 保存当前的ICCID 不在进行自注册了
- iccid = self.get_sim_iccid()#获取当前SIM的ICCID
- if iccid != -1:#没有读到ICCID
- self.timer_count = 0
- self.check_timer.stop()
- self.isRegistOk = 1#已完成自注册的标识
- iccid_buf =str("ICCID:")+str(str(iccid))
- eventMesh.publish("save_iccid_data",iccid_buf)
- self.multiple_day_resend()
- #上报成功后 需要29.5或者30.5天后重发 初始值为0.5也就是12小时 30天后再重发一次也是一个月后重发数据自注册域
- print("regist success:!!!!!")
- return 1
- if resultCode == "1":
- print("Decode error")#解码错误 设备编码不正确
-
- if resultCode == "2":#
- print("Check error")#校验错误 设备里面数据不正确 有些数据不应该为空
return 0
def timer_cb(self,data):#定时器回调
#include "phoneaddressmodel.h"
#include "LanguageInit.h"
#include "ConfigModel.h"
+#include "cat1_server.h"
// #include "TraingCardPresenter.h"
#ifdef FD230
OHOS::ConfigModel *p_ConfigModel = OHOS::ConfigModel::GetInstance();
return p_ConfigModel->get_configData_int(OHOS::ConfigModel::CONFIGMODEL_ITEM_MESSAGE_INDEX);
}
+void SendDtfmStrNumberToCat1(char ch) // ble发送单个字符到CAT1 DTMF功能
+{
+ send_dtfm_number_toCat1(ch);
+}
#ifdef __cplusplus
#if __cplusplus
typedef struct Tag_Trailer
{
-char Header[3];
-char Title[30];
-char Artist[30];
-char Album[30];
-char Year[4];
-char Comment[30];
-char Cenre[1];
+ char Header[3];
+ char Title[30];
+ char Artist[30];
+ char Album[30];
+ char Year[4];
+ char Comment[30];
+ char Cenre[1];
}Tag_Trailer_t;
typedef struct Tag_ID3V2
void hand_watch_first_time_Paired(void);
+////////////////////////////////////////
+void SendDtfmStrNumberToCat1(char ch); //ble发送单个字符到CAT1 DTMF功能
+
#ifdef __cplusplus
#if __cplusplus
}
UDP_MSG_RECV_DMP_FACTORY = 0x17,//用于入库配置flag 0已经恢复出厂过 1代表没有恢复出厂过
UDP_MSG_SEND_DMP_CM_ADDRESS = 0x18,//用于BLE发送移动入库地址 to CAT1 接收
+
+ UDP_MSG_SEND_DTMF_NUMBER = 0x19,//DTMF 功能
};
/** 0: old format 1字节cmd, 1: new format 2字节cmd */
static uint8_t g_msg_format_type = 0;
}
return;
}
-
+void send_dtfm_number_toCat1(char ch)//发送dtfm
+{
+ printf("ch:%s\r\n",&ch);
+ udp_send_msg_toCat1(UDP_MSG_SEND_DTMF_NUMBER,&ch);
+}
static int udp_packet_parse(char *rx_buffer, int len)
{
void ble_get_cat1_at_msg(char *buffer,uint8_t len);
+void send_dtfm_number_toCat1(char ch);//发送dtfm
+
#ifdef __cplusplus
#if __cplusplus
}