Пример #1
0
int main( int argc, char *argv[])
{	
  pthread_t rxThread,txThread;
  int threadResult;
  void *rxThreadJoin,*txThreadJoin;

  rx_running = 1;
  tx_running = 1;
  fd = open_obd_serial("/dev/ttyACM0");
  if ( fd == -1 ) exit(0);
  con = open_socket_connection("localhost", 20000, 20001);

  threadResult = pthread_create(&rxThread,(pthread_attr_t*)NULL,(void *)&rx_from_ob_to_click_thread,(void*)NULL);  //use last arg (pointer) for arguments for thread
  threadResult = pthread_create(&txThread,(pthread_attr_t*)NULL,(void *)&tx_from_click_to_ob_thread,(void*)NULL);

//  sleep(2);	
//  printf("Fire\n");
//  write_obd_serial(fd, "fire\n", 6);

  pthread_join(rxThread,&rxThreadJoin);
  pthread_join(txThread,&txThreadJoin);

  return(0);
}
Пример #2
0
void report(char *ip, int kill)
{
	int sockfd = open_socket_connection(ip, 1148);
	get_nums(sockfd, kill);
}