kb_machblue_tv_mix.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:15k
- //*****************************************************************************
- //File Name: kb_machblue_tv_mix.c
- //
- //Description: event function
- //
- // used by Machblue to initialize or delete the tv porting layer
- // and other funs
- //
- //Author: steven
- //
- //Date: 2007.01.20
- //
- //Version: v1.0
- //*****************************************************************************
- #include "stdlib.h"
- #include "machblue_defines.h"
- #include "machblue_porting_core.h"
- #include "machblue_tv_defines.h"
- #include "machblue_tv_customer.h"
- #include "kb_machblue_client_data.h"
- #include "kb_machblue_client_define.h"
- /**
- * Invoked by Machblue to initialize the tv porting layer. This
- * will be called before any calls to the tv porting layer. After
- * this call Machblue expects that any asynchronous query will be perfomed
- * by the system with the shortest response time possible. On most systems
- * responding to these queries in a short time implies a heavy caching
- * of network signalization tables. This caching mechnism is supposed to be
- * enabled by the middleware at the latest before the completion of
- * mb_tv_porting_layer_init.
- * tv_notify_f < machblue tv notification function that will be called for all asynchronous notifications >
- * nf_client_data < notification function client data to pass as-is to the notification function >
-
- * @return MB_SUCCESS on success, MB_FAILURE on failure.
- */
- mb_error_t mb_tv_porting_layer_init(mb_tv_notify_f *tv_notify_f,void *nf_client_data)
- {
- if(tv_notify_f==NULL||nf_client_data==NULL)
- {
- mb_printf("n[Machblue]:TV porting layer init NULL.");
- return MB_FAILURE;
- }
- //set notification data
- kb_mb_notification_set(tv_notify_f,nf_client_data);
- //init data
- kb_mb_service_list_init();
- kb_mb_service_context_init();
- kb_mb_editinfo_init();
- return MB_SUCCESS;
- }
- /**
- * Invoked by Machblue to delete the tv porting layer. Machblue will
- * not make any calls to the tv porting layer after this call
- * @return MB_SUCCESS on success, MB_FAILURE on failure.
- */
- mb_error_t mb_tv_porting_layer_delete(void)
- {
- //delete data
- return MB_SUCCESS;
- }
- /**
- * This function returns the currently selected screen
- * language, as an ISO 639 language code string. The platform
- * can also provides live notification of screen language changes
- * through the MB_TV_NR_LANGUAGE_CHANGED notification event.
- * @see MB_TV_NR_LANGUAGE_CHANGED
-
- * language < user provided string pointer to update, the string is at least MB_TV_LANGUAGE_STRING_LENGTH long >
-
- * @return MB_SUCCESS on success, MB_FAILURE otherwise.
- */
- mb_error_t mb_tv_screen_language_get(mb_char_t *language)
- {
- if(language==NULL)
- {
- mb_printf("n[Machblue]:TV get screen language NULL.");
- return MB_FAILURE;
- }
-
- mb_memcpy(language,"chi", MB_TV_LANGUAGE_LENGTH);
- return MB_SUCCESS;
- }
- /**
- * This function returns the default screen language, as an ISO 639 language
- * code string. The default language is a system-wide fall-back language
- * value.
- * language < user provided string pointer to update,
- the string is at least MB_TV_LANGUAGE_STRING_LENGTH long >
-
- * @return MB_SUCCESS on success, MB_FAILURE otherwise.
- */
- mb_error_t mb_tv_default_screen_language_get(mb_char_t *language)
- {
- if(language==NULL)
- {
- mb_printf("n[Machblue]:TV get default screen language NULL.");
- return MB_FAILURE;
- }
-
- mb_memcpy(language,"chi", MB_TV_LANGUAGE_LENGTH);
- return MB_SUCCESS;
- }
- /**
- * This function returns the current rating block, as a string, formatted
- * for display purposes using the local standards for displaying program ratings.
- * ratings < user provided string pointer to update, the string is at least MB_TV_RATING_STRING_LENGTH long >
-
- * @return MB_SUCCESS on success, MB_FAILURE otherwise.
- */
- mb_error_t mb_tv_rating_block_get(mb_char_t *ratings)
- {
- mb_char_t ratStr[MB_TV_RATING_LENGTH];
- if(ratings==NULL)
- {
- mb_printf("n[Machblue]:TV get rating block NULL.");
- return MB_FAILURE;
- }
- //itoa(1,ratStr,10);
-
- mb_memcpy(ratings,ratStr,MB_TV_RATING_LENGTH);
- return MB_SUCCESS;
- }
- /**
- * This function retrieves a given asset authorization flags.
- * Note that services and program events have their own
- * authorization methods. This method is useful if an application
- * is using the conditional access system for something other than a
- * service or a program event, such as an interactive service.
- * The list of authorization flags is enumerated in
- * mb_tv_authorization_flag_t.
- * @see mb_tv_authorization_flag_t
- * asset_id < id of the assets to check >
- * auth_flags < pointer to asset authorization flags to update @see mb_tv_authorization_flag_t >
-
- * @return MB_SUCCESS on success, MB_FAILURE otherwise.
- */
- mb_error_t mb_tv_asset_auth_flags_get(const mb_char_t *asset_id,unsigned int *auth_flags)
- {
- if(auth_flags==NULL||asset_id==NULL)
- {
- mb_printf("n[Machblue]:TV get asset auth flag NULL.");
- return MB_FAILURE;
- }
- *auth_flags=MB_TV_AF_AUTHORIZED;
- return MB_SUCCESS;
- }
- /**
- * This function attempts to purchase the specified asset.
- * This operation is ASYNCHRONOUS, and may imply a roundtrip
- * to the head-end for a credit check and actual processing.
- * It is expected that any user intervention, in the form of
- * a confirmation, has been done prior to calling this method.
- * @see MB_TV_NR_ASSET_PURCHASE_STATUS
- * asset_id < id of the assets to purchase >
-
- * @return MB_SUCCESS on success, MB_FAILURE otherwise.
- */
- mb_error_t mb_tv_asset_purchase(const mb_char_t *asset_id)
- {
- return MB_SUCCESS;
- }
- /**
- * This function validates the specified PIN. This method will
- * cause the system to display a standard PIN entry form, and
- * ask the subscriber to enter the appropriate PIN.
- *
- * This method is ASYNCHRONOUS. The system should send an
- * MB_TV_NR_PIN_VALIDATION_STATUS notification on completion of the
- * request.The MB_TV_NR_PIN_VALIDATION_STATUS event contains a
- * field indicating the success of the operation.
- * @see MB_TV_NR_PIN_VALIDATION_STATUS
- * pin_type < pin type to validate >
-
- * @return MB_SUCCESS on success, MB_FAILURE otherwise.
- */
- mb_error_t mb_tv_pin_validate(mb_tv_pin_type_t pin_type)
- {
- mb_error_t retval = MB_FAILURE;
- mb_args_t args;
-
- mb_printf("%s::mb_tv_pin_validate(): Invoke ...");
- //UpdateDeviceTime();
- // Display a form screen for PIN
- // Validation of pin
- retval = MB_SUCCESS;
- MB_TV_PIN_VALIDATION_TYPE_ARG(&args) = pin_type;
- MB_TV_STATUS_ARG(&args) = retval;
- //MBTV_InvokeTVCallbackFunction(reason, &args);
- mb_printf("");
- return(retval);
- }
- /**
- * This function retrieves device info from the system.
- * device_info < device info structure to update >
-
- * @return MB_SUCCESS on success, MB_FAILURE otherwise.
- */
- mb_error_t mb_tv_device_info_get(mb_tv_device_info_t *device_info)
- {
- if(device_info==NULL)
- {
- mb_printf("n[Machblue]:TV get device information NULL.");
- return MB_FAILURE;
- }
-
- mb_memcpy(device_info->manufacturer,"keybridge",9);
- mb_memcpy(device_info->model,"vlink1000",9);
- mb_memcpy(device_info->os_name,"OS20",4);
- mb_memcpy(device_info->os_version,"R2.2.1",6);
- mb_memcpy(device_info->resident_app,"Ver1.0",6);
- mb_memcpy(device_info->unique_id,"1",1);
- mb_memcpy(device_info->mac_address,"FFFFFFFF",8);
- mb_memcpy(device_info->ip_address,"127.0.0.1",9);
- mb_memcpy(device_info->extra_info," ",1);
- device_info->capabilities=MB_TV_SCALED_VIDEO_CAP;
- return MB_SUCCESS;
- }
- /**
- * This function retrieves the current device state
- * from the system.
- * device_state < device state enum to update >
-
- * @return MB_SUCCESS on success, MB_FAILURE otherwise.
- */
- mb_error_t mb_tv_device_state_get(mb_tv_device_state_t *device_state)
- {
- if(device_state==NULL)
- {
- mb_printf("n[Machblue]:TV get device state NULL.");
- return MB_FAILURE;
- }
-
- *device_state=MB_TV_POWER_ON_STATE;
- return MB_SUCCESS;
- }
- /**
- * @brief Returns a string representing the value of a device component parameter.
- *
- * Returns a string representing the value of a device component parameter.
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_device_param_get
- (
- const mb_char_t *component_name,/**< - The string representing the name of
- the device component to query.
- The string is at most #MB_TV_DEVICE_PARAM_COMP_LENGTH long, including the NULL terminating character. */
- const mb_char_t *param_name, /**< - The string representing the name of the component parameter to query.
- The string is at most #MB_TV_DEVICE_PARAM_NAME_LENGTH long, including the NULL terminating character. */
- mb_char_t *param_value, /**< - The user-provided address of a string buffer to update. The buffer must be at least #MB_TV_DEVICE_PARAM_VALUE_LENGTH long. The string written into it will be NULL terminated.*/
- int *platform_error_code /**< - The platform-specific error code. */
- )
- {
- return MB_SUCCESS;
- }
- /**
- * @brief Sets a device component parameter value.
- *
- * Sets a device component parameter value.
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_device_param_set
- (
- const mb_char_t *component_name,/**< - The string representing the name of
- the device component to configure.
- The string is at most #MB_TV_DEVICE_PARAM_COMP_LENGTH long. */
- const mb_char_t *param_name, /**< - The string representing the name of the component parameter to set.
- The string is at most #MB_TV_DEVICE_PARAM_NAME_LENGTH long. */
- const mb_char_t *param_value, /**< - The string representing the value of the component parameter to set.
- The string is at most #MB_TV_DEVICE_PARAM_VALUE_LENGTH long. */
- int *platform_error_code /**< - The platform-specific error code. */
- )
- {
- return MB_SUCCESS;
- }
- #if MB_PLAYER_1_2
- /**
- * @brief This function specifies a list of conflicting objects to delete in order to resolve the specified conflict.
- *
- * This function specifies a list of conflicting objects to delete in order
- * to resolve the specified conflict.
- * The deleted objects are not released to the porting layer.
- * After a call to this function, the conflict descriptor is no longer valid,
- * even if the list is empty or NULL (and @e item_count is zero).
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_conflict_resolve
- (
- mb_tv_conflict_t conflict, /**< - The conflict to resolve. */
- mb_tv_conflict_item_t *conflict_item_list, /**< - The list of conflicting items to delete
- to solve the conflict. */
- int item_count /**< - The number of conflict items in the list. */
- )
- {
- return MB_SUCCESS;
- }
- /**
- * @brief This function asynchronously retrieves conflict items.
- *
- * This function asynchronously retrieves conflict items from the system.
- * The system should send an
- * #MB_TV_NR_CONFLICT_ITEMS_GET notification once the request has been completed.
- * @see MB_TV_NR_CONFLICT_ITEMS_GET
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_conflict_items_get
- (
- mb_tv_conflict_t conflict, /**< - The conflict to query. */
- int *item_count, /**< - The pointer to number of conflict items to retrieve. This
- pointer should be updated with number of items
- actually retrieved. */
- mb_tv_conflict_item_t *conflict_item_list /**< - The list of conflicting items. */
- )
- {
- return MB_SUCCESS;
- }
- /**
- * @brief This function returns the number of items that are contributing to the conflict.
- *
- * This function returns the number of items that are contributing to the conflict.
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_conflict_items_count_get
- (
- mb_tv_conflict_t conflict, /**< - The conflict to query. */
- int *conflict_items_count /**< - The user-provided integer to store the conflict items count. */
- )
- {
- return MB_SUCCESS;
- }
- /**
- * @brief This function gets the system's purchase credit information.
- *
- * This function gets the system's purchase credit information.
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_purchase_credit_get
- (
- int *credit /**< - The pointer to integer to store remaining purchase credit. */
- )
- {
- return MB_SUCCESS;
- }
- /**
- * @brief This function retrieves the number of purchased items available in the system purchase list.
- *
- * This function retrieves the number of purchased items available
- * in the system purchase list.
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_purchased_item_count_get
- (
- int *item_count /**< - The pointer to the integer to store purchase item count. */
- )
- {
- return MB_SUCCESS;
- }
- /**
- * @brief This function asynchronously retrieves purchase items from the system.
- *
- * This function asynchronously retrieves purchase items from the system.
- * The system should send an
- * #MB_TV_NR_PURCHASED_ITEMS_GET notification once the request has been completed.
- * @see #MB_TV_NR_PURCHASED_ITEMS_GET
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_purchased_items_get
- (
- int first_item_pos, /**< - The position of the first purchase item to get (0 based). */
- int *item_count, /**< - The pointer to the number of purchase items to retrieve. This
- pointer should be updated with the number of items
- actually retrieved. */
- mb_tv_purchased_item_t *item_list /**< - The pointer to the list of items to update. */
- )
- {
- return MB_SUCCESS;
- }
- /**
- * @brief This function gets a service context volume level.
- *
- * This function gets a service context volume level.
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_svc_volume_get
- (
- mb_tv_service_context_t svc, /**< - The service context to query. */
- int *volume /**< - The pointer to the volume level to update. The volume level
- values should be between 0 and 100. */
- )
- {
- return MB_SUCCESS;
- }
- /**
- * @brief This function sets a service context volume level.
- *
- * This function sets a service context volume level.
- * @return @li MB_SUCCESS on success. @li MB_FAILURE on failure.
- */
- mb_error_t mb_tv_svc_volume_set
- (
- mb_tv_service_context_t svc, /**< - The service context to modify. */
- int volume /**< - The volume level to set. The volume level
- values should be between 0 and 100. */
- )
- {
- return MB_SUCCESS;
- }
- #endif