00001
00011
00012
00013
00014
00015
00016
00017 #if ((defined ZRC_PROFILE) || (defined DOXYGEN))
00018
00019
00020 #ifndef ZRC_H
00021 #define ZRC_H
00022
00023
00024
00025
00026 #include "rf4ce.h"
00027
00028
00029
00036 #define DISCOVERY_DURATION 0x00186A
00037
00039 #define AUTO_DISC_DURATION_SYM 0x1C9C38
00040
00042 #define DISCOVERY_REPETITION_INTERVAL 0x00F424
00043
00045 #define MAX_DISCOVERY_REPETITIONS 0x1E
00046
00048 #define MAX_REPORTED_NODE_DESCRIPTORS 1
00049
00052 #define aplcMaxKeyRepeatInterval_ms 100
00053
00054 #define aplKeyRepeatInterval_def (aplcMaxKeyRepeatInterval_ms)
00055
00056 #define aplKeyRepeatWaitTime_def (2 * aplcMaxKeyRepeatInterval_ms)
00057
00059 #define aplcMaxCmdDiscRxOnDuration 200
00060
00063 #define aplcMaxPairIndicationWaitTime 1.2
00064
00067 #define aplcMaxPairIndicationWaitTime_us (aplcMaxPairIndicationWaitTime * 1000000L)
00068
00070 #define aplcMaxResponseWaitTime 200
00071
00073 #define aplcMaxResponseWaitTime_us (aplcMaxResponseWaitTime * 1000L)
00074
00076 #define aplcMinKeyExchangeTransferCount 3
00077
00078 #define aplcKeyExchangeTransferCount_def aplcMinKeyExchangeTransferCount
00079
00081 #define aplcMinTargetBlackoutPeriod 500
00082
00084 #define aplcMinTargetBlackoutPeriod_us (aplcMinTargetBlackoutPeriod * 1000L)
00085
00086
00087
00093 typedef enum zrc_cmd_code_tag
00094 {
00095
00096 USER_CONTROL_IDLE = 0x00,
00097 USER_CONTROL_PRESSED = 0x01,
00098 USER_CONTROL_REPEATED = 0x02,
00099 USER_CONTROL_RELEASED = 0x03,
00100 CMD_DISCOVERY_REQUEST = 0x04,
00101 CMD_DISCOVERY_RESPONSE = 0x05
00102
00103 } SHORTENUM zrc_cmd_code_t;
00104
00111 typedef enum cec_code_tag
00112 {
00113 SELECT = 0x00,
00114 UP = 0x01,
00115 DOWN = 0x02,
00116 LEFT = 0x03,
00117 RIGHT = 0x04,
00118 RIGHT_UP = 0x05,
00119 RIGHT_DOWN = 0x06,
00120 LEFT_UP = 0x07,
00121 LEFT_DOWN = 0x08,
00122 ROOT_MENU = 0x09,
00123 SETUP_MENU = 0x0a,
00124 CONTENTS_MENU = 0x0b,
00125 FAVORITE_MENU = 0x0c,
00126 EXIT = 0x0d,
00127
00128 MEDIA_TOP_MENU = 0x10,
00129 MEDIA_CONTEXT_MENU = 0x11,
00130
00131 NUMBER_SHIFT = 0x1d,
00132 NUMBER_11 = 0x1e,
00133 NUMBER_12 = 0x1f,
00134 NUMBER_0 = 0x20,
00135 NUMBER_1 = 0x21,
00136 NUMBER_2 = 0x22,
00137 NUMBER_3 = 0x23,
00138 NUMBER_4 = 0x24,
00139 NUMBER_5 = 0x25,
00140 NUMBER_6 = 0x26,
00141 NUMBER_7 = 0x27,
00142 NUMBER_8 = 0x28,
00143 NUMBER_9 = 0x29,
00144 DOT = 0x2a,
00145 ENTER = 0x2b,
00146 CLEAR = 0x2c,
00147
00148 NEXT_FAVORITE = 0x2f,
00149 CHANNEL_UP = 0x30,
00150 CHANNEL_DOWN = 0x31,
00151 PREVIOUS_CHANNEL = 0x32,
00152 SOUND_SELECT = 0x33,
00153 INPUT_SELECT = 0x34,
00154 DISPLAY_INFORMATION = 0x35,
00155 HELP = 0x36,
00156 PAGE_UP = 0x37,
00157 PAGE_DOWN = 0x38,
00158
00159 POWER = 0x40,
00160 VOLUME_UP = 0x41,
00161 VOLUME_DOWN = 0x42,
00162 MUTE = 0x43,
00163 PLAY = 0x44,
00164 STOP = 0x45,
00165 PAUSE = 0x46,
00166 RECORD = 0x47,
00167 REWIND = 0x48,
00168 FAST_FORWARD = 0x49,
00169 EJECT = 0x4a,
00170 FORWARD = 0x4b,
00171 BACKWARD = 0x4c,
00172 STOP_RECORD = 0x4d,
00173 PAUSE_RECORD = 0x4e,
00174
00175 ANGLE = 0x50,
00176 SUB_PICTURE = 0x51,
00177 VIDEO_ON_DEMAND = 0x52,
00178 ELECTRONIC_PROGRAM_GUIDE = 0x53,
00179 TIMER_PROGRAMMING = 0x54,
00180 INITIAL_CONFIGURATION = 0x55,
00181 SELECT_BROADCAST_TYPE = 0x56,
00182 SELECT_SOUND_PRESENTATION = 0x57,
00183
00184 PLAY_FUNCTION = 0x60,
00185 PAUSE_PLAY_FUNCTION = 0x61,
00186 RECORD_FUNCTION = 0x62,
00187 PAUSE_RECORD_FUNCTION = 0x63,
00188 STOP_FUNCTION = 0x64,
00189 MUTE_FUNCTION = 0x65,
00190 RESTORE_VOLUME_FUNCTION = 0x66,
00191 TUNE_FUNCTION = 0x67,
00192 SELECT_MEDIA_FUNCTION = 0x68,
00193 SELECT_AV_INPUT_FUNCTION = 0x69,
00194 SELECT_AUDIO_INPUT_FUNCTION = 0x6a,
00195 POWER_TOGGLE_FUNCTION = 0x6b,
00196 POWER_OFF_FUNCTION = 0x6c,
00197 POWER_ON_FUNCTION = 0x6d,
00198
00199 F1_BLUE = 0x71,
00200 F2_RED = 0x72,
00201 F3_GREEN = 0x73,
00202 F4_YELLOW = 0x74,
00203 F5 = 0x75,
00204 DATA = 0x76
00205
00206 } SHORTENUM cec_code_t;
00207
00211 typedef struct zrc_cmd_frm_tag
00212 {
00213 uint8_t fcf;
00214 uint8_t rc_cmd;
00215 uint8_t payload;
00216 } zrc_cmd_frm_t;
00217
00218 #if (defined RF4CE_CALLBACK_PARAM) || (defined DOXYGEN)
00219
00220 #if (defined ZRC_CMD_DISCOVERY)
00221 typedef void (*zrc_cmd_disc_confirm_cb_t)(nwk_enum_t Status, uint8_t PairingRef,
00222 uint8_t *SupportedCmd);
00223 #endif
00224
00225 #if (!defined RF4CE_TARGET)
00226 typedef void (*zrc_cmd_confirm_cb_t)(nwk_enum_t Status, uint8_t PairingRef, cec_code_t RcCmd);
00227 #endif
00228
00229 #if (defined ZRC_CMD_DISCOVERY)
00230 typedef void (*zrc_cmd_disc_indication_cb_t)(uint8_t PairingRef);
00231 #endif
00232
00233 #if (defined RF4CE_TARGET) || (defined ZRC_CMD_DISCOVERY)
00234 typedef void (*zrc_cmd_indication_cb_t)(uint8_t PairingRef, uint8_t nsduLength, uint8_t *nsdu,
00235 uint8_t RxLinkQuality, uint8_t RxFlags);
00236 #endif
00237
00238 #ifdef VENDOR_DATA
00239 typedef void (*vendor_data_ind_cb_t)(uint8_t PairingRef, uint16_t VendorId, uint8_t nsduLength,
00240 uint8_t *nsdu, uint8_t RxLinkQuality, uint8_t RxFlags);
00241 #endif
00242
00249 typedef struct zrc_indication_callback
00250 {
00251 #if (defined RF4CE_TARGET) || (defined ZRC_CMD_DISCOVERY) || (defined DOXYGEN)
00252 zrc_cmd_indication_cb_t zrc_cmd_indication_cb;
00253 #endif
00254 #if (defined ZRC_CMD_DISCOVERY) || (defined DOXYGEN)
00255 zrc_cmd_disc_indication_cb_t zrc_cmd_disc_indication_cb;
00256 #endif
00257 #if (defined VENDOR_DATA) || (defined DOXYGEN)
00258 vendor_data_ind_cb_t vendor_data_ind_cb;
00259 #endif
00260 } zrc_indication_callback_t;
00261
00262 #endif
00263
00264
00265
00266
00267
00277 #if ((defined SIO_HUB) || (defined DOXYGEN))
00278 char *zrc_print_rc_cmd_text(uint8_t command);
00279 #endif
00280
00281
00282
00283
00284
00285
00286
00303 #if (!defined RF4CE_TARGET) || (defined DOXYGEN)
00304 bool zrc_cmd_request(uint8_t PairingRef, uint16_t VendorId, zrc_cmd_code_t CmdCode,
00305 uint8_t CmdLength, uint8_t *Cmd, uint8_t TxOptions
00306 #if (defined RF4CE_CALLBACK_PARAM) || (defined DOXYGEN)
00307 , FUNC_PTR confirm_cb
00308 #endif
00309 );
00310 #endif
00311
00312
00313 #if (!defined RF4CE_CALLBACK_PARAM) || (defined DOXYGEN)
00314
00324 #if (!defined RF4CE_TARGET) || (defined DOXYGEN)
00325 void zrc_cmd_confirm(nwk_enum_t Status, uint8_t PairingRef, cec_code_t RcCmd);
00326 #endif
00327
00328
00340 #if (defined RF4CE_TARGET) || (defined ZRC_CMD_DISCOVERY) || (defined DOXYGEN)
00341 void zrc_cmd_indication(uint8_t PairingRef, uint8_t nsduLength, uint8_t *nsdu,
00342 uint8_t RxLinkQuality, uint8_t RxFlags);
00343 #endif
00344
00345
00357 void zrc_data_indication(uint8_t PairingRef, uint16_t VendorId, uint8_t nsduLength,
00358 uint8_t *nsdu, uint8_t RxLinkQuality, uint8_t RxFlags);
00359
00360
00368 void zrc_data_confirm(nwk_enum_t Status, uint8_t PairingRef, profile_id_t ProfileId
00369 #if (defined NLDE_HANDLE) || (defined DOXYGEN)
00370 , uint8_t Handle
00371 #endif
00372 );
00373 #endif
00374
00375
00376
00377
00378
00393 #if (defined ZRC_CMD_DISCOVERY) || (defined DOXYGEN)
00394 bool zrc_cmd_disc_request(uint8_t PairingRef
00395 #if (defined RF4CE_CALLBACK_PARAM) || (defined DOXYGEN)
00396 , FUNC_PTR confirm_cb
00397 #endif
00398 );
00399 #endif
00400
00401
00402 #if (!defined RF4CE_CALLBACK_PARAM) || (defined DOXYGEN)
00403
00415 #if (defined ZRC_CMD_DISCOVERY) || (defined DOXYGEN)
00416 void zrc_cmd_disc_confirm(nwk_enum_t Status, uint8_t PairingRef, uint8_t *SupportedCmd);
00417 #endif
00418
00419
00430 #if (defined ZRC_CMD_DISCOVERY) || (defined DOXYGEN)
00431 void zrc_cmd_disc_indication(uint8_t PairingRef);
00432 #endif
00433 #endif
00434
00435
00449 #if (defined ZRC_CMD_DISCOVERY) || (defined DOXYGEN)
00450 bool zrc_cmd_disc_response(uint8_t PairingRef, uint8_t *SupportedCmd);
00451 #endif
00452
00453
00466 #if (defined RF4CE_CALLBACK_PARAM) || (defined DOXYGEN)
00467 void register_zrc_indication_callback(zrc_indication_callback_t *zrc_ind_callback);
00468 #endif
00469
00470
00471
00472 #endif
00473
00474 #endif
00475
00476