|
@@ -201,7 +201,10 @@ DWORD WINAPI _exec_sql(LPVOID lparam)
|
|
|
}
|
|
|
MYSQL_RES* pRes;
|
|
|
int err = 0;
|
|
|
- pRes = pConn->Execute(sql, err);
|
|
|
+ //pRes = pConn->Execute(sql, err);
|
|
|
+
|
|
|
+ pRes = pConn->MultiExecute(sql,err);
|
|
|
+
|
|
|
if(err > 0){
|
|
|
TRACE(_T("sql error \n"));
|
|
|
}
|
|
@@ -268,8 +271,8 @@ UINT _thread_timer(LPVOID lparam)
|
|
|
ULONGLONG cur_time =::GetTickCount();
|
|
|
// send_json_counting
|
|
|
if(cur_time - time_send_json_counting > theApp.send_json_counting ){
|
|
|
- time_send_json_counting = cur_time;
|
|
|
- dlg->send_json_data(JSON_CMD_VALUE_PUSH, dlg->get_json_counting());
|
|
|
+ //time_send_json_counting = cur_time;
|
|
|
+ //dlg->send_json_data(JSON_CMD_VALUE_PUSH, dlg->get_json_counting());
|
|
|
}
|
|
|
// send_json_alarm
|
|
|
if(cur_time - time_send_json_alarm > theApp.send_json_alarm){
|
|
@@ -487,6 +490,7 @@ HCURSOR CYAServerDlg::OnQueryDragIcon()
|
|
|
*/
|
|
|
void CYAServerDlg::OnBnStart()
|
|
|
{
|
|
|
+ Test();
|
|
|
if(!is_websocket_login){
|
|
|
ws_login();
|
|
|
}
|
|
@@ -1229,34 +1233,6 @@ int CYAServerDlg::init_all_readers_coverage(int reader_id)
|
|
|
pReaderPath->py[j - 1] = it->second->readerCoveragePath.find(j)->second.y*dMapScale;
|
|
|
pReaderPath->pz[j - 1] = it->second->readerCoveragePath.find(j)->second.z*dMapScale;
|
|
|
}
|
|
|
-
|
|
|
- //以下对应与全局变量的数组形式的另一种实现
|
|
|
- //初始化
|
|
|
- /*station[nReaderId].nRealCalcPoints = 0;
|
|
|
- for(int i=0;i<2;i++){
|
|
|
- station[nReaderId].x[i] = 0;
|
|
|
- station[nReaderId].y[i] = 0;
|
|
|
- station[nReaderId].z[i] = 0;
|
|
|
- }
|
|
|
- for(int i=0;i<MAX_CALC_POINTS;i++){
|
|
|
- station[nReaderId].px[i] = 0;
|
|
|
- station[nReaderId].py[i] = 0;
|
|
|
- station[nReaderId].pz[i] = 0;
|
|
|
- }
|
|
|
-
|
|
|
- //double dMapScale = mp_map_list.find(it->second->map_id)->second->map_scale;
|
|
|
- station[nReaderId].nRealCalcPoints = it->second->readerCoveragePath.size();
|
|
|
- for(int i=0;i<2;i++){
|
|
|
- station[nReaderId].x[i] = it->second->ant[i]->antenna_x*dMapScale;
|
|
|
- station[nReaderId].y[i] = it->second->ant[i]->antenna_y*dMapScale;
|
|
|
- station[nReaderId].z[i] = it->second->ant[i]->antenna_z*dMapScale;
|
|
|
- }
|
|
|
-
|
|
|
- for(size_t j = 1;j <= it->second->readerCoveragePath.size(); j++){
|
|
|
- station[nReaderId].px[j - 1] = it->second->readerCoveragePath.find(j)->second.x*dMapScale;
|
|
|
- station[nReaderId].py[j - 1] = it->second->readerCoveragePath.find(j)->second.y*dMapScale;
|
|
|
- station[nReaderId].pz[j - 1] = it->second->readerCoveragePath.find(j)->second.z*dMapScale;
|
|
|
- }*/
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1730,7 +1706,7 @@ void CYAServerDlg::parse_package_data(BYTE* DataBuffer, int nLen, DWORD dwConnID
|
|
|
g_is_rec_hist = false;
|
|
|
// 完成历史数据上传,可点名下一分站
|
|
|
}
|
|
|
- case CHAR_TIMESYNC:
|
|
|
+ case CHAR_READER_SYNC_TIME:
|
|
|
{
|
|
|
parse_data_reader_synctime(DataBuffer ,nLen ,nCurPos);
|
|
|
break;
|
|
@@ -3714,7 +3690,7 @@ void CYAServerDlg::store_data_card( Card* card, int tag )
|
|
|
if(card->map_id != 0 && card->area_id != 0){
|
|
|
b_exec = true;
|
|
|
sprintf_s(sql, LENGTH_SQL,
|
|
|
- "INSERT INTO his_location(card_id, cur_time, x, y, z, map_id, area_id, state) VALUES(%s, '%s', %4.f, %4.f, %4.f, %d, %d, %d);",
|
|
|
+ "INSERT INTO his_location(card_id, cur_time, x, y, z, map_id, area_id, state) VALUES(%s, '%s', %.3f, %.3f, %.3f, %d, %d, %d);",
|
|
|
card->card_id.c_str(), _time, card->x, card->y, card->z, card->map_id, card->area_id, card->state);
|
|
|
}
|
|
|
break;
|
|
@@ -4734,14 +4710,26 @@ void CYAServerDlg::deal_call_edit_reader(int id, EDIT_TYPE_ID edit_type_id)
|
|
|
{
|
|
|
init_reader(id);
|
|
|
init_antenna(id);
|
|
|
- init_all_readers_coverage(id);
|
|
|
+ //init_all_readers_coverage(id);
|
|
|
+ //init_tdoa_all_readers_coverage(id);
|
|
|
+#ifdef ALGORITHM_TYPE_TOF
|
|
|
+ init_all_readers_coverage();
|
|
|
+#elif defined ALGORITHM_TYPE_TDOA
|
|
|
+ init_tdoa_all_readers_coverage(id);
|
|
|
+#endif
|
|
|
break;
|
|
|
}
|
|
|
case ET_UPDATE:
|
|
|
{
|
|
|
init_reader(id);
|
|
|
init_reader(id);
|
|
|
- init_all_readers_coverage(id);
|
|
|
+ //init_all_readers_coverage(id);
|
|
|
+ //init_tdoa_all_readers_coverage(id);
|
|
|
+#ifdef ALGORITHM_TYPE_TOF
|
|
|
+ init_all_readers_coverage();
|
|
|
+#elif defined ALGORITHM_TYPE_TDOA
|
|
|
+ init_tdoa_all_readers_coverage(id);
|
|
|
+#endif
|
|
|
break;
|
|
|
}
|
|
|
case ET_DELETE:
|
|
@@ -4987,6 +4975,7 @@ void CYAServerDlg::save_card_postion( Card* card )
|
|
|
//}
|
|
|
// 位置变化幅度大于1m
|
|
|
|
|
|
+
|
|
|
if( moved_dist < card->map_scale / 2.0){ // 移动位置小于半米,不记录数据
|
|
|
return ;
|
|
|
}
|
|
@@ -5269,15 +5258,27 @@ std::string CYAServerDlg::get_json_call_test()
|
|
|
|
|
|
void CYAServerDlg::init_base_data()
|
|
|
{
|
|
|
+ DWORD dwStart = 0;
|
|
|
+ DWORD dwEnd = 0;
|
|
|
+ DWORD dw = 0;
|
|
|
+dwStart = GetTickCount();
|
|
|
init_setting();
|
|
|
init_alarm_type();
|
|
|
init_dept();
|
|
|
init_map();
|
|
|
- init_area();
|
|
|
+ init_area();
|
|
|
init_reader();
|
|
|
+ dwEnd = GetTickCount();
|
|
|
+ dw = dwEnd - dwStart;
|
|
|
init_antenna();
|
|
|
+#ifdef ALGORITHM_TYPE_TOF
|
|
|
init_all_readers_coverage();
|
|
|
+#elif defined ALGORITHM_TYPE_TDOA
|
|
|
+ //dwStart = GetTickCount();
|
|
|
init_tdoa_all_readers_coverage();
|
|
|
+ //dwEnd = GetTickCount();
|
|
|
+ //dw = dwEnd - dwStart;
|
|
|
+#endif
|
|
|
init_dev_adhoc();
|
|
|
init_antenna_sync();
|
|
|
|
|
@@ -6273,41 +6274,43 @@ void CYAServerDlg::Test()
|
|
|
//36-35-34 ok
|
|
|
//36-34-35 ok
|
|
|
|
|
|
- //36
|
|
|
- ReceiveData* prd3 = new ReceiveData();
|
|
|
- prd3->reader_id = 36;
|
|
|
- prd3->antenna_id = 1;
|
|
|
- prd3->rec_time_stamp = 697735698336;//283613846791;
|
|
|
- prd3->x = 622.5*0.06;
|
|
|
- prd3->y = 660*0.06;
|
|
|
- prd3->z = 0;
|
|
|
- pRdm.insert(ReceiveDataMap::value_type(prd3->reader_id,*prd3));
|
|
|
+ double dMapScale = 3.46;
|
|
|
|
|
|
- //34
|
|
|
+ //36
|
|
|
ReceiveData* prd1 = new ReceiveData();
|
|
|
- prd1->reader_id = 34;
|
|
|
+ prd1->reader_id = 103;
|
|
|
prd1->antenna_id = 1;
|
|
|
- prd1->rec_time_stamp = 697735702711;//283613853712;//
|
|
|
- prd1->x = 500*0.06;
|
|
|
- prd1->y = 100*0.06;
|
|
|
+ prd1->rec_time_stamp = 883149357669;//283613846791;
|
|
|
+ prd1->x = 1106.34*dMapScale;
|
|
|
+ prd1->y = 320.4*dMapScale;
|
|
|
prd1->z = 0;
|
|
|
- pRdm.insert(ReceiveDataMap::value_type(prd1->reader_id,*prd1));
|
|
|
+ pRdm.insert(ReceiveDataMap::value_type(prd1->reader_id,*prd1));
|
|
|
|
|
|
- //35
|
|
|
+ //34
|
|
|
ReceiveData* prd2 = new ReceiveData();
|
|
|
- prd2->reader_id = 35;
|
|
|
+ prd2->reader_id = 101;
|
|
|
prd2->antenna_id = 1;
|
|
|
- prd2->rec_time_stamp = 697735696877;//283613846609;
|
|
|
- prd2->x = 500*0.06;
|
|
|
- prd2->y = 660*0.06;
|
|
|
+ prd2->rec_time_stamp = 883149383653;//283613853712;//
|
|
|
+ prd2->x = 1106.34*dMapScale;
|
|
|
+ prd2->y = 285.2*dMapScale;
|
|
|
prd2->z = 0;
|
|
|
- pRdm.insert(ReceiveDataMap::value_type(prd2->reader_id,*prd2));
|
|
|
+ pRdm.insert(ReceiveDataMap::value_type(prd2->reader_id,*prd2));
|
|
|
+
|
|
|
+ //35
|
|
|
+ ReceiveData* prd3 = new ReceiveData();
|
|
|
+ prd3->reader_id = 103;
|
|
|
+ prd3->antenna_id = 1;
|
|
|
+ prd3->rec_time_stamp = 883149393017;//283613846609;
|
|
|
+ prd3->x = 1106.34*dMapScale;
|
|
|
+ prd3->y = 386.5*dMapScale;
|
|
|
+ prd3->z = 0;
|
|
|
+ pRdm.insert(ReceiveDataMap::value_type(prd3->reader_id,*prd3));
|
|
|
|
|
|
POS* p = NULL;
|
|
|
p = LocateAlgorithm::Pos(&pRdm,mp_reader_path_list_tdoa);
|
|
|
|
|
|
- double x = p->posx / 0.06;
|
|
|
- double y = p->posy / 0.06;
|
|
|
+ double x = p->posx / dMapScale;
|
|
|
+ double y = p->posy / dMapScale;
|
|
|
}
|
|
|
|
|
|
void CYAServerDlg::release_memory()
|
|
@@ -6568,13 +6571,15 @@ void CYAServerDlg::deal_card_msg( Card* card, bool is_hist /*= false*/ )
|
|
|
strLog.Format(_T("cardid:%s, cx: %f, cy: %f, cz: %f, clx: %f, cly: %f, ct: %d"), p_card_id /*CFunctions::c2wc(card->card_id.c_str())*/, card->x, card->y, card->z, card->last_locate.x, card->last_locate.y, card->time_stamp_cal);
|
|
|
writeErrorLog(_T("DIST_S"), strLog, false);
|
|
|
strLog.Empty();
|
|
|
+
|
|
|
+ strLog = _T("");
|
|
|
+ strLog.Format(_T("%d,%f,%f,%f,%f"),card->sync_num,card->origin_locate.x,card->origin_locate.y,card->x, card->y);
|
|
|
+ writeErrorLog(_T("KALMAN_S"),strLog,false);
|
|
|
}
|
|
|
if(p_card_id){
|
|
|
free(p_card_id);
|
|
|
p_card_id = NULL;
|
|
|
- }
|
|
|
- strLog.Format(_T("%d,%f,%f,%f,%f"),card->sync_num,card->origin_locate.x,card->origin_locate.y,card->x, card->y);
|
|
|
- writeErrorLog(_T("KALMAN_S"),strLog,false);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -6730,7 +6735,7 @@ void CYAServerDlg::writeErrorLogEx( const char* strFile, const char* strErr ,boo
|
|
|
|
|
|
void CYAServerDlg::init_queuestring()
|
|
|
{
|
|
|
- m_qsmSQL = new QueueStrManager(10, 7000, _exec_sql);
|
|
|
+ m_qsmSQL = new QueueStrManager(50, 7500, _exec_sql);
|
|
|
}
|
|
|
|
|
|
void CYAServerDlg::SendData( DWORD dwConnID, WORD wCharacterWord, int wLength, BYTE* DataBuffer )
|
|
@@ -6831,7 +6836,8 @@ void CYAServerDlg::parse_data_locate_card_his_tdoa_package( BYTE* DataBuffer, in
|
|
|
nCurPos += LENGTH_TDOA_VEHICLE;
|
|
|
break;
|
|
|
}
|
|
|
- case CHAR_TIMESYNC:
|
|
|
+ //case CHAR_TIMESYNC:
|
|
|
+ case CHAR_READER_SYNC_TIME:
|
|
|
{
|
|
|
memset(bt, 0, LENGTH_RECORD_MAX);
|
|
|
memcpy(bt, &DataBuffer[nCurPos], LENGTH_SYNC_TIME);
|