diff options
author | kaner <kaner@8d8ab74c-27aa-4a3d-9bde-523a2bc1f624> | 2009-01-29 20:13:46 +0000 |
---|---|---|
committer | kaner <kaner@8d8ab74c-27aa-4a3d-9bde-523a2bc1f624> | 2009-01-29 20:13:46 +0000 |
commit | b5931f062d339da1319194e4614ebc329d52831f (patch) | |
tree | a938349262a4655ec72bf0d1b17ff8317444ac0e | |
parent | 3d05fde08085fb1b9775e7f86448246247eca19e (diff) |
Cleanups; Added sync info to server plugin;
git-svn-id: https://dedected.org/svn/trunk@55 8d8ab74c-27aa-4a3d-9bde-523a2bc1f624
-rw-r--r-- | kismet-dect/client_module/dect_cliplugin.cc | 10 | ||||
-rw-r--r-- | kismet-dect/server_module/dect_srvplugin.cc | 38 |
2 files changed, 28 insertions, 20 deletions
diff --git a/kismet-dect/client_module/dect_cliplugin.cc b/kismet-dect/client_module/dect_cliplugin.cc index 6da896a..b74fea9 100644 --- a/kismet-dect/client_module/dect_cliplugin.cc +++ b/kismet-dect/client_module/dect_cliplugin.cc @@ -149,7 +149,7 @@ public: "<enter> - In FP mode: Show details of currently selected station\n" " In PP mode: Sync with selected station and record call\n"; Kis_ModalAlert_Panel *ma = new Kis_ModalAlert_Panel(globalreg, globalreg->panel_interface); - ma->Position(2, 2, 19, 55); + ma->Position(2, 2, 21, 70); ma->ConfigureAlert(help_title, help_text); globalreg->panel_interface->AddPanel(ma); return 0; @@ -263,7 +263,7 @@ private: bool less_by_RSSI(const vector<string> &v1, const vector<string> &v2) { - if(sort_by==SORT_BY_RFPI) { + if (sort_by == SORT_BY_RFPI) { if (v1[sort_by].compare(v2[sort_by]) < 0) { return true; } @@ -355,12 +355,6 @@ void DectDetailsProtoDECT(CLIPROTO_CB_PARMS) } else { ddata->dtable->Hide(); ddata->ctable->Clear(); - /* - i = ddata->info_vec.begin(); - for (int j = 0; i < ddata->info_vec.end(); ++i, ++j) { - ddata->ctable->AddRow(j, (*i)); - } - */ ddata->ctable->Show(); ddata->ctable->DrawComponent(); } diff --git a/kismet-dect/server_module/dect_srvplugin.cc b/kismet-dect/server_module/dect_srvplugin.cc index dad7b28..53924e6 100644 --- a/kismet-dect/server_module/dect_srvplugin.cc +++ b/kismet-dect/server_module/dect_srvplugin.cc @@ -123,8 +123,8 @@ class dect_datachunk : public packet_component { public: dect_data_scan_t sdata; pp_packet_t pdata; - uint8_t pp_RFPI[5]; int kind; + bool sync; }; class Dumpfile_Dectpcap : public Dumpfile { @@ -248,11 +248,8 @@ int Dumpfile_Dectpcap::chain_handler(kis_packet *in_pack) { if (!dc || dc->kind != 2) { return 0; } -#if 0 - fwrite(dc->pdata.data, 53, 1, dectpcapfile); -#endif - // XXX Dump .wav soon + // XXX Dump .wav? struct pcap_pkthdr pcap_hdr; pcap_hdr.caplen = 73; pcap_hdr.len = 73; @@ -290,13 +287,13 @@ public: PacketSource_Dect(GlobalRegistry *in_globalreg) : KisPacketSource(in_globalreg), - locked(false) { + locked(false), sync(false), globalreg(in_globalreg) { } PacketSource_Dect(GlobalRegistry *in_globalreg, string in_interface, vector<opt_pair> *in_opts) : KisPacketSource(in_globalreg, in_interface, in_opts), - locked(false) { + locked(false), sync(false), globalreg(in_globalreg) { serial_fd = -1; @@ -389,6 +386,10 @@ public: } mode = COA_SUBMODE_SNIFF_SCANFP; switched = 1; + if (sync) { + printf("Sync off.\n"); + sync = false; + } // Remove lock, if there is any, and start scanning at channel 0 setLock(false, 0); } @@ -405,6 +406,10 @@ public: } mode = COA_SUBMODE_SNIFF_SCANFP; switched = 1; + if (sync) { + printf("Sync off.\n"); + sync = false; + } // Remove lock, if there is any, and start scanning at channel 0 setLock(false, 0); } @@ -426,7 +431,9 @@ public: return; } mode = 2; - memcpy(pp_RFPI, RFPI, 5); + if (sync) { + sync = false; + } // Don't hop channels while synced setLock(true, channel); } @@ -470,6 +477,7 @@ public: if (mode == 0 || mode == 1) { if ((rbytes = read(serial_fd, &(dc->sdata), 7)) != 7) { // Fail + fprintf(stderr, "Bad read. Expected: 7 Got: %d\n", rbytes); return 0; } else { printf("RFPI: "); @@ -483,10 +491,15 @@ public: } } else if (mode == 2) { if ((rbytes = read(serial_fd, &(dc->pdata), sizeof(dc->pdata))) != sizeof(dc->pdata)) { - return 0; + fprintf(stderr, "Bad read. Expected: %d Got: %d\n", sizeof(dc->pdata), rbytes); + return 0; } else { - dc->kind = 2; - memcpy(&(dc->pp_RFPI), pp_RFPI, 5); + if (!sync) { + printf("Got sync.\n"); + sync = true; + } + dc->sync = sync; + //dc->kind = 2; newpack->insert(dect_comp_datachunk, dc); globalreg->packetchain->ProcessPacket(newpack); } @@ -510,8 +523,9 @@ protected: string serialdevice; int serial_fd; bool locked; - uint8_t pp_RFPI[5]; + bool sync; PacketSource_Dect *external; + GlobalRegistry *globalreg; }; class DectTracker { |