src/pdcp.h
Go to the documentation of this file.
00001 
00009 #ifndef PDCP_H_
00010 #define PDCP_H_
00011 
00012 #include "types.h"
00013 
00014 #define MESSAGE_PRIORITY 9
00015 #define MESSAGE_MODE     8
00016 
00017 #define RESPCODE_FAILURE 0
00018 #define RESPCODE_SUCCESS 1
00019 
00020 /*
00021  * Naming convention
00022  * 1) Names are taken from the "Function Codes" section of the PDCP protocol spec.
00023  * 2) All names start with either "request_" or "respons_", or the uppercase equivalents.
00024  *    This is not valid English, but prefixes of equal length are beautyful.
00025  *    Prefixes are a poor man's namespace, and as opposed to suffixes, is a big-endian
00026  *    naming convention, which is both logical and beautyful.
00027  * 3) To keep names short, omit "device" and the request/response suffix.
00028  */
00029 
00030 enum{
00031     REQUEST_BIND                             = 0x01,
00032     RESPONS_BIND                             = 0x81,
00033     REQUEST_GET_INFO                         = 0x02,
00034     RESPONS_GET_INFO                         = 0x82,
00035     REQUEST_GET_PARAMETER                    = 0x03,
00036     RESPONS_GET_PARAMETER                    = 0x83,
00037     REQUEST_SET_PARAMETER                    = 0x04,
00038     RESPONS_SET_PARAMETER                    = 0x84,
00039     REQUEST_SUSPEND                          = 0x08,
00040     RESPONS_SUSPEND                          = 0x88,
00041     REQUEST_RELEASE                          = 0x09,
00042     RESPONS_RELEASE                          = 0x89,
00043     REQUEST_BEACON                           = 0x0A,
00044 //  RESPONS_BEACON                           = 0x8A, undefined
00045     REQUEST_RESET                            = 0x0B,
00046     RESPONS_RESET                            = 0x8B,
00047     REQUEST_CONFIGURE_GET_BULK_DATA_TRANSFER = 0x0C,
00048     RESPONS_CONFIGURE_GET_BULK_DATA_TRANSFER = 0x8C,
00049     REQUEST_CONFIGURE_SET_BULK_DATA_TRANSFER = 0x0D,
00050     RESPONS_CONFIGURE_SET_BULK_DATA_TRANSFER = 0x8D,
00051     REQUEST_BULK_DATA_TRANSFER               = 0x0E,
00052     RESPONS_BULK_DATA_TRANSFER               = 0x8E,
00053     REQUEST_UPDATE_DATA_CHANNEL              = 0x0F,
00054     RESPONS_UPDATE_DATA_CHANNEL              = 0x8F
00055 };
00056 
00057 /*
00058  * Multibyte fields are little endian, according to
00059  * "Function Code Implementation Examples" of the PDCP spec.
00060  */
00061 
00062 struct request_bind{
00063     u16 vendor_id;
00064     u16 product_id;
00065     u16 serial_number;
00066 };
00067 
00068 struct respons_bind{
00069     u8 node_id;
00070     u16 vendor_id;
00071     u16 product_id;
00072     u16 serial_number;
00073 };
00074 
00075 struct request_get_parameter{
00076     u8 parameter_id;
00077     u8 channel_index;
00078 };
00079 
00080 struct respons_get_parameter{
00081     u8 response_code;
00082     u8 parameter_id;
00083     u8 channel_index;
00084     u8 parameter_value[4];
00085 };
00086 
00087 struct request_set_parameter{
00088     u8 parameter_id;
00089     u8 channel_index;
00090     u8 parameter_value[4];
00091 };
00092 
00093 struct respons_set_parameter{
00094     u8 response_code;
00095     u8 parameter_id;
00096     u8 channel_index;
00097     u8 parameter_value[4];
00098 };
00099 
00100 struct request_suspend{
00101     u16 time_msec;
00102 };
00103 
00104 struct respons_suspend{
00105     u8 response_code;
00106     u16 time_msec;
00107 };
00108 
00109 struct request_release{};
00110 
00111 struct respons_release{
00112     u8 response_code;
00113 };
00114 
00115 struct request_beacon{};
00116 
00117 struct request_reset{};
00118 
00119 struct respons_reset{
00120     u8 response_code;
00121 };
00122 
00123 struct request_configure_get_bulk_data_transfer{
00124     u8 parameter_id;
00125     u8 channel_index;
00126 };
00127 
00128 struct respons_configure_get_bulk_data_transfer{
00129     u8 response_code;
00130     u8 parameter_id;
00131     u8 channel_index;
00132     u16 bulk_data_size;
00133 };
00134 
00135 struct request_configure_set_bulk_data_transfer{
00136     u8 parameter_id;
00137     u8 channel_index;
00138     u16 bulk_data_size;
00139 };
00140 
00141 struct respons_configure_set_bulk_data_transfer{
00142     u8 response_code;
00143     u8 parameter_id;
00144     u8 channel_index;
00145     u16 bulk_data_size;
00146 };
00147 
00148 struct request_bulk_data_transfer{
00149     u8 packet_id;
00150     u8 bulk_data[6];
00151 };
00152 
00153 struct respons_bulk_data_transfer{
00154     u8 response_code;
00155 };
00156 
00157 struct respons_update_data_channel{
00158     u8 channel_index;
00159 };
00160 
00161 struct request_update_data_channel{
00162     u8 response_code;
00163     u8 channel_index;
00164 };
00165 
00166 #endif
 All Classes Files Functions Enumerations Enumerator Defines