void HoofSerial::println(String jsonString, bool disableAck = false) { char jsonChar[jsonString.length() + 1]; jsonString.toCharArray(jsonChar, sizeof(jsonChar)); //Serial.println(jsonChar); Tx16Request tx; if(!disableAck) { tx = Tx16Request(0x0005, (unsigned char*) jsonChar, sizeof(jsonChar)); } else { tx = Tx16Request(0x0005, 0x0001, (unsigned char*) jsonChar, sizeof(jsonChar), 0x0000); } _xbee.send(tx); }
Coms::Coms(ComsDecoder* comsDecoder) { // setupt the object to notify on incoming messages _comsDecoder = comsDecoder; // create a resusable TX packet to save space #if COM_MODE == COM_MODE_XBEE uint8_t *data = new uint8_t(); _tx16 = Tx16Request(C_COMMS_BSTATION_ADDRESS, data, 1); // setup the conection to the XBEE C_COMS_PORT.begin(C_COMS_BAUD_RATE); _xbee.begin(C_COMS_PORT); _outstandingSent = false; #endif #if COM_MODE == COM_MODE_SERIAL C_COMS_PORT.begin(C_COMS_BAUD_RATE); _readData = 0; #endif }
void sendPacket( uint16_t remoteAddress, char * dataStr ) { Tx16Request tx = Tx16Request(remoteAddress, (uint8_t *) dataStr, Utilities::charArrayLength(dataStr)); xbee.send(tx); }