XBEE API Mode Receive (data conversion)

This is my first pose so please be patient :wink:

I set up a smal network of sensors, my router node sends data by an xbee pro s2b to the coordinator. the data are valid when the arrive. i store them in a byte array. Now i wana convert the data in to a structure by a cast.
But there is still no data in the stuct after the cast. i also tried with memcpy… its all the same. when i print my array to the serial window the data appears just fine :confused: any idee or hint whats wrong with ist ?

#include <SoftwareSerial.h>
#include <XBee.h>

SoftwareSerial mySerial(2, 3); // RX, TX

struct TClimate{
    float h;
    float t;

TClimate* data = new TClimate();

uint8_t payload[sizeof(TClimate)];

XBee xbee = XBee();
XBeeResponse response = XBeeResponse();

// create reusable response objects for responses we expect to handle 
ZBRxResponse rx = ZBRxResponse();
ModemStatusResponse msr = ModemStatusResponse();

void setup() {

void loop() {  
  if (xbee.getResponse().isAvailable()) {
    if (xbee.getResponse().getApiId() == ZB_RX_RESPONSE) {
      Serial.print("API ID: ");
      if (rx.getOption() == ZB_PACKET_ACKNOWLEDGED) {
        // the sender got an ACK
        Serial.println("sender got an ACK");
      } else {
        // we got it (obviously) but sender didn't get an ACK
        Serial.println("sender got an nothing");
      Serial.print("Data Length: ");
      for(size_t i= (rx.getDataLength()-9); i<rx.getDataLength()-1;i++){
        payload[i] = rx.getData(i);
        //Serial.print("Payload :");
        //Serial.println( payload[i],HEX);
      data = (TClimate*) payload;
      Serial.print("Humidity: ");
      Serial.print(" %\t");
      Serial.print("Temperature: ");
      Serial.println(" *C");
      for(size_t i= (rx.getDataLength()-9); i<rx.getDataLength()-1;i++){
        payload[i] = rx.getData(i);

Where you write data into payload is NOT the same as where you read data from the packet.

Thanks, i figured that out earlier today... stupid mistake... an additional question i was using the getDataLength() and got as a result 27 which is the whole frame i think ? also i was using getDataOffset it returns 11, when i look up the frame structure my data starts at position 19 ? do i understand the methods wrong or do i looking up the wrong frame ?

Thanks in advance.

I am new in the electronics world. I am looking for a code which is capable of sending a string frame one x bee s2b pro to another. If any one could help me i will be thankful.