From: p15692025051 <846603105@qq.com> Date: Tue, 14 Nov 2023 09:38:44 +0000 (+0800) Subject: K01去掉GNSS,添加视频通话 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=3f2dcddb0fe5870ba40d781498efd91e96f904d0;p=mirrors%2FASR1603_G5.git K01去掉GNSS,添加视频通话 --- diff --git a/2.sdk/Helios_SDK/components/juphoon/jrtc.h b/2.sdk/Helios_SDK/components/juphoon/jrtc.h index 213a88a7..d7b70dec 100644 --- a/2.sdk/Helios_SDK/components/juphoon/jrtc.h +++ b/2.sdk/Helios_SDK/components/juphoon/jrtc.h @@ -3,7 +3,7 @@ #ifdef __cplusplus extern "C" { #endif -#define juphoon_LOG(msg, ...) custom_log("juphoon", msg, ##__VA_ARGS__) + /** * 呼叫流程: 假设 `设备A' 呼叫 `设备B' * diff --git a/2.sdk/Helios_SDK/components/juphoon/lib/libjrtc.a b/2.sdk/Helios_SDK/components/juphoon/lib/libjrtc.a index 52ab3141..2109dc2d 100644 Binary files a/2.sdk/Helios_SDK/components/juphoon/lib/libjrtc.a and b/2.sdk/Helios_SDK/components/juphoon/lib/libjrtc.a differ diff --git a/2.sdk/Helios_SDK/services/microPython/extmod/vfs.c b/2.sdk/Helios_SDK/services/microPython/extmod/vfs.c index cd9d782a..e5d319fb 100644 --- a/2.sdk/Helios_SDK/services/microPython/extmod/vfs.c +++ b/2.sdk/Helios_SDK/services/microPython/extmod/vfs.c @@ -112,7 +112,7 @@ mp_vfs_mount_t *mp_vfs_lookup_path(const char *path, const char **path_out) { *path_out = path; return MP_STATE_VM(vfs_cur); } -#include "debug.h" +//#include "debug.h" #if defined(PLAT_ASR) || defined(PLAT_Unisoc) || defined(PLAT_ASR_1606) || defined(PLAT_Unisoc_8850) || defined(PLAT_Unisoc_8910_R05) void get_vfs_path(const char* base_path, char* dsc_path) { char *p_out = NULL; diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/callbackdeal.c b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/callbackdeal.c index 800d8f06..f6888ca3 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/callbackdeal.c +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/callbackdeal.c @@ -427,6 +427,16 @@ void qpy_callback_deal_thread(void * args_in) mp_sched_schedule_ex(&cb_msg->callback, mp_obj_new_int(cb_msg->state)); } break; + #if CONFIG_juphoon + case CALLBACK_TYPE_ID_JRTC: + { + st_CallBack_jrtc *cb_msg = (st_CallBack_Encoder *)msg.msg; + arg = mp_obj_new_int(cb_msg->result); + mp_sched_schedule_ex(&cb_msg->callback, arg); + + } + break; + #endif #if MICROPY_QPY_MODULE_GPIO_ENCODER case CALLBACK_TYPE_ID_ENCODER: { diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/callbackdeal.h b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/callbackdeal.h index 62d78e7d..2ac40b95 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/callbackdeal.h +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/callbackdeal.h @@ -75,6 +75,9 @@ enum { #endif CALLBACK_TYPE_ID_TP, CALLBACK_TYPE_ID_Gsensor, +#if CONFIG_juphoon + CALLBACK_TYPE_ID_JRTC, +#endif #if MICROPY_QPY_MODULE_GPIO_ENCODER CALLBACK_TYPE_ID_ENCODER, #endif @@ -97,7 +100,12 @@ enum { CALLBACK_TYPE_ID_DATACALL, #endif }; - +#if CONFIG_juphoon +typedef struct{ + uint32_t result; + c_callback_t callback; +}st_CallBack_jrtc; +#endif typedef struct CallBack_LoadBoundMeth{ c_callback_t *callback; void *arg; @@ -124,6 +132,7 @@ typedef struct{ uint8_t state; c_callback_t callback; }st_CallBack_Gsensor; + typedef struct{ uint32_t spin_direct; c_callback_t callback; diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modVideoCall_juphoon.c b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modVideoCall_juphoon.c index 6cda6c3e..c6f8a565 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modVideoCall_juphoon.c +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/modVideoCall_juphoon.c @@ -5,22 +5,22 @@ ////////////////////////////////////////////////////////////////////////////// // Includes ////////////////////////////////////////////////////////////////////////////// -#include "autoconf.h" +#include #include -#include "runtime.h" -#include -#include -#include "mphalport.h" -#include "compile.h" -#include "repl.h" -#include "mperrno.h" -#include "binary.h" - -#include -#if 0 +#include "obj.h" +#include "runtime.h" +#include "helios.h" +#include "helios_debug.h" +#include "helios_datacall.h" +// #include "jc_prv.h" +// #include "jc_aes.h" +#if CONFIG_juphoon +#include "jrtc.h" +#include "jrtc0.h" +#include "callbackdeal.h" #include "helios_debug.h" #include "autoconf.h" @@ -28,211 +28,319 @@ ////////////////////////////////////////////////////////////////////////////// -#include "helios_extint.h" -#include "jrtc.h" +#define HELIOS_JRTC_LOG(msg, ...) custom_log("JRTC", msg, ##__VA_ARGS__) +#define datacall_debug(fmt, ...) custom_log(APP, fmt, ##__VA_ARGS__) +/** 通话错误值 */ -/* 定义juphoon_obj_t结构体 */ -typedef struct _juphoon_obj_t +struct jrtc_t { - mp_obj_base_t base; //定义的对象结构体要包含该成员 -}juphoon_obj_t; + void* task; //必须放在头部 + struct jrtc_t *next; + volatile unsigned char state, error; + char room[65], uid[65], vid[65], screen[65]; + unsigned short srvIdx, gop, istats;//统计周期,默认5s + unsigned short video_cs_threshold;//卡顿阀值,默认300毫秒 + unsigned short auto_req_slen; + struct AES_ctx *aes_ctx; + struct net_sock *tcpfd, *udpfd; + struct net_addr *udp_addr, *srv_addr; + unsigned char *recv_buf, *ared_buf, *vfec_buf; + unsigned short recv_off, ared_off; + unsigned hash, vfec_size, role, status; + struct jrtc_image_t *camera, *video; + unsigned audio_ssrc, video_ssrc;//local ssrc + unsigned char udp_fail_count; + char audio_pt, ared_pt; + char video_pt, vfec_pt; + unsigned short audio_seqno, video_seqno, vfec_seqno; + unsigned char audio_ptime; + unsigned char req_cam:2; + unsigned char req_batch:2; + unsigned char req_event:3;//1:status,2:role,3:video,4:index + unsigned char audio_received:1; + unsigned char video_started:1, audio_started:1, leave_called:1, video_changed:1; + unsigned char aenc_idx:2, adec_idx:2, venc_idx:2, vdec_idx:2; + char netst_pt, volu_pt; + signed char index; + unsigned char video_index; + unsigned char recv_types;//RECV_TYPE + unsigned recv_ms, send_ms, stats_ms, last_ms; + struct rtp_lostr_t* audio_lostR, *video_lostR; + struct rtp_stats_t* audio_stats, *video_stats; + unsigned recv_frame_count, recv_frame_ms;//fps + unsigned video_cs;//统计周期内(istats)卡顿毫秒数和 + void (*effect_cb)(struct jrtc_photo_t* frame); + //发送请求处理 + void* req_sem; + char req_id[65]; + unsigned req_mask, req_value; +}; + +// enum jrtc_error err; +int protect = 0; -const mp_obj_type_t juphoon_type; -juphoon_obj_t *single_juphoon = NULL; +static struct jrtc_image_t send = {0}; +static struct jrtc_image_t recieve = {0}; -#define CONFIG_STR_LEN 40 -//void jrtc_config (const char* appkey, const char* uid, const char key[16], const char* tokens); -STATIC mp_obj_t Juphoon_make_new(const mp_obj_type_t *type, size_t n_args, size_t n_kw, const mp_obj_t *args) + +/* 定义jrtc_obj_t结构体 */ +typedef struct _jrtc_obj_t { - mp_arg_check_num(n_args, n_kw, 0, 4, false); //检查参数个数 - if( single_juphoon == NULL ) { - single_juphoon = m_new_obj_with_finaliser(juphoon_obj_t); //创建对象,分配空间 - } - juphoon_obj_t *self = single_juphoon; - self->base.type = &juphoon_type; //定义对象的类型 + mp_obj_base_t base; //定义的对象结构体要包含该成员 +}jrtc_obj_t; - int ret = 0; +const mp_obj_type_t jrtc_type; - char appkey[CONFIG_STR_LEN + 1] = {0}; /*appkey 当前APP特有的标识, 需向Juphoon申请获得*/ - char uid[CONFIG_STR_LEN + 1] = {0}; /*uid 账户*/ - char key[CONFIG_STR_LEN + 1] = {0}; /*key 通讯密钥, 必须与appkey匹配, 需向Juphoon申请或注册*/ - char tokens[CONFIG_STR_LEN + 1] = {0}; /*用于鉴权的tokens,默认为""*/ - - switch(n_args){ - case 4:{ - mp_buffer_info_t tokens_info; - mp_get_buffer_raise(args[3], &tokens_info, MP_BUFFER_READ); - if( tokens_info.len > CONFIG_STR_LEN ) { - juphoon_LOG("tokens length error"); - ret = -1; - break; - } - memcpy(tokens, tokens_info.buf,tokens_info.len); - juphoon_LOG("tokens = %s\n\r",tokens); - //no break - } - - case 3:{ - mp_buffer_info_t key_info; - mp_get_buffer_raise(args[2], &key_info, MP_BUFFER_READ); - if(key_info.len != 16 ) { - juphoon_LOG("key length error\n\r"); - ret = -1; - break; - } - memcpy(key, key_info.buf,key_info.len); - juphoon_LOG(" key = %s\n\r",key); - //no break; - } - - case 2:{ - mp_buffer_info_t uid_info; - mp_get_buffer_raise(args[1], &uid_info, MP_BUFFER_READ); - if(uid_info.len == 0 || uid_info.len > CONFIG_STR_LEN) { - juphoon_LOG("uid length error\n\r"); - ret = -1; - break; - } - memcpy(uid,uid_info.buf,key_info.len); - juphoon_LOG("uid = %s\n\r",uid); - //no break - } - - case 1:{ - mp_buffer_info_t appkey_info; - mp_get_buffer_raise(args[0], &appkey_info, MP_BUFFER_READ); - if(appkey_info.len == 0 || appkey_info.len > CONFIG_STR_LEN) { - juphoon_LOG("appkey length error\n\r"); - ret = -1; - break; +/** 当前的版本号 */ +#define JRTC_VERTION "1.4.0" + + +static Helios_MsgQ_t int_happen_q = 0; +static Helios_Thread_t int_handle_task_id = 0; + +//mp_buffer_info_t roomid, ticket; +static struct jrtc_t* test = NULL; +int self_close_sta = 0; +static c_callback_t *usr_callback = NULL; +static c_callback_t cb = {0}; + +char *ticket_temp = NULL; +char *roomid_temp = NULL; + + +void jrtc_handle(void * argv) { + uint8_t open_state = 0; + int ret = -1; + while (1) { + ret = Helios_MsgQ_Get(int_happen_q, (void *)&open_state, sizeof(uint8_t), HELIOS_WAIT_FOREVER); + if (ret != 0) + { + HELIOS_JRTC_LOG("interrupt handle thread failed to get queue\n"); + continue; + } + if (open_state == 1) { + if (jrtc_state(test) == JRTC_CLOSED) { + //jrtc_open(roomid_temp, ticket_temp, &recieve, &send); + // mp_get_buffer_raise(args[ARG_roomid], &roomid, MP_BUFFER_READ); + // mp_get_buffer_raise(args[ARG_ticket], &ticket, MP_BUFFER_READ); + HELIOS_JRTC_LOG("105\n"); + test = jrtc_open(roomid_temp, ticket_temp, &recieve, &send); + HELIOS_JRTC_LOG("107\n"); + jrtc_activate(test, JRTC_AUDIO|JRTC_CAMERA); + // 等待对方视频对讲结束 + while(jrtc_state(test) != JRTC_CLOSED) + { + Helios_msleep(1000); + } + if (self_close_sta == 0) { + // 判断是对方挂断,产生回调 + st_CallBack_jrtc *jrtc_int = malloc(sizeof(st_CallBack_jrtc)); + if(NULL != jrtc_int) { + jrtc_int->result = self_close_sta; + jrtc_int->callback = cb; + qpy_send_msg_to_callback_deal_thread(CALLBACK_TYPE_ID_JRTC, jrtc_int); + } + } } - memcpy(appkey, appkey_info.buf, appkey_info.len); - juphoon_LOG("appkey = %s\n\r",appkey); - break; - } - - default: - juphoon_LOG(" info error"); - ret = -1; - break; + } } +} - if(ret != 0){ - return mp_obj_new_int(ret); - } - juphoon_LOG("ret = %d\n\r",ret); - //配置全局参数,只需调用一次. - jrtc_config (appkey, uid, key, tokens); - return MP_OBJ_FROM_PTR(self); //返回对象的指针 +// 注册回调函数 +STATIC mp_obj_t set_callback(const mp_obj_t handler) +{ + usr_callback = &cb; + mp_sched_schedule_callback_register(usr_callback, handler); + + return mp_obj_new_int(1); } -struct jrtc_t* jrtc_open (const char* id, const char* ticket, struct jrtc_image_t* video, struct jrtc_image_t* camera); -struct jrtc_image_t -{/* 可强转为 jrtc_photo_t 使用 */ - void* data; - unsigned bytes; - unsigned short width, height; - char format;/*< enum jrtc_dtype */ - char fps; - unsigned short kbps; - volatile char put, get; - char reserve[2]; -}; +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_set_callback_obj, set_callback); -STATIC const mp_arg_t alipay_pay_config_args[] = -{ - { MP_QSTR_id, MP_ARG_REQUIRED | MP_ARG_OBJ, { .u_obj = MP_OBJ_NULL} }, - { MP_QSTR_ticket, MP_ARG_REQUIRED | MP_ARG_OBJ, { .u_obj = MP_OBJ_NULL} }, - { MP_QSTR_bind_interval, MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } }, - { MP_QSTR_payment_interval, MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } }, - { MP_QSTR_msg_task_priority, MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } }, - { MP_QSTR_msg_task_stacksize, MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } }, - { MP_QSTR_notifier_cb, MP_ARG_REQUIRED | MP_ARG_OBJ, { .u_obj = MP_OBJ_NULL} }, - { MP_QSTR_sync_mode, MP_ARG_REQUIRED | MP_ARG_INT, { .u_int = 0 } }, -}; -STATIC mp_obj_t juphoon_init(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) +STATIC mp_obj_t mp_jrtc_init(void) { + Helios_ThreadAttr attr = {0}; + if (int_happen_q == 0) { + int_happen_q = Helios_MsgQ_Create(1, sizeof(uint8_t)); + } + if(int_handle_task_id == 0) + { + attr.name = "jrtc_handle"; + attr.stack_size = 1024*4; + attr.priority = 90; + attr.entry = jrtc_handle; + + int_handle_task_id = Helios_Thread_Create(&attr); + if (0 == int_handle_task_id) + { + mp_raise_ValueError("create interrupt handle task failed\n"); + } + } + + + return mp_obj_new_int(1); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_0(mp_jrtc_init_obj, mp_jrtc_init); + +STATIC mp_obj_t mp_jrtc_config_server (mp_obj_t config_server) { - enum {ARG_bind_timeout, ARG_payment_timeout, ARG_bind_interval, ARG_payment_interval, ARG_msg_task_priority, ARG_msg_task_stacksize, - ARG_notifier_cb, ARG_sync_mode,}; - - mp_arg_val_t args[MP_ARRAY_SIZE(alipay_pay_config_args)]; - mp_arg_parse_all(n_args - 1, pos_args + 1, kw_args,MP_ARRAY_SIZE(alipay_pay_config_args), alipay_pay_config_args, args); - - ALIPAY_obj_t *self = (ALIPAY_obj_t *)MP_OBJ_TO_PTR(pos_args[0]); + char *config_s= (char*)mp_obj_str_get_str(config_server); + jrtc_config_server(config_s); + + return mp_obj_new_int(1); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_jrtc_config_server_obj, mp_jrtc_config_server); - helios_pay_config_t pay_config = {0}; + +STATIC mp_obj_t mp_jrtc_config (size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) +{ int ret = 0; + static Helios_DataCallInfoStruct datacall_info = {0}; + Helios_DataCall_GetInfo(1, 0, &datacall_info); + enum { ARG_appkey, ARG_uid, ARG_srvURL, ARG_key}; + //jrtc_image_t temp_image_config = {0}; - pay_config.query_bind_result_timeout = args[ARG_bind_timeout].u_int; - pay_config.query_payment_result_timeout = args[ARG_payment_timeout].u_int; - pay_config.query_bind_result_interval = args[ARG_bind_interval].u_int; - pay_config.query_payment_result_interval = args[ARG_payment_interval].u_int; - pay_config.msg_task_priority = args[ARG_msg_task_priority].u_int; - pay_config.msg_task_stacksize = args[ARG_msg_task_stacksize].u_int; - if (args[ARG_notifier_cb].u_obj != mp_const_none) { - static c_callback_t cb = {0}; - memset(&cb, 0, sizeof(c_callback_t)); - pay_init_callback = &cb; - mp_sched_schedule_callback_register(pay_init_callback, args[ARG_notifier_cb].u_obj); + static const mp_arg_t allowed_args[] = + { + { MP_QSTR_appkey, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_uid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_srvURL, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_key, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + }; + mp_arg_val_t vals[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args , args , kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, vals); + //mp_buffer_info_t appkey, uid, srvURL, key; + // mp_get_buffer_raise(args[ARG_appkey], &appkey, MP_BUFFER_READ); + // mp_get_buffer_raise(args[ARG_uid], &uid, MP_BUFFER_READ); + // mp_get_buffer_raise(args[ARG_srvURL], &srvURL, MP_BUFFER_READ); + // mp_get_buffer_raise(args[ARG_key], &key, MP_BUFFER_READ); + + char *appkey_temp = (char *)mp_obj_str_get_str(vals[ARG_appkey].u_obj); + char *uid_temp = (char *)mp_obj_str_get_str(vals[ARG_uid].u_obj); + char *srvURL_temp = (char *)mp_obj_str_get_str(vals[ARG_srvURL].u_obj); + char *key_temp = (char *)mp_obj_str_get_str(vals[ARG_key].u_obj); + // char *appkey_temp = (char *)mp_obj_str_get_str(ARG_appkey); + // char *uid_temp = (char *)mp_obj_str_get_str(ARG_uid); + // char *srvURL_temp = (char *)mp_obj_str_get_str(ARG_srvURL); + // char *key_temp = (char *)mp_obj_str_get_str(ARG_key); + // jrtc_config(appkey_temp, uid_temp, srvURL_temp, key_temp); + //jrtc_config(appkey.buf, uid.buf, srvURL.buf, key.buf); + + jrtc_config(appkey_temp, uid_temp, srvURL_temp, key_temp); + _jrtc_net_info = &datacall_info; + protect = 1; + ret = 1; + return mp_obj_new_int(ret); +} +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mp_jrtc_config_obj, 4 ,mp_jrtc_config); + + +STATIC mp_obj_t mp_jrtc_open (size_t n_args, const mp_obj_t *args, mp_map_t *kw_args) +{ + int ret = 0; + if(protect != 1){ + HELIOS_JRTC_LOG("Not config\n"); + ret = -1; + return mp_obj_new_int(-1); } - pay_config.notifier_cb = helios_callback_to_pay_init; - pay_config.sync_mode = args[ARG_sync_mode].u_int; + enum { ARG_roomid, ARG_ticket, ARG_recieve, ARG_send}; + static const mp_arg_t allowed_args[] = + { + { MP_QSTR_roomid, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_ticket, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_recieve, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + { MP_QSTR_send, MP_ARG_REQUIRED | MP_ARG_OBJ, {.u_obj = MP_OBJ_NULL} }, + }; + mp_arg_val_t vals[MP_ARRAY_SIZE(allowed_args)]; + mp_arg_parse_all(n_args , args , kw_args, MP_ARRAY_SIZE(allowed_args), allowed_args, vals); + /*mp_get_buffer_raise(vals[ARG_roomid].u_obj, &roomid, MP_BUFFER_READ); + mp_get_buffer_raise(vals[ARG_ticket].u_obj, &ticket, MP_BUFFER_READ);*/ - MP_THREAD_GIL_EXIT(); - ret = Helios_upay_init(&pay_config); - MP_THREAD_GIL_ENTER(); + roomid_temp = (char *)mp_obj_str_get_str(vals[ARG_roomid].u_obj); + ticket_temp = (char *)mp_obj_str_get_str(vals[ARG_ticket].u_obj); + size_t len; + mp_obj_t *elem; + mp_obj_get_array(vals[ARG_send].u_obj, &len, &elem); + recieve.fps = mp_obj_get_int(elem[0]); + recieve.kbps = mp_obj_get_int(elem[1]); + recieve.width = mp_obj_get_int(elem[2]); + recieve.height= mp_obj_get_int(elem[3]); + mp_obj_get_array(vals[ARG_recieve].u_obj, &len, &elem); + send.fps = mp_obj_get_int(elem[0]); + send.kbps = mp_obj_get_int(elem[1]); + send.width = mp_obj_get_int(elem[2]); + send.height = mp_obj_get_int(elem[3]); + + uint8_t int_happen = 1; + Helios_MsgQ_Put(int_happen_q, (const void *)&int_happen, sizeof(uint8_t), HELIOS_NO_WAIT); + + // ret = jrtc_open(roomid_temp, ticket_temp, &recieve, &send); + // jrtc_activate(test, JRTC_AUDIO|JRTC_CAMERA); return mp_obj_new_int(ret); } +STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mp_jrtc_open_obj, 4, mp_jrtc_open); + + +STATIC mp_obj_t mp_jrtc_close (mp_obj_t err_j) +{ + int ret = 0; + HELIOS_JRTC_LOG("257"); + int err = mp_obj_get_int(err_j); + if((err != 0) && (err != 1) && (err != 64) && (err != 71) && (err != 90) && (err != 104) && + (err != 101) && (err != 111) && (err != 128) && (err != 129) && (err != 130) && (err != 131) && + (err != 132) && (err != 133) && (err != 134) && (err != 135) && (err != 136) && (err != 137) && + (err != 138) && (err != 252) && (err != 253) && (err != 254) &&(err != 255)) + { + HELIOS_JRTC_LOG("err_j is invalid\n"); + ret = -1; + return mp_obj_new_int(ret); + } + else { + //err = err_j; + if (test == NULL) { + mp_raise_ValueError("point fail\n"); + } + MP_THREAD_GIL_EXIT(); + jrtc_close(test, err); + MP_THREAD_GIL_ENTER(); + test = NULL; + ret = 1; + self_close_sta = 1; + //Helios_DataCall_Stop(1, 0, 0); + return mp_obj_new_int(ret); + } + +} + +STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_jrtc_close_obj, mp_jrtc_close); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_init_HX3918_obj, mp_HX3918_init);//初始化 -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_deinit_HX3918_obj, mp_HX3918_deinit);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_activate_HX3918_obj, mp_activate_HX3918);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_get_blood_oxygen_obj, mp_HX3918_get_blood_oxygen);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_get_heart_obj, mp_HX3918_get_heart);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_get_blood_pressure_obj, mp_HX3918_get_blood_pressure);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_get_wear_obj, mp_HX3918_get_wear);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_open_heart_obj, mp_HX3918_open_heart);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_open_blood_oxygen_obj, mp_HX3918_open_blood_oxygen);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_open_hrv_obj, mp_HX3918_open_hrv);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_get_hrv_obj, mp_HX3918_get_hrv);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_get_all_data_obj, mp_HX3918_get_all_data);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_close_obj, mp_HX3918_close);// -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_set_sleep_obj, mp_HX3918_set_sleep);// -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_HX3918_open_test_obj, mp_HX3918_open_test); -STATIC MP_DEFINE_CONST_FUN_OBJ_2(mp_HX3918_set_sar_obj, mp_HX3918_set_sar); -STATIC MP_DEFINE_CONST_FUN_OBJ_1(mp_HX3918_get_test_data_obj, mp_HX3918_get_test_data);// - -STATIC const mp_rom_map_elem_t HX3918_locals_dict_table[] = { - { MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&mp_init_HX3918_obj) }, - { MP_ROM_QSTR(MP_QSTR_deinit), MP_ROM_PTR(&mp_deinit_HX3918_obj) }, - { MP_ROM_QSTR(MP_QSTR_activate), MP_ROM_PTR(&mp_activate_HX3918_obj) }, - { MP_ROM_QSTR(MP_QSTR_get_blood_oxygen), MP_ROM_PTR(&mp_HX3918_get_blood_oxygen_obj)}, - { MP_ROM_QSTR(MP_QSTR_get_heart), MP_ROM_PTR(&mp_HX3918_get_heart_obj)}, - { MP_ROM_QSTR(MP_QSTR_get_blood_pressure), MP_ROM_PTR(&mp_HX3918_get_blood_pressure_obj)}, - { MP_ROM_QSTR(MP_QSTR_get_wear), MP_ROM_PTR(&mp_HX3918_get_wear_obj)}, - { MP_ROM_QSTR(MP_QSTR_open_heart), MP_ROM_PTR(&mp_HX3918_open_heart_obj)}, - { MP_ROM_QSTR(MP_QSTR_open_blood_oxygen), MP_ROM_PTR(&mp_HX3918_open_blood_oxygen_obj)}, - { MP_ROM_QSTR(MP_QSTR_open_hrv), MP_ROM_PTR(&mp_HX3918_open_hrv_obj)}, - { MP_ROM_QSTR(MP_QSTR_get_hrv), MP_ROM_PTR(&mp_HX3918_get_hrv_obj)}, - { MP_ROM_QSTR(MP_QSTR_get_all_data), MP_ROM_PTR(&mp_HX3918_get_all_data_obj)}, - { MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_HX3918_close_obj)}, - { MP_ROM_QSTR(MP_QSTR_set_sleep), MP_ROM_PTR(&mp_HX3918_set_sleep_obj)}, - { MP_ROM_QSTR(MP_QSTR_open_test), MP_ROM_PTR(&mp_HX3918_open_test_obj)}, - { MP_ROM_QSTR(MP_QSTR_set_sar), MP_ROM_PTR(&mp_HX3918_set_sar_obj)}, - { MP_ROM_QSTR(MP_QSTR_get_test_data), MP_ROM_PTR(&mp_HX3918_get_test_data_obj)}, -}; -STATIC MP_DEFINE_CONST_DICT(HX3918_locals_dict, HX3918_locals_dict_table); -const mp_obj_type_t Hsensor_HX3918_type = { - { &mp_type_type }, - .name = MP_QSTR_HX3918, - .make_new = HX3918_make_new, - .locals_dict = (mp_obj_dict_t*)&HX3918_locals_dict, + + +/* 定义的modjrtc本地字典 */ +STATIC const mp_rom_map_elem_t jrtc_globals_table[] = { + {MP_OBJ_NEW_QSTR(MP_QSTR___name__), MP_ROM_QSTR(MP_QSTR_jrtc)}, //这个对应python层面的__name__ 属性 + {MP_ROM_QSTR(MP_QSTR_config), MP_ROM_PTR(&mp_jrtc_config_obj)}, //新增的modtest_obj_func_withargs对象注册到modtest中 + {MP_ROM_QSTR(MP_QSTR_open), MP_ROM_PTR(&mp_jrtc_open_obj)}, + {MP_ROM_QSTR(MP_QSTR_close), MP_ROM_PTR(&mp_jrtc_close_obj)}, + {MP_ROM_QSTR(MP_QSTR_set_callback), MP_ROM_PTR(&mp_set_callback_obj)}, + {MP_ROM_QSTR(MP_QSTR_init), MP_ROM_PTR(&mp_jrtc_init_obj)}, + {MP_ROM_QSTR(MP_QSTR_config_server), MP_ROM_PTR(&mp_jrtc_config_server_obj)}, }; +/* 把modjrtc_globals_table注册到 mp_module_modjrtc_globals里面去 */ +//STATIC MP_DEFINE_CONST_DICT(jrtc_locals_dict, jrtc_locals_dict_table); +STATIC MP_DEFINE_CONST_DICT(mp_module_jrtc_globals, jrtc_globals_table); + +/* 定义mp_obj_type_t类型的结构体;注意这里和定义module使用的类型是不一样的 */ +const mp_obj_module_t mp_module_jrtc = { + .base={ &mp_type_module }, + //.name = MP_QSTR_jrtc, //type类的name属性是放在这里定义,而不是放在DICT中 + //.make_new = can_mcp2515_make_new, //添加的make new属性 + .globals = (mp_obj_dict_t*)&mp_module_jrtc_globals, //注册jrtc_locals_dict +}; #endif diff --git a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/mpconfigport.h b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/mpconfigport.h index e8cddda0..76f42354 100644 --- a/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/mpconfigport.h +++ b/2.sdk/Helios_SDK/services/microPython/ports/quectel/core/source/mpconfigport.h @@ -721,13 +721,18 @@ extern const struct _mp_obj_module_t mp_module_Hsensor; #define MICROPY_PORT_BUILTIN_MODULES_Hsensor #endif -#if 1 //MICROPY_QPY_MODULE_VideoCall -extern const struct _mp_obj_module_t mp_module_VideoCall; -#define MICROPY_PORT_BUILTIN_MODULES_VideoCall { MP_OBJ_NEW_QSTR(MP_QSTR_VideoCall), (mp_obj_t)&mp_module_VideoCall}, -#else -#define MICROPY_PORT_BUILTIN_MODULES_VideoCall +// #if 1 //MICROPY_QPY_MODULE_VideoCall +// extern const struct _mp_obj_module_t mp_module_VideoCall; +// #define MICROPY_PORT_BUILTIN_MODULES_VideoCall { MP_OBJ_NEW_QSTR(MP_QSTR_VideoCall), (mp_obj_t)&mp_module_VideoCall}, +// #else +// #define MICROPY_PORT_BUILTIN_MODULES_VideoCall +// #endif +#if CONFIG_juphoon +extern const struct _mp_obj_module_t mp_module_jrtc; +#define MICROPY_PORT_BUILTIN_MODULES_JRTC { MP_OBJ_NEW_QSTR(MP_QSTR_jrtc), (mp_obj_t)&mp_module_jrtc}, +#else +#define MICROPY_PORT_BUILTIN_MODULES_JRTC #endif - extern const struct _mp_obj_module_t mp_module_code128; #define MICROPY_PORT_BUILTIN_MODULES_code128 { MP_OBJ_NEW_QSTR(MP_QSTR_code128), (mp_obj_t)&mp_module_code128 }, /* ע��`code128`� */ #if MICROPY_QPY_MODULE_NETWORK @@ -794,7 +799,7 @@ extern const struct _mp_obj_module_t mp_module_network; MICROPY_PORT_BUILTIN_MODULES_Gsensor \ MICROPY_PORT_BUILTIN_MODULES_ENCODER \ MICROPY_PORT_BUILTIN_MODULES_Hsensor \ - MICROPY_PORT_BUILTIN_MODULES_VideoCall \ + MICROPY_PORT_BUILTIN_MODULES_JRTC \ MICROPY_PORT_BUILTIN_MODULES_code128\ MICROPY_PORT_BUILTIN_MODULES_NETWORK diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/EventMesh.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/EventMesh.py index 84c8fc71..b1df6058 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/EventMesh.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/EventMesh.py @@ -80,7 +80,7 @@ def add_filter(flt): event_store.add_filter(flt) import utime import uos -Txt_Log = 1 +Txt_Log = 0 def txt_log(data): if Txt_Log != 0 : print(data) diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py index 60b1bf3d..7dc6b900 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/btn_device_ec800m.py @@ -73,27 +73,27 @@ class BtnDevice(Abstract): self.Coder_timer.start(100, 1, self.Coder_timer_cb) rest_flag = 0 data_tmp = "" - if args[0] == 21: - # if self.Coder_B.read_level() == 1: - # self.start_timer_b = utime.ticks_us() - # else : - diff = utime.ticks_diff(utime.ticks_us(), self.start_timer_b) - self.start_timer_b = utime.ticks_us() - if diff > 8000 :#and diff <200000: - pass - #data_tmp = "B:{} {} {}\n".format(args[1],diff//1000,self.Coder_B.read_level()) - else : - return - elif args[0] == 22: - #if self.Coder_A.read_level() == 1: + # if args[0] == 21: + # # if self.Coder_B.read_level() == 1: + # # self.start_timer_b = utime.ticks_us() + # # else : + # diff = utime.ticks_diff(utime.ticks_us(), self.start_timer_b) + # self.start_timer_b = utime.ticks_us() + # if diff > 8000 :#and diff <200000: + # pass + # #data_tmp = "B:{} {} {}\n".format(args[1],diff//1000,self.Coder_B.read_level()) + # else : + # return + # elif args[0] == 22: + # #if self.Coder_A.read_level() == 1: - diff = utime.ticks_diff(utime.ticks_us(), self.start_timer_a) - self.start_timer_a = utime.ticks_us() - if diff > 8000 :#and diff <200000: - pass - #data_tmp = "A:{} {} {}\n".format(args[1],diff//1000,self.Coder_A.read_level()) - else : - return + # diff = utime.ticks_diff(utime.ticks_us(), self.start_timer_a) + # self.start_timer_a = utime.ticks_us() + # if diff > 8000 :#and diff <200000: + # pass + # #data_tmp = "A:{} {} {}\n".format(args[1],diff//1000,self.Coder_A.read_level()) + # else : + # return #self.Coder_data_str_1+=data_tmp if self.Coder_IO_tmp != 0 : if self.Coder_IO_tmp != args[0] :#上一个中断io和当前中断io不一样 diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/capacitive_hynitron_cst816d_update.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/capacitive_hynitron_cst816d_update.py index e6c3bb5d..b28f8292 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/capacitive_hynitron_cst816d_update.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/capacitive_hynitron_cst816d_update.py @@ -1,12 +1,12 @@ """ // ic type: cst8xx -// proj name: CSW_2309233_CST816D_COB_DWS_HY_LFY203G_C06_AKL_G3.hex -// check sum: 0xcd16 -// create time: 2023/9/15 11:47:32 +// proj name: CSW_2311097_CST816D_COB_DWS_HY_HTY1384183CG_C06_AKL_G3.hex +// check sum: 0xa796 +// create time: 2023/11/8 10:14:38 """ app_bin_816d = [ -0x00, 0x00, 0x00, 0x3c, 0x16, 0xcd, +0x00, 0x00, 0x00, 0x3c, 0x96, 0xa7, 0x02, 0x2b, 0x9a, 0x75, 0x91, 0xcc, 0x75, 0x91, 0x00, 0x32, 0x32, 0x22, 0x02, 0x00, 0x03, 0x02, 0x2e, 0xea, 0x74, 0xb7, 0x2f, 0xf5, 0x82, 0xe4, 0x34, 0x02, 0xf5, 0x83, 0xe0, 0xff, 0x22, 0x22, 0x00, 0x02, 0x32, 0x2b, 0xe4, 0x7b, 0x02, 0xfa, 0xf9, 0xf8, 0xaf, 0x00, 0xae, 0x00, 0xad, 0x00, @@ -879,7 +879,7 @@ app_bin_816d = [ 0x05, 0x0b, 0x28, 0xff, 0xff, 0xff, 0x78, 0x2e, 0x90, 0x01, 0x00, 0x08, 0x08, 0x85, 0x00, 0xc8, 0x00, 0x14, 0x02, 0x58, 0x09, 0x09, 0x85, 0x00, 0xc8, 0x00, 0x28, 0x02, 0x58, 0x0a, 0x02, 0x85, 0x00, 0xc8, 0x00, 0x3c, 0x02, 0x58, 0x0a, 0x02, 0x85, 0x00, 0xc8, 0x00, 0x3c, 0x02, 0x58, 0x05, -0x00, 0xf0, 0x01, 0x1c, 0x00, 0x2d, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, +0x00, 0xf0, 0x01, 0x1c, 0x00, 0x1e, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x00, 0xfa, 0x00, 0xfa, 0x05, 0x01, 0x0a, 0x01, 0x04, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x9c, 0x00, 0x0a, 0x14, 0x02, 0x03, 0x07, 0x06, 0x00, 0xc8, 0x04, 0x00, 0x01, 0x08, 0x09, 0x00, 0xc8, 0x04, 0x02, 0x03, 0x07, 0x06, 0x00, 0xc8, 0x04, 0x02, 0x03, 0x07, 0x06, 0x00, 0xc8, 0x04, 0x00, @@ -966,8 +966,7 @@ app_bin_816d = [ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, -0xb6, 0x02, 0x30, 0x92, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x16, 0xcd, - +0xb6, 0x02, 0x30, 0x92, 0x33, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0xa7, ] diff --git a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py index b9b089e2..351e6dc4 100644 --- a/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/C06S/sdk/services/microPython/ports/quectel/core/mgr.py @@ -726,7 +726,7 @@ class DeviceInfoManager(Abstract): self.hsensor.init() self.hsensor.close() try : - self.hsensor.set_sar(1) + self.hsensor.set_sar(0) except Exception as e: print("Hsensor none set_sar:{}".format(e)) self.old_temp_time = 0 @@ -2128,7 +2128,7 @@ class LocationManager(Abstract): self.lpm_fd = pm.create_wakelock("test_lock", len("test_lock")) pm.wakelock_lock(self.lpm_fd) print("location_thread:1") - EventMesh.publish(constants.EVENT.GPSOPEN) + # EventMesh.publish(constants.EVENT.GPSOPEN) print("location_thread:2") #self.timer_read_GPS_info.start(1000, 1, self.location_timer) print("location_thread:3") @@ -2153,89 +2153,89 @@ class LocationManager(Abstract): #print(self.location_timer_count) GSV_dict= {} - #检查GNSS数据 - if ( self.gps_data == {} or self.location_type == 1) and quecgnss.get_state() == 2: - - pass - tmp_ok_count = 0 - tmp_very_ok_count = 0 - gsv_data = quecgnss.get_gsv() - rmc_data = quecgnss.get_rmc() - gga_data = quecgnss.get_gga() - vtg_data = quecgnss.get_vtg() - # print("gsv:{}".format(quecgnss.get_gsv())) - # print("gga:{}".format(quecgnss.get_gga())) - # print("rmc:{}".format(quecgnss.get_rmc())) - # print("vtg:{}".format(quecgnss.get_vtg())) - for i in range(len(gsv_data)) : + # #检查GNSS数据 + # if ( self.gps_data == {} or self.location_type == 1) and quecgnss.get_state() == 2: + + # pass + # tmp_ok_count = 0 + # tmp_very_ok_count = 0 + # gsv_data = quecgnss.get_gsv() + # rmc_data = quecgnss.get_rmc() + # gga_data = quecgnss.get_gga() + # vtg_data = quecgnss.get_vtg() + # # print("gsv:{}".format(quecgnss.get_gsv())) + # # print("gga:{}".format(quecgnss.get_gga())) + # # print("rmc:{}".format(quecgnss.get_rmc())) + # # print("vtg:{}".format(quecgnss.get_vtg())) + # for i in range(len(gsv_data)) : - if i % 2 == 0: - if i+1 >= len(gsv_data) : - print("gsv_data num error!!") - break - GSV_dict[gsv_data[i]] = gsv_data[i+1] - #print("type:gsv_data{}".format(type(gsv_data[i+1]))) - try: - #print("gsv_tmp[i+3]:{}".format(gsv_tmp[i+3])) - if gsv_data[i+1] : - if (gsv_data[i+1])>=20: - tmp_ok_count +=1 - if (gsv_data[i+1])>=30: - tmp_very_ok_count +=1 + # if i % 2 == 0: + # if i+1 >= len(gsv_data) : + # print("gsv_data num error!!") + # break + # GSV_dict[gsv_data[i]] = gsv_data[i+1] + # #print("type:gsv_data{}".format(type(gsv_data[i+1]))) + # try: + # #print("gsv_tmp[i+3]:{}".format(gsv_tmp[i+3])) + # if gsv_data[i+1] : + # if (gsv_data[i+1])>=20: + # tmp_ok_count +=1 + # if (gsv_data[i+1])>=30: + # tmp_very_ok_count +=1 - except Exception as e: - usys.print_exception(e) + # except Exception as e: + # usys.print_exception(e) - if(tmp_ok_count > self.GSV_sig_ok_count ): - self.GSV_sig_ok_count = tmp_ok_count - if(tmp_very_ok_count > self.GSV_sig_very_ok_count ): - self.GSV_sig_very_ok_count = tmp_very_ok_count - match_rmc_data = rmc_data.split(",") - if len (match_rmc_data)>3: #有rmc数据 - if match_rmc_data[2] == 'A': - match_gga_data = gga_data.split(",") - if len(match_gga_data) >4: #数据全 - match_vtg_data = vtg_data.split(",") - gps_date = "%s,%s"%(match_rmc_data[9],match_rmc_data[1][:6])#日期 - #gps_data_tmp = self.gps.read_coordinates(gnss_r_data[1]) - latitude = "0,N" #纬度 - latitude_tmp = str(self.GxGGA_latitude(gga_data)).split(".") - if len(latitude_tmp) >= 2 and len(latitude_tmp[1])>=5: - latitude = "%s.%s"%(latitude_tmp[0],latitude_tmp[1][:6]) - latitude = "%s,%s"%(latitude,match_rmc_data[4] ) - - longitude = "0,E"#经度 - longitude_tmp = str(self.GxGGA_longitude(gga_data)).split(".") - if len(longitude_tmp) >= 2 and len(longitude_tmp[1])>=5: - longitude = "%s.%s"%(longitude_tmp[0],longitude_tmp[1][:6]) - longitude = "%s,%s"%(longitude,match_rmc_data[6] ) #match_rmc_data[6] + str(gnss_r_data[1]) + # if(tmp_ok_count > self.GSV_sig_ok_count ): + # self.GSV_sig_ok_count = tmp_ok_count + # if(tmp_very_ok_count > self.GSV_sig_very_ok_count ): + # self.GSV_sig_very_ok_count = tmp_very_ok_count + # match_rmc_data = rmc_data.split(",") + # if len (match_rmc_data)>3: #有rmc数据 + # if match_rmc_data[2] == 'A': + # match_gga_data = gga_data.split(",") + # if len(match_gga_data) >4: #数据全 + # match_vtg_data = vtg_data.split(",") + # gps_date = "%s,%s"%(match_rmc_data[9],match_rmc_data[1][:6])#日期 + # #gps_data_tmp = self.gps.read_coordinates(gnss_r_data[1]) + # latitude = "0,N" #纬度 + # latitude_tmp = str(self.GxGGA_latitude(gga_data)).split(".") + # if len(latitude_tmp) >= 2 and len(latitude_tmp[1])>=5: + # latitude = "%s.%s"%(latitude_tmp[0],latitude_tmp[1][:6]) + # latitude = "%s,%s"%(latitude,match_rmc_data[4] ) + + # longitude = "0,E"#经度 + # longitude_tmp = str(self.GxGGA_longitude(gga_data)).split(".") + # if len(longitude_tmp) >= 2 and len(longitude_tmp[1])>=5: + # longitude = "%s.%s"%(longitude_tmp[0],longitude_tmp[1][:6]) + # longitude = "%s,%s"%(longitude,match_rmc_data[6] ) #match_rmc_data[6] + str(gnss_r_data[1]) - high = "0"#高度 - high = str(self.GxGGA_altitude(gga_data)) - number = "0"#可用卫星 - precision = "5.8"#精度 - if len(match_gga_data)>5 : - if match_gga_data[7]: - number = match_gga_data[7] - if match_gga_data[8]: - precision = match_gga_data[8] - direction = "249.5" #方向 - speed = '0.00' #速度 - if(len(match_vtg_data)>5 ): - if match_vtg_data[1]: - direction = match_vtg_data[1] - if match_vtg_data[7]: - speed = match_vtg_data[7] - self.gps_data = { - "latitude": latitude, - "longitude": longitude, - "high": high, - "direction": direction, - "speed": speed, - "number": number, - "date": gps_date, - "precision": precision - } + # high = "0"#高度 + # high = str(self.GxGGA_altitude(gga_data)) + # number = "0"#可用卫星 + # precision = "5.8"#精度 + # if len(match_gga_data)>5 : + # if match_gga_data[7]: + # number = match_gga_data[7] + # if match_gga_data[8]: + # precision = match_gga_data[8] + # direction = "249.5" #方向 + # speed = '0.00' #速度 + # if(len(match_vtg_data)>5 ): + # if match_vtg_data[1]: + # direction = match_vtg_data[1] + # if match_vtg_data[7]: + # speed = match_vtg_data[7] + # self.gps_data = { + # "latitude": latitude, + # "longitude": longitude, + # "high": high, + # "direction": direction, + # "speed": speed, + # "number": number, + # "date": gps_date, + # "precision": precision + # } # *********************************************************************************** @@ -2279,16 +2279,15 @@ class LocationManager(Abstract): # self.location_timer_count = 0 # self.GSV_sig_ok_count = 0 - - # if (self.GGA_count < 3 and self.GSV_sig_ok_count < 2) and self.wifi_data and self.cell_data and self.location_timer_count > 30 and self.location_timer_count < 40: #超过20秒且有效卫星个数少于3 - # EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位 - # EventMesh.txt_log("GGA_count<3:timer:{} ok_count:{} count:{}".format(self.location_timer_count,self.GSV_sig_ok_count,self.GGA_count)) - # self.Location_send([self.gps_data,self.wifi_data,self.cell_data]) - - if self.GSV_sig_ok_count <= 1 and self.wifi_data != [] and self.cell_data != [] and self.location_timer_count > 20: #超过40秒且信号大于30的不足3个 + + if self.wifi_data != [] and self.cell_data != [] : # EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位 EventMesh.txt_log("GSV_sig_ok_count<3:timer:{} ok_count:{} ".format(self.location_timer_count,self.GSV_sig_ok_count)) - self.Location_send([self.gps_data,self.wifi_data,self.cell_data]) + self.Location_send([self.gps_data,self.wifi_data,self.cell_data]) + # if self.GSV_sig_ok_count <= 1 and self.wifi_data != [] and self.cell_data != [] and self.location_timer_count > 20: #超过40秒且信号大于30的不足3个 + # EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位 + # EventMesh.txt_log("GSV_sig_ok_count<3:timer:{} ok_count:{} ".format(self.location_timer_count,self.GSV_sig_ok_count)) + # self.Location_send([self.gps_data,self.wifi_data,self.cell_data]) #break # if self.location_type != 1 and self.location_timer_count >= 60*4 : #4分钟关闭 # EventMesh.publish(constants.EVENT.CLOSE_LOCATION)#关闭定位 diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/Makefile b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/Makefile index fcb2db74..0ea26a3a 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/Makefile +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/Makefile @@ -917,15 +917,12 @@ frozen_mpy_list = $(BUILD)/_boot.mpy \ $(BUILD)/ymodem.mpy else frozen_mpy_list = $(BUILD)/_boot.mpy \ - $(BUILD)/umqtt.mpy \ $(BUILD)/ntptime.mpy \ $(BUILD)/request.mpy \ $(BUILD)/log.mpy \ - $(BUILD)/aLiYun.mpy \ $(BUILD)/hmac.mpy \ $(BUILD)/hashlib.mpy \ $(BUILD)/base64.mpy \ - $(BUILD)/TenCentYun.mpy \ $(BUILD)/file_sha256.mpy \ $(BUILD)/checksum.mpy \ $(BUILD)/checkNet.mpy \ @@ -938,7 +935,6 @@ frozen_mpy_list = $(BUILD)/_boot.mpy \ $(BUILD)/backup_restore.mpy \ $(BUILD)/file_crc32.mpy \ $(BUILD)/system.mpy \ - $(BUILD)/gnss.mpy \ $(BUILD)/unzip.mpy \ $(BUILD)/queue.mpy \ $(BUILD)/sys_bus.mpy \ diff --git a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py index 1be60a79..9240dcad 100644 --- a/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py +++ b/2.sdk/project/K01/sdk/services/microPython/ports/quectel/core/mgr.py @@ -34,7 +34,7 @@ try : except Exception as e: print("Hsensor none HX3918:{}".format(e)) from machine import RTC -import quecgnss + import wifiScan import math import voiceCall @@ -750,13 +750,6 @@ class DeviceInfoManager(Abstract): EventMesh.publish("countdown_end_cb") """定时检查是否关闭gps失败""" - # gnss_state = quecgnss.get_state() - # get_location_flag = EventMesh.publish("get_location_flag") - # if get_location_flag != None: - # # if gnss_state == 2 and get_location_flag == 0: - # # EventMesh.publish(constants.EVENT.GPSCLOSE) - # if(get_location_flag == 0): - # EventMesh.publish(constants.EVENT.START_LOCATION,constants.PROTOCOL.UD_SEND) #开始UD定位 """7分钟一次心跳""" if math.fabs(time_tmp - self.KA_time) > 7*60: #7分钟一次心跳 @@ -1395,7 +1388,7 @@ class DeviceInfoManager(Abstract): else: # print("self.class_count",self.class_count) EventMesh.publish("get_class_in_time_page") - #quecgnss.gnssEnable(0) + def get_sim_Status(self, event, msg): @@ -1731,8 +1724,7 @@ class LocationManager(Abstract): self.location_queue = Queue(100) self.lpm_fd = None self.start_agps = 0 - quecgnss.init() - quecgnss.gnssEnable(0) + @staticmethod def get_date(): return "{:04d}-{:02d}-{:02d}".format(*utime.localtime()[0:3]) @@ -1824,12 +1816,10 @@ class LocationManager(Abstract): else : print("WIFI_scan_open:error1") def gps_open(self, event, msg): - #print("publish:gps_open") - #quecgnss.init() - quecgnss.gnssEnable(2) - #self.gps.__gps_nmea_data_clean() + pass + def gps_close(self, event, msg): - quecgnss.gnssEnable(0) + pass def location_timer(self, *args, **kwargs): self.location_timer_count = self.location_timer_count +1 diff --git a/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/mpconfigboard.h b/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/mpconfigboard.h index d8f4b3ef..6990da30 100644 --- a/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/mpconfigboard.h +++ b/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/config/mpconfigboard.h @@ -39,7 +39,7 @@ #define MICROPY_QPY_MODULE_AUDIO (1) #define MICROPY_QPY_MODULE_FOTA (1) #define MICROPY_QPY_MODULE_WIFISCAN (1) -#define MICROPY_QPY_MODULE_QUECGNSS (1) +#define MICROPY_QPY_MODULE_QUECGNSS (0) #define MICROPY_QPY_MODULE_WIFILOCATOR (1) #define MICROPY_QPY_MODULE_ETHERNET (0) #define MICROPY_QPY_MODULE_SENSOR (1) @@ -180,7 +180,7 @@ #if MICROPY_QPY_MODULE_SENSOR #define MICROPY_QPY_SENSOR_SN95500 (0) #define MICROPY_QPY_SENSOR_ICC_KEY (0) - #define MICROPY_QPY_SENSOR_GNSS (1) + #define MICROPY_QPY_SENSOR_GNSS (0) #endif #if MICROPY_QPY_MODULE_CAMERA diff --git a/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/images/firmware_base_release_pack.zip b/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/images/firmware_base_release_pack.zip index f6c79ab0..db3a74ef 100644 Binary files a/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/images/firmware_base_release_pack.zip and b/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/images/firmware_base_release_pack.zip differ diff --git a/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/include/app_link_start_addr.h b/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/include/app_link_start_addr.h index bfd51397..00a6fa7d 100644 --- a/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/include/app_link_start_addr.h +++ b/2.sdk/project/K01/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_VOLTE/include/app_link_start_addr.h @@ -2,8 +2,8 @@ #ifndef __APP_LINK_START_ADDR_H__ #define __APP_LINK_START_ADDR_H__ -#define APP_LINK_START_ADDR 0x80521000 -#define APP_FLASH_MAX_SIZE 0x1A8000 +#define APP_LINK_START_ADDR 0x804D5000 +#define APP_FLASH_MAX_SIZE 0x1DB000 #define APP_RAM_START 0x7E3E0000 #define APP_RAM_MAX_SIZE 0x180000 diff --git a/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/mpconfigboard.h b/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/mpconfigboard.h index 6d26c8ef..354f3196 100644 --- a/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/mpconfigboard.h +++ b/2.sdk/project/K5/sdk/system/platform/ASR_1606/boards/EG810MCN_GA_ALIPAY/config/mpconfigboard.h @@ -57,7 +57,7 @@ #if CONFIG_MBEDTLS #define MICROPY_QPY_MODULE_USSL (0) - #define MICROPY_QPY_SSL_MBEDTLS (1) + #define MICROPY_QPY_SSL_MBEDTLS (0) #endif #if CONFIG_QUECTHING