DVBCore  1.0
Open source DVB engine
midware/CI/inc/ci_plus_control.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2010 Ocean Blue Software Ltd
00004  *
00005  * This file is part of a DTVKit Software Component
00006  * You are permitted to copy, modify or distribute this file subject to the terms
00007  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
00008  * 
00009  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00010  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
00011  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00012  * 
00013  * If you or your organisation is not a member of DTVKit then you have access
00014  * to this source code outside of the terms of the licence agreement
00015  * and you are expected to delete this and any associated files immediately.
00016  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
00017  *******************************************************************************/
00024 /* pre-processor mechanism so multiple inclusions don't cause compilation error*/
00025 
00026 #ifndef CI_PLUS_CONTROL_H
00027 #define CI_PLUS_CONTROL_H
00028 
00029 /*---includes for this file--------------------------------------------------*/
00030 
00031 /* compiler library header files */
00032 
00033 /* third party header files */
00034 
00035 /* DVBCore header files */
00036 #include "techtype.h"
00037 #include "stbhwc.h"
00038 #include "stbci.h"
00039 #include "stbsitab.h"
00040 
00041 /*---Constant and macro definitions for public use-----------------------------*/
00042 
00043 
00044 /* Screen type */
00045 #define CIP_NO_CI_SCREEN            0
00046 #define CIP_CI_MENU_LIST_SCREEN     1
00047 #define CIP_CI_ENQUIRY_SCREEN       2
00048 
00049 #define CIP_URI_LEN                 8
00050 
00051 #define CIP_CICAM_ID_LEN            8
00052 
00053 #define CIP_MAX_PIN_LENGTH          8
00054 
00055 #define CIP_PIN_PRIVATE_DATA_SIZE   15
00056 
00057 
00058 #define CIP_SERVICE_TYPE_TV         0x00000001   /* MPEG2 TV */
00059 #define CIP_SERVICE_TYPE_RADIO      0x00000002   /* MPEG1 Layer-II radio */
00060 #define CIP_SERVICE_TYPE_TELETEXT   0x00000004   /* Teletext */
00061 #define CIP_SERVICE_TYPE_AVC_RADIO  0x00000008   /* AVC radio */
00062 #define CIP_SERVICE_TYPE_DATA       0x00000010   /* Data */
00063 #define CIP_SERVICE_TYPE_HD_TV      0x00000020   /* MPEG2 HD TV */
00064 #define CIP_SERVICE_TYPE_AVC_SD_TV  0x00000040   /* AVC SD TV */
00065 #define CIP_SERVICE_TYPE_AVC_HD_TV  0x00000080   /* AVC HD TV */
00066 
00067 #define CIP_DELIVERY_TYPE_DVBT      0x0001
00068 #define CIP_DELIVERY_TYPE_DVBT2     0x0002
00069 #define CIP_DELIVERY_TYPE_DVBC      0x0004
00070 #define CIP_DELIVERY_TYPE_DVBC2     0x0008
00071 #define CIP_DELIVERY_TYPE_DVBS      0x0010
00072 #define CIP_DELIVERY_TYPE_DVBS2     0x0020
00073 
00074 #define CIP_APP_TYPE_MHEG           0x0001
00075 #define CIP_APP_TYPE_HBBTV          0x0002
00076 #define CIP_APP_TYPE_OIPF           0x0004
00077 
00078 /* Replies for starting an operator profile search */
00079 #define CIP_START_OPERATOR_SEARCH_NO    0x00
00080 #define CIP_START_OPERATOR_SEARCH_YES   0x01
00081 #define CIP_START_OPERATOR_SEARCH_ASK   0x02
00082 
00083 /* Recording operating modes */
00084 #define CIP_RECORD_MODE_WATCH_AND_BUFFER  0x00
00085 #define CIP_RECORD_MODE_TIMESHIFT         0x01
00086 #define CIP_RECORD_MODE_UNATTENDED        0x02
00087 
00088 /* CICAM licence status */
00089 #define CIP_LICENCE_STATUS_OK                         0x00
00090 #define CIP_LICENCE_STATUS_NO_ENTITLEMENT             0x01
00091 #define CIP_LICENCE_STATUS_UNDEFINED_ERROR            0x02
00092 #define CIP_LICENCE_STATUS_RIGHTS_EXPIRED             0x03
00093 #define CIP_LICENCE_STATUS_PLAY_COUNT_EXCEEDED        0x04
00094 #define CIP_LICENCE_STATUS_RETENTION_LIMIT_EXCEEDED   0x05
00095 #define CIP_LICENCE_STATUS_INVALID_LICENCE            0x06
00096 
00097 /* Licence receive status */
00098 #define CIP_LICENCE_RECEIVED_OK           0x00
00099 #define CIP_LICENCE_RECEIVED_INVALID_DATA 0x01
00100 #define CIP_LICENCE_RECEIVED_HOST_ERROR   0x02
00101 
00102 /* Pin status values */
00103 #define CIP_CAM_PIN_CODE_WRONG                0
00104 #define CIP_CAM_PIN_CAM_BUSY                  1
00105 #define CIP_CAM_PIN_CODE_CORRECT              2
00106 #define CIP_CAM_PIN_CODE_UNCONFIRMED          3
00107 #define CIP_CAM_PIN_NO_VIDEO_BLANK            4
00108 #define CIP_CAM_PIN_CONTENT_STILL_SCRAMBLED   5
00109 
00110 /*---Enumerations for public use-----------------------------------------------*/
00111 typedef enum
00112 {
00113    CIPLUS_GET_COUNTRY_CODE,
00114    CIPLUS_GET_LANGUAGE_CODE,
00115    CIPLUS_TUNE_TO_SERVICE,
00116    CIPLUS_TUNE_DEL_SYS_DESC,
00117    CIPLUS_CAM_UPGRADE_OPTION,
00118    CIPLUS_REQUEST_HOST_CONTROL,
00119    CIPLUS_RELEASE_HOST_CONTROL,
00120    CIPLUS_PROCESS_NIT,
00121    CIPLUS_REQUEST_HOST_INFO,
00122    CIPLUS_OPERATOR_TUNE,
00123    CIPLUS_REQUEST_OPERATOR_SEARCH,
00124    CIPLUS_OPERATOR_CAM_AVAILABLE,
00125    CIPLUS_OPERATOR_CAM_REMOVED,
00126    CIPLUS_GET_SUBTITLES_STARTED,
00127    CIPLUS_STOP_SUBTITLES,
00128    CIPLUS_START_SUBTITLES
00129 } E_CI_QUERY;
00130 
00131 typedef enum
00132 {
00133    /* No module or unknown status */
00134    CIP_SLOT_STATUS_UNKNOWN = 0x0000,
00135 
00136    /* DVB-CI module is in the slot */
00137    CIP_SLOT_STATUS_MODULE_READY = 0x0001,
00138 
00139    /* CA descriptors were found in PMT */
00140    CIP_SLOT_STATUS_CA_USED = 0x0002,
00141 
00142    /* CA system is supported */
00143    CIP_SLOT_STATUS_CAS_SUPPORTED = 0x0004,
00144 
00145    /* Authenticated CI+ module is in the slot */
00146    CIP_SLOT_STATUS_CI_PLUS_MODULE = 0x0008,
00147 
00148    /* Transport stream is allowed to be routed through the module */
00149    CIP_SLOT_STATUS_SERVICE_ALLOWED = 0x0010
00150 } E_CIP_SLOT_STATUS;
00151 
00152 typedef enum
00153 {
00154    CIP_TUNER_LOCKED,                /* Tuner has locked */
00155    CIP_TUNER_NOTLOCKED,             /* Tuner failed to lock */
00156    CIP_TUNER_BUSY,                  /* Tuner isn't available for use */
00157    CIP_TUNER_UNSUPPORTED_SYSTEM,    /* Tuner type isn't supported */
00158    CIP_TUNER_BAD_PARAM,             /* Tuning with invalid tuning parameter */
00159    CIP_TUNER_SERVICE_NOT_FOUND,     /* Tune to unknown service */
00160    CIP_TUNER_UNDEFINED_ERROR        /* Any other errors */
00161 } E_CIP_TUNE_STATUS;
00162 
00163 typedef enum
00164 {
00165    CIP_OPERATOR_SEARCH_DEFERRED,
00166    CIP_OPERATOR_SEARCH_IMMEDIATE,
00167    CIP_OPERATOR_SEARCH_SCHEDULED
00168 } E_CIP_OPERATOR_SEARCH_REQUEST_TYPE;
00169 
00170 /*---Global type defs for public use-------------------------------------------*/
00171 typedef struct ci_tune_service_info
00172 {
00173    U16BIT nid; /* network id */
00174    U16BIT onid; /* original network id */
00175    U16BIT tsid; /* transport stream id */
00176    U16BIT sid;  /* service id */
00177 } S_CIP_TUNE_SERVICE_INFO;
00178 
00179 typedef struct ci_tune_del_sys_desc
00180 {
00181    SI_DELIVERY_SYS_DESC_TYPE type;
00182    SI_DELIVERY_SYS_DESC *desc;
00183    U16BIT service_id;
00184    U8BIT *pmt;
00185    U8BIT service_type;
00186    SI_STRING_DESC *service_name;
00187    SI_SHORT_EVENT_DESC *event_desc;
00188 } S_CIP_TUNE_DEL_SYS_DESC;
00189 
00190 typedef struct ci_operator_nit
00191 {
00192    U16BIT cicam_onet_id;
00193    U32BIT cicam_identifier;
00194    U32BIT lang_code;
00195    U8BIT profile_name_length;
00196    U8BIT *profile_name;
00197    SI_NIT_TABLE *table;
00198 } S_CIP_OPERATOR_NIT;
00199 
00200 typedef struct ci_host_info
00201 {
00202    BOOLEAN standby;
00203    U8BIT num_service_types;
00204    U32BIT service_types;
00205    U16BIT delivery_types;
00206    U16BIT app_types;
00207 } S_CIP_HOST_INFO;
00208 
00209 typedef struct ci_operator_info
00210 {
00211    U16BIT cicam_onet_id;
00212    U32BIT cicam_identifier;
00213 } S_CIP_OPERATOR_INFO;
00214 
00215 typedef struct ci_operator_search
00216 {
00217    E_CIP_OPERATOR_SEARCH_REQUEST_TYPE refresh_request;
00218    U16BIT refresh_date;
00219    U8BIT refresh_hour;
00220    U8BIT refresh_min;
00221 } S_CIP_OPERATOR_SEARCH;
00222 
00223 typedef struct ci_licence_update
00224 {
00225    U8BIT slot_id;
00226    U8BIT cicam_id[8];
00227    U8BIT cicam_id_len;
00228    U8BIT raw_uri[CIP_URI_LEN];
00229    U8BIT *licence;
00230    U16BIT licence_len;
00231 } S_CIP_LICENCE_UPDATE;
00232 
00233 typedef struct ci_query_param
00234 {
00235    E_CI_QUERY query;
00236    U32BIT module;
00237    union
00238    {
00239       S_CIP_TUNE_SERVICE_INFO tune_service;
00240       S_CIP_TUNE_DEL_SYS_DESC tune_del_sys;
00241       S_CIP_OPERATOR_NIT nit;
00242       S_CIP_HOST_INFO host_info;
00243       S_CIP_OPERATOR_SEARCH op_search;
00244       S_CIP_OPERATOR_INFO op_info;
00245       S_CIP_LICENCE_UPDATE licence_info;
00246    } u;
00247 } S_CIP_QUERY_PARAM;
00248 
00249 typedef struct
00250 {
00251    U32BIT module;
00252    U8BIT reply;
00253 } S_CIP_RELEASE_REPLY;
00254 
00255 typedef U32BIT (*F_CIP_CALLBACK)(S_CIP_QUERY_PARAM *);
00256 
00257 /*---Global Function prototypes for public use---------------------------------*/
00258 
00263 void CIP_OpenEngine(F_CIP_CALLBACK callback );
00264 
00269 void CIP_EnterCIMenu(U8BIT slot_id);
00270 
00277 U8BIT* CIP_GetCIModuleName(U8BIT slot_id);
00278 
00285 U8BIT CIP_GetCIScreenType(U8BIT slot_id);
00286 
00292 U8BIT* CIP_GetCIMenuScreenTitle(U8BIT slot_id);
00293 
00299 U8BIT* CIP_GetCIMenuScreenSubtitle(U8BIT slot_id);
00300 
00306 U8BIT CIP_GetCIMenuScreenNumItems(U8BIT slot_id);
00307 
00314 U8BIT* CIP_GetCIMenuScreenItemText(U8BIT slot_id, U8BIT item);
00315 
00321 U8BIT* CIP_GetCIMenuScreenBottomText(U8BIT slot_id);
00322 
00328 void CIP_SetCIMenuScreenResponse(U8BIT slot_id, U8BIT response);
00329 
00335 U8BIT* CIP_GetCIEnquiryScreenText(U8BIT slot_id);
00336 
00343 U8BIT CIP_GetCIEnqScreenHideResponse(U8BIT slot_id);
00344 
00350 U8BIT CIP_GetCIEnqScreenResponseLength(U8BIT slot_id);
00351 
00359 void CIP_SetCIEnquiryScreenResponse(U8BIT slot_id, U8BIT ok_cancel,
00360    U8BIT *response_str_ptr);
00361 
00367 U8BIT CIP_GetCIScreenCloseDelay(U8BIT slot_id);
00368 
00373 void CIP_CloseCIScreen(U8BIT slot_id);
00374 
00379 void CIP_SetHostCountryCode(U32BIT code);
00380 
00385 void CIP_SetHostLanguageCode(U32BIT code);
00386 
00399 void CIP_SetDisplayCharacterTables(U8BIT *tables, U16BIT len);
00400 
00413 void CIP_SetInputCharacterTables(U8BIT *tables, U16BIT len);
00414 
00423 U16BIT CIP_GetSlotStatus(U8BIT slot_id, U8BIT *pmt,
00424    U8BIT *ci_protection_descriptor);
00425 
00431 BOOLEAN CIP_IsConditionalAccessUsed(U8BIT *pmt);
00432 
00438 void CIP_ReportPmt(U8BIT slot_id, U8BIT *pmt);
00439 
00447 void CIP_GetUsageRulesInfo(U8BIT slot_id, U16BIT service_id,
00448                            U8BIT uri[CIP_URI_LEN]);
00449 
00454 void CIP_GetDefaultUsageRulesInfo(U8BIT raw_uri[CIP_URI_LEN]);
00455 
00462 void CIP_UpdateUsageRules(U8BIT orig_uri[CIP_URI_LEN],
00463                           U8BIT new_uri[CIP_URI_LEN]);
00464 
00470 U32BIT CIP_GetRetentionLimit(U8BIT uri[CIP_URI_LEN]);
00471 
00476 void CIP_ApplyUsageRulesInfo(U8BIT *uri);
00477 
00482 void CIP_ApplyUsageRulesInfoForPlayback(U8BIT *uri);
00483 
00488 void CIP_ApplyCCKeys(U8BIT path);
00489 
00494 void CIP_ClearCCKeys(U8BIT path);
00495 
00500 BOOLEAN CIP_IsHDCPRequired(U16BIT service_id);
00501 
00505 void CIP_AppStopped(void);
00506 
00512 U8BIT CIP_GetSlotIdForModule(U32BIT module);
00513 
00521 BOOLEAN CIP_TuneReply(U8BIT path, U32BIT module, E_CIP_TUNE_STATUS status);
00522 
00529 BOOLEAN CIP_AskRelease(U32BIT module);
00530 
00536 BOOLEAN CIP_RequestOperatorStatus(U32BIT module);
00537 
00542 BOOLEAN CIP_OperatorExit(void);
00543 
00549 BOOLEAN CIP_StartOperatorSearch(U32BIT module);
00550 
00556 void CIP_SetRecordOperatingMode(U8BIT slot_id, U8BIT mode, U16BIT service_id);
00557 
00565 BOOLEAN CIP_SendRecordStart(U8BIT slot_id, U16BIT program_number, U8BIT *pin_string);
00566 
00572 BOOLEAN CIP_SendRecordStop(U8BIT slot_id);
00573 
00583 BOOLEAN CIP_SendPlaybackLicence(U8BIT slot_id, U16BIT program_number, U8BIT *licence,
00584    U16BIT licence_len);
00585 
00594 U8BIT *CIP_GetRecordingLicence(U8BIT slot_id, U8BIT * licence_status, U16BIT * licence_len,
00595                                U8BIT raw_uri[CIP_URI_LEN]);
00596 
00605 U8BIT *CIP_GetPlaybackLicence(U8BIT slot_id, U8BIT * licence_status, U16BIT * licence_len,
00606                               U8BIT raw_uri[CIP_URI_LEN]);
00607 
00614 void CIP_SendCicamLicenceStatus(U8BIT slot_id, U32BIT status);
00615 
00622 BOOLEAN CIP_GetCicamId(U8BIT slot_id, U8BIT cicam_id[8]);
00623 
00629 U8BIT CIP_FindSlotForCicamId(U8BIT cicam_id[8]);
00630 
00639 BOOLEAN CIP_CheckCicamPin(U8BIT slot_id, U8BIT *pin_data);
00640 
00653 BOOLEAN CIP_GetRecordingPinInfo(U8BIT slot_id, U8BIT *status, U8BIT *age_rating,
00654    U8BIT **private_data, U16BIT *date_code, U8BIT *hour, U8BIT *min, U8BIT *sec);
00655 
00663 BOOLEAN CIP_SendPinPlayback(U8BIT slot_id, U8BIT age_rating, U8BIT *private_data);
00664 
00665 #endif /* CI_PLUS_CONTROL_H */
00666 
00667 /******************************************************************************
00668 ** End of file
00669 ******************************************************************************/
 All Data Structures Files Functions Typedefs Defines