Example #1
0
cc_rcs_t
sub_send_msg (cprBuffer_t buf, uint32_t cmd, uint16_t len, cc_srcs_t dst_id)
{
    cpr_status_e rc;

    CC_DEBUG_MSG sub_print_msg((char *)buf, len);

    switch (dst_id) {
    case CC_SRC_GSM:
        rc = gsm_send_msg(cmd, buf, len);
        if (rc == CPR_FAILURE) {
            cprReleaseBuffer(buf);
        }
        break;
    case CC_SRC_SIP:
        rc = SIPTaskSendMsg(cmd, buf, len, NULL);
        if (rc == CPR_FAILURE) {
            cprReleaseBuffer(buf);
        }
        break;
    case CC_SRC_MISC_APP:
        rc = MiscAppTaskSendMsg(cmd, buf, len);
        if (rc == CPR_FAILURE) {
            cprReleaseBuffer(buf);
        }
        break;
    default:
        rc = CPR_FAILURE;
        break;
    }

    return (rc == CPR_SUCCESS) ? CC_RC_SUCCESS : CC_RC_ERROR;
}
Example #2
0
cc_rcs_t
sub_send_msg (cprBuffer_t buf, uint32_t cmd, uint16_t len, cc_srcs_t dst_id)
{
    cpr_status_e rc;

    /* This buffer is assumed to be at least of size int */
    MOZ_ASSERT(len >= sizeof(int));
    if (len < sizeof(int)) {
        return CC_RC_ERROR;
    }

    CC_DEBUG_MSG sub_print_msg((char *)buf, len);

    switch (dst_id) {
    case CC_SRC_GSM:
        rc = gsm_send_msg(cmd, buf, len);
        if (rc == CPR_FAILURE) {
            cpr_free(buf);
        }
        break;
    case CC_SRC_SIP:
        rc = SIPTaskSendMsg(cmd, buf, len, NULL);
        if (rc == CPR_FAILURE) {
            cpr_free(buf);
        }
        break;
    case CC_SRC_MISC_APP:
        rc = MiscAppTaskSendMsg(cmd, buf, len);
        if (rc == CPR_FAILURE) {
            cpr_free(buf);
        }
        break;
    default:
        rc = CPR_FAILURE;
        break;
    }

    return (rc == CPR_SUCCESS) ? CC_RC_SUCCESS : CC_RC_ERROR;
}