| | |
| | | |
| | | uint8_t mUsartReceivePack[100] = {0}; |
| | | uint8_t mUsart2ReceivePack[150] = {0}; |
| | | uint8_t mUsart0ReceivePack[150] = {0}; |
| | | double jd,wd; |
| | | int analysis_num,pos_state; |
| | | uint8_t state5V_prase_flag=1,gps_prase_flag=1; |
| | |
| | | //BLE_RECV_STATE_LF, |
| | | } E_BLERecvState; |
| | | static char gps_header[20]; |
| | | static char ble_header[20]; |
| | | typedef struct |
| | | { |
| | | char m_pData[100]; |
| | |
| | | |
| | | |
| | | uint8_t mUsart2ReceivePack_before , mUsart2ReceivePack_now; |
| | | uint8_t mUsart0ReceivePack_before , mUsart0ReceivePack_now; |
| | | uint8_t j_ct=0,CT_satrt_temp=0,CT_satrt=0,numb_base=0 ; |
| | | |
| | | uint8_t id_cmpare[12]= {0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38, 0x30, 0x30, 0x30, 0x31}; //123456780001//测试//RC2202A: |
| | |
| | | } |
| | | } |
| | | |
| | | void Usart0ParseDataHandler(uint8_t data) |
| | | { |
| | | |
| | | static uint16_t warning_distance,temp_id,temp_bind_id; |
| | | static uint8_t index = 0; |
| | | |
| | | //接收数据开始分析 |
| | | mUsart0ReceivePack[index] = data; //char数组传进来参数data |
| | | mUsart0ReceivePack_before = mUsart0ReceivePack_now; |
| | | mUsart0ReceivePack_now=data; |
| | | index++; |
| | | if( mUsart0ReceivePack_before == 0x0D && mUsart0ReceivePack_now==0x0A )//接收数据到“0x0D 0x0A”结束 |
| | | { |
| | | LOG_INFO(TRACE_MODULE_APP,"收的到蓝牙报文%s\r\n",mUsart0ReceivePack); |
| | | //解析该条GPS报文 |
| | | analysis_num=sscanf((char*)mUsart0ReceivePack,"$%[^,],%[^,],%[^,],%[^,]\r\n",ble_header,temp_id,temp_bind_id,warning_distance); |
| | | |
| | | if(!memcmp(ble_header,"BLE",3)&&temp_id==g_com_map[DEV_ID]) |
| | | { |
| | | LOG_INFO(TRACE_MODULE_APP,"成功解析,数据为%x,%x,%d,%d\r\n",temp_id,temp_bind_id,warning_distance,analysis_num); |
| | | g_com_map[BIND_DEV_ID]=temp_bind_id; |
| | | g_com_map[ALARM_DISTANCE1]=warning_distance; |
| | | //save_com_map_to_flash(); |
| | | } |
| | | |
| | | memset(mUsart0ReceivePack,0,sizeof(mUsart0ReceivePack)); |
| | | // memset(wdrecv.m_pData,0,sizeof(wdrecv.m_pData)); |
| | | // memset(jdrecv.m_pData,0,sizeof(jdrecv.m_pData)); |
| | | // memset(Posstate.m_pData,0,sizeof(Posstate.m_pData)); |
| | | index=0; |
| | | mUsart0ReceivePack_before=0; |
| | | mUsart0ReceivePack_now=0; |
| | | } |
| | | } |
| | | |