00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00040 #ifndef __its_common_h
00041 #define __its_common_h
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055 #include "pic_utils.h"
00056
00057
00058
00059 #define ITS_ASSOC_REQ 0x00
00060 #define ITS_ASSOC_RES 0x01
00061 #define ITS_APP_DATA 0x02
00062 #define ITS_ACK 0x03
00063 #define ITS_PENDING_DATA_REQ 0x04
00064 #define ITS_LOCAL_DISCOVER_REQ 0x05
00065 #define ITS_LOCAL_DISCOVER_RES 0x06
00066 #define ITS_NET_DISCOVER_REQ 0x07
00067 #define ITS_NET_DISCOVER_RES 0x08
00068 #define ITS_GENERIC_DATA 0x09
00069 #define ITS_ENDPOINT_REQ 0x0a
00070
00071
00072 #define ITS_ENDPOINT_RES 0x0b
00073
00074 #define ITS_ENDPOINT_DATA 0x0c
00075
00076
00077 #define ITS_ROUTE_FAILURE 0x0d
00078
00079
00081 typedef struct _local_address {
00082 uns16 pan_id;
00083 uns16 short_address;
00084 } local_address;
00085
00087 typedef struct _remote_address {
00088 uns16 remote_indicator;
00089 uns16 prior_device_id;
00090 } remote_address;
00091
00093 typedef union _its_address {
00094 local_address local;
00095 remote_address remote;
00096 } its_address;
00097
00099 typedef struct {
00100 uns16 its_device_id;
00101 its_address addr;
00102 } its_device_info;
00103
00105 typedef uns8 its_device_handle;
00106
00107 #define ITS_DEVICE_NONE 0xff
00108
00113 void its_init();
00114
00118 void its_print_devices();
00119
00128 void its_set_network_id(uns16 network_id);
00129
00135 uns16 its_get_network_id();
00136
00143 void its_set_device_id(uns16 device_id);
00144 uns16 its_get_device_id();
00145 its_device_handle its_get_device_handle(uns16 device_id);
00146 its_device_info *its_get_device_info(uns8 handle);
00147 its_device_handle its_add_local_device(uns16 device_id, uns16 pan_id, uns16 short_address);
00148 its_device_handle its_add_net_device(uns16 device_id, uns16 previous_hop);
00149 void its_transmit_to_handle(its_device_handle handle, uns8 packet_type, uns8 *data, uns8 data_length);
00150 void its_transmit_to_ea(uns8 *dest_ea, uns16 dest_its_device_id, uns8 packet_type, uns8 *data, uns8 data_length);
00151 void its_transmit_to_sa(uns16 dest_pan_id, uns16 dest_sa, uns16 dest_device_id, uns8 packet_type, uns8 *data, uns8 data_length);
00152 uns8 its_get_next_sequence();
00153
00154
00155
00156 #endif