Project

General

Profile

Revision 1435

added function to exit api mode on termination

View differences:

xbee.c
83 83
static int xbee_enter_command_mode(void);
84 84
static int xbee_exit_command_mode(void);
85 85
static int xbee_enter_api_mode(void);
86
static int xbee_exit_api_mode(void);
86 87
static int xbee_wait_for_string(char* s, int len);
87 88
static int xbee_wait_for_ok(void);
88 89

  
......
344 345
	free(xbee_listen_thread);
345 346
	lockf(xbee_stream, F_ULOCK, 0);
346 347
	close(xbee_stream);
348
  #else
349
  xbee_exit_api_mode();
347 350
	#endif
348 351
}
349 352

  
......
451 454
}
452 455

  
453 456
/**
457
 * Exit API mode.
458
 **/
459
static int xbee_exit_api_mode()
460
{
461
	if (xbee_send_modify_at_command("AP","0") != 0) {
462
		return -1;
463
	}
464

  
465
	return 0;
466
}
467

  
468
/**
454 469
 * Wait until the string "OK\r" is received from the XBee.
455 470
 **/
456 471
static int xbee_wait_for_ok()

Also available in: Unified diff