wxThread::ExitCode turbotrace::Entry() { tlog(_("Thread starting\n")); //Resolve the hostname , get the ip address if(!resolve_host(host)) { return false; } wxMutexGuiEnter(); parent_frame->set_ip( wxString( inet_ntoa(dest_ip) , wxConvUTF8) ); wxMutexGuiLeave(); //Call the outer class function start_sniffer start_sniffer(); return (wxThread::ExitCode)0; }
void AppColdStart(void) { /* initialize unaligned access handler */ UNALIGNED_ACCESS = UNALIGNED_ACCESS_HANDLER; /* initialize uart to 8N1 at 115200 baud, that gives a throughput og * ~14.4 kb/s, maxmimum packet rate on Ieee802.15.4 is 248 packets/sec at * 127 bytes payload + header, which allows to return about 50bytes on the * uart per packet. */ vAHI_UartEnable(UART); vAHI_UartReset(UART, true, true); vAHI_UartReset(UART, false, false); vAHI_UartSetControl(UART, E_AHI_UART_EVEN_PARITY, E_AHI_UART_PARITY_DISABLE, E_AHI_UART_WORD_LEN_8, E_AHI_UART_1_STOP_BIT, E_AHI_UART_RTS_HIGH); vAHI_UartSetBaudrate(UART, BAUD); vAHI_UartSetRTSCTS(UART, false); vAHI_DioSetDirection(CTS, RTS); vAHI_DioSetOutput(0x00, RTS); /* run the main loop, wait for channel number, then start reception * and packet delivery. Ack by sending "okay\n". */ while (1) { static int started = MAC_ENUM_NO_DATA; static char input[10]; static uint8_t i=0; /* write one rxd packet to uart */ if (started==MAC_ENUM_SUCCESS) { MAC_DcfmIndHdr_s *ind; if (rxq_peektype() == MCPS) { ind = rxq_peek(); if (ind->u8Type == MAC_MCPS_IND_DATA) { MAC_McpsDcfmInd_s *s = ind; uart_write(UART, (char*) &s->uParam.sIndData, sizeof(s->uParam.sIndData)); } } rxq_dequeue(); } /* read from uart into buf */ while (i<sizeof(input) && DATAREADY(UART)) { input[i] = u8AHI_UartReadData(UART); if ((i+1)==sizeof(input)) { /* buffer overrun, discard input */ memset(input, '\0', i); i = 0; } else if (input[i]=='\n' || input[i]=='\r') { /* read as channel number */ int channel; input[9] = '\0'; /* terminate string */ channel = atoi(input); /* convert string to num */ started = start_sniffer(channel); if (started != MAC_ENUM_SUCCESS) printf("not started, error code: 0x%x, see MAC_Enum_e\r\n", started); else printf("started on channel %d\r\n", channel); memset(input, '\0', i); i = 0; } else i++; } } }