Hi Lykurg. Txs for replying 
I've somewhat pinpointed the problem...
The resize actually works 
The problem is when I throw data into the byte array as exemplified:
	
	records >> sPacket.size_app_payload;
printf ("size_app_payload: %d\r\n", sPacket.size_app_payload);
sPacket.app_payload.resize( sPacket.size_app_payload );
printf ("app_payload size after resize(): %d\r\n",sPacket.app_payload.size() ); 
records >> sPacket.app_payload; //! problem line!
printf ("app_payload size after records >> : %d\r\n",sPacket.app_payload.size() );
        records >> sPacket.size_app_payload;
printf ("size_app_payload: %d\r\n", sPacket.size_app_payload);
sPacket.app_payload.resize( sPacket.size_app_payload );
printf ("app_payload size after resize(): %d\r\n",sPacket.app_payload.size() ); 
records >> sPacket.app_payload; //! problem line!
printf ("app_payload size after records >> : %d\r\n",sPacket.app_payload.size() );
To copy to clipboard, switch view to plain text mode 
  
this is the output:
size_app_payload: 15
app_payload size after resize(): 15
app_payload size after records >> : 0
the sPacket is of:
	
	typedef struct {
	quint8 DLE;			// ASCII DLE character (16 decimal)
	quint8 packet_id;		// packet ID
					// types:
					//	6 - ACK
					//	10 - Command
					//	14 - Date/Time Data
					//	21 - NAK
					//	38 - Unit ID/ESN
					//	51 - PVT (Position, Velocity, Time) Data
					//	135 - Legacy Stop message
					//	136 - Legacy text message
					//	161 - Fleet Management packet
	quint8 size_app_payload;	// number of bytes of packet data (bytes 3 to n-4)
	quint8 checksum;		// 2's complement of the sum of all bytes from byte 1 to byte n-4 (end of the payload)
	quint8 DLE_end;			// same as DLE
	quint8 ETX;			// End of text - ASCII ETX character (3 decimal)
} serial_packet_format;
        typedef struct {
	quint8 DLE;			// ASCII DLE character (16 decimal)
	quint8 packet_id;		// packet ID
					// types:
					//	6 - ACK
					//	10 - Command
					//	14 - Date/Time Data
					//	21 - NAK
					//	38 - Unit ID/ESN
					//	51 - PVT (Position, Velocity, Time) Data
					//	135 - Legacy Stop message
					//	136 - Legacy text message
					//	161 - Fleet Management packet
	quint8 size_app_payload;	// number of bytes of packet data (bytes 3 to n-4)
	QByteArray app_payload;		// 0 to 255 bytes
	quint8 checksum;		// 2's complement of the sum of all bytes from byte 1 to byte n-4 (end of the payload)
	quint8 DLE_end;			// same as DLE
	quint8 ETX;			// End of text - ASCII ETX character (3 decimal)
} serial_packet_format;
To copy to clipboard, switch view to plain text mode 
  
and I know there's data pending in the datastream ...
So... the above code compiles without a problem... I'm wondering if there's a problem with 
	
	records >> sPacket.app_payload;
        records >> sPacket.app_payload;
To copy to clipboard, switch view to plain text mode 
   this syntax ...
TIA,
Pedro.
				
			
Bookmarks