コード例 #1
0
/****************************************************************************
* NAME    
*   AvrcpGetElementAttributesResponse    
*
* DESCRIPTION
*   Internal function for AvrcpGetCapabilitiesResponse
*
* RETURNS
*    void
*******************************************************************************/
void avrcpHandleInternalGetElementAttributesResponse(AVRCP      *avrcp, 
                   AVRCP_INTERNAL_GET_ELEMENT_ATTRIBUTES_RES_T  *res)
{
    uint16 size_mandatory_data = 1; /* Just error code for failure */
    uint8 mandatory_data[1];
    uint16 param_length = 1;

    /* Get the error status code */
    mandatory_data[0] = avrcpGetErrorStatusCode(&res->response, 
                                                AVRCP0_CTYPE_STATUS);

    if (res->response == avctp_response_stable)
    {
        param_length = size_mandatory_data + res->size_attributes_list;

        /* Insert the right mandatory data */
        mandatory_data[0] = res->number_of_attributes;
    }

    prepareMetadataStatusResponse(  avrcp, 
                                    res->response, 
                                    AVRCP_GET_ELEMENT_ATTRIBUTES_PDU_ID, 
                                    param_length, 
                                    res->attributes_list, 
                                    size_mandatory_data, 
                                    mandatory_data);
}
コード例 #2
0
void avrcpHandleInternalGetPlayStatusResponse(AVRCP *avrcp,
                     AVRCP_INTERNAL_GET_PLAY_STATUS_RES_T *res)
{
    uint16 size_mandatory_data = 1;
    uint8 mandatory_data[9];
    uint16 param_length = 1;

    mandatory_data[0] = avrcpGetErrorStatusCode(&res->response, 
                                                AVRCP0_CTYPE_STATUS);

    if (res->response == avctp_response_stable)
    {
        size_mandatory_data = 9;
        param_length = size_mandatory_data;
        /* Insert the mandatory data */
        convertUint32ToUint8Values(&mandatory_data[0], res->song_length);
        convertUint32ToUint8Values(&mandatory_data[4], res->song_elapsed);
        mandatory_data[8] = res->play_status;
    }

    avrcpSendMetadataResponse(avrcp,  res->response, 
                              AVRCP_GET_PLAY_STATUS_PDU_ID, 0, 
                              avrcp_packet_type_single, param_length, 
                              size_mandatory_data, mandatory_data);

}
コード例 #3
0
/****************************************************************************
 *NAME    
 *    avrcpHandleInternalSetAppValueResponse    
 *
 *DESCRIPTION
 *  Send SetPlayerApplicationValues response to CT. 
 *
 *PARAMETERS
 *  AVRCP       -  AVRCP Instance
 *  res         -  Application response. 
 ****************************************************************************/
void avrcpHandleInternalSetAppValueResponse(AVRCP *avrcp, 
               AVRCP_INTERNAL_SET_APP_VALUE_RES_T *res)
{
    uint8 mandatory_data[1];

    mandatory_data[0] = avrcpGetErrorStatusCode(&res->response, 
                                                AVRCP0_CTYPE_CONTROL);

    avrcpSendMetadataResponse(avrcp,  res->response, 
                              AVRCP_SET_APP_VALUE_PDU_ID, 0, 
                              avrcp_packet_type_single, 
                              AVRCP_ERROR_CODE_SIZE, AVRCP_ERROR_CODE_SIZE, 
                              mandatory_data);

}
コード例 #4
0
void sendRegisterNotificationResponse(  AVRCP               *avrcp, 
                                        avrcp_response_type resp, 
                                        uint16              size_mandatory, 
                                        uint8               *mandatory, 
                                        uint16              size_attributes, 
                                        Source              attributes)
{
    /* 1 byte error status code as data for rejected response */ 
    uint8  error_data[1];
    uint16 param_length = 1;
    avrcp_packet_type  metadata_packet_type =  avrcp_packet_type_single;

   /* Get the error status code */
    error_data[0] = avrcpGetErrorStatusCode(&resp, AVRCP0_CTYPE_NOTIFY);

    if ((resp == avctp_response_interim) || (resp == avctp_response_changed))
    {
        param_length = size_mandatory + size_attributes;
    }
    else
    {
        size_mandatory = 1; /*  1 octet length only for error code */
        mandatory = &error_data[0];
    }

    
    if (param_length > AVRCP_AVC_MAX_DATA_SIZE)
    {        
        /* There are more fragments to be sent, 
            store the data for the following fragments. */

        /* madatory[0] contains the event ID */
        avrcpStoreNextContinuationPacket(avrcp, attributes, 
                                param_length-AVRCP_AVC_MAX_DATA_SIZE, 
                                AVRCP_REGISTER_NOTIFICATION_PDU_ID, 
                                resp, 
                                GetNotificationTransaction(avrcp, mandatory[0]));

        param_length = AVRCP_AVC_MAX_DATA_SIZE;
        metadata_packet_type = avrcp_packet_type_start;
    }
    
    avrcpSendMetadataResponse(avrcp,  resp, AVRCP_REGISTER_NOTIFICATION_PDU_ID,
                              attributes, metadata_packet_type, param_length, 
                              size_mandatory, mandatory);

}
コード例 #5
0
/****************************************************************************
 *NAME    
 *    sendRegisterNotificationResponse    
 *
 *DESCRIPTION
 *   This function is used by the TG to send Register Notification response. 
 *
 *PARAMETERS
 * avrcp            - AVRCP instance
 * resp             - Response code
 * size_mandatory   - Data length in mandatory
 * mandatory        - It contains the library added response format header 
 * size_attributes  - Data length in attributes
 * attributes       - Application provided response data.
 ****************************************************************************/
void sendRegisterNotificationResponse(  AVRCP               *avrcp, 
                                        avrcp_response_type resp, 
                                        uint16              size_mandatory, 
                                        uint8               *mandatory, 
                                        uint16              size_attributes, 
                                        Source              attributes)
{
    /* 1 byte event and 1 byte error status code as data for 
       rejected response */ 
    uint8 error_data[AVRCP_DEFAULT_EVENT_DATA_SIZE];
    avrcp_packet_type  metadata_packet_type =  avrcp_packet_type_single;
    uint16 param_length=1;

    /* Clear the Notification if response is not interim*/
    if (resp != avctp_response_interim)
    {
        clearRegisterNotification(avrcp, mandatory[0]);
    }

   /* Standardise the response code */
    error_data[0] = avrcpGetErrorStatusCode(&resp, AVRCP0_CTYPE_NOTIFY);

    if(resp == avctp_response_rejected) 
    {
        size_mandatory = param_length;
        size_attributes = 0;
        error_data[1] = mandatory[0]; /* PDU ID will not be sent to the peer */
        mandatory = &error_data[0];
    }
    else
    {
        param_length = size_mandatory + size_attributes;
        if (param_length > avrcp->av_max_data_size)
        {
            /* Not expecting a event notification response with 
               Fragmenetation */
            Panic();        
        }
    }
    
    avrcpSendMetadataResponse(avrcp,  resp, AVRCP_REGISTER_NOTIFICATION_PDU_ID,
                              attributes, metadata_packet_type, param_length, 
                              size_mandatory, mandatory);


}
コード例 #6
0
/****************************************************************************
 *NAME    
 *    avrcpHandleInternalGetAppValueResponse    
 *
 *DESCRIPTION
 *  Send GetPlayerApplicationValues response to CT. 
 *
 *PARAMETERS
 *  AVRCP       -  AVRCP Instance
 *  res         -  Application response. 
 ****************************************************************************/
void avrcpHandleInternalGetAppValueResponse(AVRCP *avrcp,
               AVRCP_INTERNAL_GET_APP_VALUE_RES_T *res)
{
    uint8 mandatory_data[1];
    uint16 param_length = AVRCP_APP_NUM_ATTR_HDR_SIZE;

    mandatory_data[0] = avrcpGetErrorStatusCode(&res->response, 
                                                AVRCP0_CTYPE_STATUS);

    if (res->response == avctp_response_stable)
    {
        param_length += res->size_values_list;
        /* Insert the mandatory data */
        mandatory_data[0] = res->size_values_list/2;
    }

    prepareMetadataStatusResponse(avrcp, res->response,
                                 AVRCP_GET_APP_VALUE_PDU_ID, 
                                 param_length, res->values_list,
                                 AVRCP_APP_NUM_ATTR_HDR_SIZE, mandatory_data);
}
コード例 #7
0
/****************************************************************************
*NAME    
*    avrcpHandleInternalAbsoluteVolumeRsp    
*
*DESCRIPTION
*   Internal function at TG to send the notification for EVENT_VOLUME_CHANGED
*      
*PARAMETERS
*   avrcp                   - Task
*   res                     - response
*
*RETURN
******************************************************************************/
void avrcpHandleInternalAbsoluteVolumeRsp(AVRCP                 *avrcp,
                  const AVRCP_INTERNAL_SET_ABSOLUTE_VOL_RES_T   *res)
{
    uint8 mandatory_data[AVRCP_ERROR_CODE_SIZE]; /* 1 byte */
    avrcp_response_type response = res->response;

   /* Get the error status code */
    mandatory_data[0] = avrcpGetErrorStatusCode(&response,AVRCP0_CTYPE_CONTROL);

    if(response != avctp_response_rejected)
    {
        /* Not failure. Insert Volume instead */
        mandatory_data[0] = res->volume;
    }    
    
    /* Send a response to this PDU now. */
    avrcpSendMetadataResponse(avrcp, response,
                              AVRCP_SET_ABSOLUTE_VOLUME_PDU_ID,
                              0, avrcp_packet_type_single,
                              AVRCP_ERROR_CODE_SIZE , AVRCP_ERROR_CODE_SIZE,
                              mandatory_data);
}
コード例 #8
0
/****************************************************************************
 *NAME    
 *    avrcpHandleInternalListAppAttributesResponse   
 *
 *DESCRIPTION
 *  Send PlayerApplicationListAttributes response to CT. 
 *
 *PARAMETERS
 *  AVRCP       -  AVRCP Instance
 *  res         -  Response data from app.
 ****************************************************************************/
void avrcpHandleInternalListAppAttributesResponse(AVRCP *avrcp, 
                AVRCP_INTERNAL_LIST_APP_ATTRIBUTE_RES_T *res)
{
    uint16 size_mandatory_data = 1;
    uint8 mandatory_data[1];
    uint16 param_length = 1;

    mandatory_data[0] = avrcpGetErrorStatusCode(&res->response,
                                                 AVRCP0_CTYPE_STATUS);

    if (res->response == avctp_response_stable)
    {
        param_length += res->size_attributes_list;

        /* Insert the mandatory data */
        mandatory_data[0] = res->size_attributes_list;
    }

    prepareMetadataStatusResponse(avrcp, res->response,
                                 AVRCP_LIST_APP_ATTRIBUTES_PDU_ID,
                                 param_length, res->attributes_list,
                                 size_mandatory_data, mandatory_data);
}
コード例 #9
0
/****************************************************************************
 *NAME    
 *    avrcpHandleInternalGetAppAttributeTextResponse    
 *
 *DESCRIPTION
 *  Send GetApplicationAttributesText response to CT. 
 *
 *PARAMETERS
 *  AVRCP       -  AVRCP Instance
 *  res         -  Application response. 
 ****************************************************************************/
void avrcpHandleInternalGetAppAttributeTextResponse(AVRCP *avrcp,
             AVRCP_INTERNAL_GET_APP_ATTRIBUTES_TEXT_RES_T *res)
{
    uint8 mandatory_data[AVRCP_APP_NUM_ATTR_HDR_SIZE];
    uint16 param_length = AVRCP_APP_NUM_ATTR_HDR_SIZE;

    mandatory_data[0] = avrcpGetErrorStatusCode(&res->response, 
                                                AVRCP0_CTYPE_STATUS);

    if (res->response == avctp_response_stable)
    {
        param_length += res->size_attributes_list;
    
        /* Insert the mandatory data */

        mandatory_data[0] = res->number_of_attributes;
    }

    prepareMetadataStatusResponse(avrcp, res->response, 
                                  AVRCP_GET_APP_ATTRIBUTE_TEXT_PDU_ID, 
                                  param_length, res->attributes_list, 
                                  AVRCP_APP_NUM_ATTR_HDR_SIZE, 
                                  mandatory_data);
}