Electronic – zigbee communication

wirelesszigbee

I am trying to communicate two xbee version 2, one of them coordinator and the other is end point xbee.

I have tried to write two functions namely receive and transmit.

void receive ( string &data ) {
 // construct data format with xbee id and checksum

 // ?
}

What should I write the position marked as ? in order to take data from usb ?

Operating system : Linux

Desktop edition : Ubuntu 12.04

Best Answer

Why not use a library? Andrew Rapp's XBee API (http://code.google.com/p/xbee-api/) is the best I've found so far.