its_common.h File Reference
Go to the source code of this file.
Data Structures |
union | its_address |
struct | its_device_info |
struct | local_address |
struct | remote_address |
Defines |
#define | ITS_ACK 0x03 |
#define | ITS_APP_DATA 0x02 |
#define | ITS_ASSOC_REQ 0x00 |
#define | ITS_ASSOC_RES 0x01 |
#define | ITS_DEVICE_NONE 0xff |
#define | ITS_ENDPOINT_DATA 0x0c |
#define | ITS_ENDPOINT_REQ 0x0a |
#define | ITS_ENDPOINT_RES 0x0b |
#define | ITS_GENERIC_DATA 0x09 |
#define | ITS_LOCAL_DISCOVER_REQ 0x05 |
#define | ITS_LOCAL_DISCOVER_RES 0x06 |
#define | ITS_NET_DISCOVER_REQ 0x07 |
#define | ITS_NET_DISCOVER_RES 0x08 |
#define | ITS_PENDING_DATA_REQ 0x04 |
#define | ITS_ROUTE_FAILURE 0x0d |
Typedefs |
typedef uns8 | its_device_handle |
Functions |
its_device_handle | its_add_local_device (uns16 device_id, uns16 pan_id, uns16 short_address) |
its_device_handle | its_add_net_device (uns16 device_id, uns16 previous_hop) |
its_device_handle | its_get_device_handle (uns16 device_id) |
uns16 | its_get_device_id () |
its_device_info * | its_get_device_info (uns8 handle) |
uns16 | its_get_network_id () |
| Retrieve the current network ID.
|
uns8 | its_get_next_sequence () |
void | its_init () |
| Initialise ITS and lower layers.
|
void | its_print_devices () |
| Print devices currently known to this one.
|
void | its_set_device_id (uns16 device_id) |
| Set the ITS device ID.
|
void | its_set_network_id (uns16 network_id) |
| Set the ITS network ID.
|
void | its_transmit_to_ea (uns8 *dest_ea, uns16 dest_its_device_id, uns8 packet_type, uns8 *data, uns8 data_length) |
void | its_transmit_to_handle (its_device_handle handle, uns8 packet_type, uns8 *data, uns8 data_length) |
void | its_transmit_to_sa (uns16 dest_pan_id, uns16 dest_sa, uns16 dest_device_id, uns8 packet_type, uns8 *data, uns8 data_length) |
Define Documentation
#define ITS_APP_DATA 0x02 |
#define ITS_ASSOC_REQ 0x00 |
#define ITS_ASSOC_RES 0x01 |
#define ITS_DEVICE_NONE 0xff |
#define ITS_ENDPOINT_DATA 0x0c |
#define ITS_ENDPOINT_REQ 0x0a |
#define ITS_ENDPOINT_RES 0x0b |
#define ITS_GENERIC_DATA 0x09 |
#define ITS_LOCAL_DISCOVER_REQ 0x05 |
#define ITS_LOCAL_DISCOVER_RES 0x06 |
#define ITS_NET_DISCOVER_REQ 0x07 |
#define ITS_NET_DISCOVER_RES 0x08 |
#define ITS_PENDING_DATA_REQ 0x04 |
#define ITS_ROUTE_FAILURE 0x0d |
Typedef Documentation
Definition of its_device_handle
Function Documentation
its_device_handle its_add_local_device |
( |
uns16 |
device_id, |
|
|
uns16 |
pan_id, |
|
|
uns16 |
short_address | |
|
) |
| | |
00108 {
00109
00110 bit found = 0;
00111 if (device_id == 0xffff) {
00112 return ITS_DEVICE_NONE;
00113 }
00114 for (uns8 count=0; count < ITS_MAX_KNOWN_DEVICES; count++) {
00115 if (its_devices[count].its_device_id == device_id) {
00116 found = 1;
00117 break;
00118 }
00119 }
00120 if (found) {
00121 return count;
00122 } else {
00123 return ITS_DEVICE_NONE;
00124 }
00125 }
uns16 its_get_device_id |
( |
|
) |
|
00100 {
00101 if (handle < ITS_MAX_KNOWN_DEVICES) {
00102 return &its_devices[handle];
00103 } else {
00104 return NULL;
00105 }
00106 }
uns16 its_get_network_id |
( |
|
) |
|
uns8 its_get_next_sequence |
( |
|
) |
|
Call before using any ITS functionality
void its_print_devices |
( |
|
) |
|
void its_set_device_id |
( |
uns16 |
device_id |
) |
|
void its_set_network_id |
( |
uns16 |
network_id |
) |
|
void its_transmit_to_ea |
( |
uns8 * |
dest_ea, |
|
|
uns16 |
dest_its_device_id, |
|
|
uns8 |
packet_type, |
|
|
uns8 * |
data, |
|
|
uns8 |
data_length | |
|
) |
| | |
00232 {
00233
00234
00235
00236 uns8 buffer[20];
00237
00238 uns8 count;
00239
00240
00241
00242 buffer[0] = 'I';
00243 buffer[1] = 'T';
00244 buffer[2] = 11;
00245 buffer[3] = packet_type;
00246 buffer[4] = its_sequence++;
00247
00248 buffer[5] = its_network_id & 0xff;
00249 buffer[6] = its_network_id >> 8;
00250
00251 buffer[7] = its_device_id & 0xff;
00252 buffer[8] = its_device_id >> 8;
00253
00254
00255 buffer[9] = dest_its_device_id & 0xff;
00256 buffer[10] = dest_its_device_id >> 8;
00257
00258
00259 buffer[11] = 1;
00260 buffer[12] = 0;
00261 buffer[13] = 0;
00262
00263 buffer[14] = data_length;
00264 for (count = 0; count < data_length; count++) {
00265 buffer[15+count] = data[count];
00266 }
00267 mrf24j40_transmit_to_extended_address(FRAME_TYPE_DATA, 0xffff,
00268 dest_ea, &buffer,
00269 data_length + 15, MRF_NO_ACK);
00270 }
void its_transmit_to_handle |
( |
its_device_handle |
handle, |
|
|
uns8 |
packet_type, |
|
|
uns8 * |
data, |
|
|
uns8 |
data_length | |
|
) |
| | |
void its_transmit_to_sa |
( |
uns16 |
dest_pan_id, |
|
|
uns16 |
dest_sa, |
|
|
uns16 |
dest_device_id, |
|
|
uns8 |
packet_type, |
|
|
uns8 * |
data, |
|
|
uns8 |
data_length | |
|
) |
| | |
00195 {
00196
00197 uns8 buffer[20];
00198 uns16 temp;
00199 uns8 count;
00200
00201 buffer[0] = 'I';
00202 buffer[1] = 'T';
00203 buffer[2] = 11;
00204 buffer[3] = packet_type;
00205 buffer[4] = its_sequence++;
00206
00207 buffer[5] = its_network_id & 0xff;
00208 buffer[6] = its_network_id >> 8;
00209
00210 buffer[7] = its_device_id & 0xff;
00211 buffer[8] = its_device_id >> 8;
00212
00213 temp = dest_device_id;
00214 buffer[9] = temp & 0xff;
00215 buffer[10] = temp >> 8;
00216
00217
00218 buffer[11] = 1;
00219 buffer[12] = 0;
00220 buffer[13] = 0;
00221
00222 buffer[14] = data_length;
00223 for (count = 0; count < data_length; count++) {
00224 buffer[15+count] = data[count];
00225 }
00226 mrf24j40_transmit_to_short_address(FRAME_TYPE_DATA, dest_pan_id,
00227 dest_sa, &buffer,
00228 data_length + 15, MRF_ACK);
00229 }