Exemple #1
0
int ptt_serial_unix::init(const char* fname) {
	fd_ = open(fname, O_RDWR, 0);
	if (fd_ < 0) {
		unix_print_error(errno);
		return 0;
	}
	set_tx(0);
	return 1;
}
Exemple #2
0
/**
 * @param none
 */
void nRF905_txData(void)
{
	/* Set nRF905 in Tx mode */
	set_tx();
	nrf_delay_ms(10);
	
	TxPacket();
	nrf_delay_ms(10);
}
void NRF905::TX(char *TxRxBuf)
{

    set_tx();
    delay(1);
    // Send data by nRF905
    TxPacket(config_info_buf+5, TxRxBuf);
	set_rx(); //switch back to receiving mode to set DR low

}
void NRF905::TX(char *TxRxBuf, char *TxAddress)
{

    set_tx();
    delay(1);
    // Send data by nRF905
    TxPacket(TxAddress, TxRxBuf);
	set_rx();

}
Exemple #5
0
/*---------------------------------------------------------------------------*/
PROCESS_THREAD(udp_client_process, ev, data)
{
  static struct etimer periodic, set_tx_timer;
  static struct ctimer backoff_timer;
#if WITH_COMPOWER
  static int print = 0;
#endif

  PROCESS_BEGIN();
  PROCESS_PAUSE();

  set_global_address();
  
  PRINTF("UDP client process started\n");

  print_local_addresses();

  /* new connection with remote host */
  client_conn = udp_new(NULL, UIP_HTONS(UDP_SERVER_PORT), NULL); 
  if(client_conn == NULL) {
    PRINTF("No UDP connection available, exiting the process!\n");
    PROCESS_EXIT();
  }
  udp_bind(client_conn, UIP_HTONS(UDP_CLIENT_PORT)); 

  PRINTF("Created a connection with the server ");
  PRINT6ADDR(&client_conn->ripaddr);
  PRINTF(" local/remote port %u/%u\n",
	UIP_HTONS(client_conn->lport), UIP_HTONS(client_conn->rport));



  //---------------------- Set Tx ----------

  etimer_set(&set_tx_timer, 30 * CLOCK_SECOND);
  set_tx_flag();
set_tx();
  PROCESS_WAIT_EVENT_UNTIL(etimer_expired(&set_tx_timer));
 clear_tx_flag();
  //--------------------------------------

#if WITH_COMPOWER
  powertrace_sniff(POWERTRACE_ON);
#endif

  etimer_set(&periodic, SEND_INTERVAL);
  while(1) {
    PROCESS_YIELD();
    if(ev == tcpip_event) {
      tcpip_handler();
    }
    
    if(etimer_expired(&periodic)) {
      etimer_reset(&periodic);
      ctimer_set(&backoff_timer, SEND_TIME, send_packet, NULL);

#if WITH_COMPOWER
      if (print == 0) {
	powertrace_print("#P");
      }
      if (++print == 3) {
	print = 0;
      }
#endif

    }
  }

  PROCESS_END();
}
Exemple #6
0
ptt_serial_windows::~ptt_serial_windows() {
	set_tx(0);
	::CloseHandle(hnd_);
}
Exemple #7
0
ptt_serial_unix::~ptt_serial_unix() {
	set_tx(0);
	if (fd_ > 0)
		close(fd_);
}