sending arrays over channels
-
- XCore Addict
- Posts: 204
- Joined: Sun Jun 01, 2014 10:25 pm
sending arrays over channels
What is the syntax for sending an array over a channel?
-
- XCore Expert
- Posts: 754
- Joined: Thu Dec 10, 2009 6:56 pm
Sending arrays over channels was not possible last time I tested (a few tools version ago), I don't think this has changed.
You either have to transmit it element by element or wrap it in a struct.
You either have to transmit it element by element or wrap it in a struct.
-
- Junior Member
- Posts: 7
- Joined: Sat Apr 19, 2014 7:52 pm
You can try the new interfaces system to send an array.
In this way you can transmit a array over a interface. Set the array sender as server, and the receiver as client.
Code: Select all
interface GPS_Interface{
[[notification]] slave void GPS_NewData();
[[clears_notification]] void GPS_GetLatitude(unsigned char SendLatitude[]);
[[clears_notification]] void GPS_GetLongitude(unsigned char SendLongitude[]);
[[clears_notification]] void GPS_GetSpeed(unsigned char SendSpeed[]);
}GPS_Interface ;
Code: Select all
case GPS_Data.GPS_GetLongitude(unsigned char SendLongitude[]):
for (int i = 0; i < 11; i++)
{
SendLongitude[i] = Longitude[i];
}
break;
Code: Select all
unsigned char Longitude[11] = {0};
GPS_Data.GPS_GetLatitude(Latitude);