Ejemplo n.º 1
0
struct cfw_message * cfw_clone_message(struct cfw_message * msg) {
    struct cfw_message * ret = (struct cfw_message *)
            message_alloc(CFW_MESSAGE_LEN(msg), NULL);
    if (ret == NULL) {
        pr_error(LOG_MODULE_CFW, "%s: Error allocating message", __func__);
    } else {
		memcpy(ret, msg, CFW_MESSAGE_LEN(msg));
    }
    return ret;
}
Ejemplo n.º 2
0
struct cfw_message * cfw_alloc_evt_msg(service_t *svc, int msg_id, int size) {
    struct cfw_message * evt = (struct cfw_message *) cfw_alloc_message(size, NULL);
    CFW_MESSAGE_TYPE(evt) = TYPE_EVT;
    CFW_MESSAGE_ID(evt) = msg_id;
    CFW_MESSAGE_LEN(evt) = size;
    CFW_MESSAGE_SRC(evt) = svc->port_id;
    /* 3 fields below whould be filed by send_event method*/
    CFW_MESSAGE_DST(evt) = 0;
    evt->priv = NULL;
    evt->conn = NULL;
    return evt;
}
Ejemplo n.º 3
0
struct cfw_message * cfw_alloc_internal_msg(int msg_id, int size, void * priv) {
    struct cfw_message * evt = (struct cfw_message *) cfw_alloc_message(size, NULL);
    CFW_MESSAGE_TYPE(evt) = TYPE_INT;
    CFW_MESSAGE_ID(evt) = msg_id;
    CFW_MESSAGE_LEN(evt) = size;
    CFW_MESSAGE_SRC(evt) = 0;
    /* 3 fields below whould be filed by send_event method*/
    CFW_MESSAGE_DST(evt) = 0;
    evt->priv = priv;
    evt->conn = NULL;
    return evt;
}
Ejemplo n.º 4
0
fsm_state_t act_start_done(struct fsm_event_message * evt)
{
    pr_info(LOG_MODULE_NFC, "NFC RF active!");
    {
        struct cfw_message evt;
        CFW_MESSAGE_ID(&evt) = MSG_ID_NFC_RF_EVT;
        CFW_MESSAGE_TYPE(&evt) = TYPE_EVT;
        CFW_MESSAGE_LEN(&evt) = sizeof(evt);
        CFW_MESSAGE_SRC(&evt) = _cfw_get_service_port(NFC_SERVICE_ID);
        cfw_send_event(&evt);
    }
    process_pending_msg_cb(NFC_STATUS_SUCCESS);
    return ST_ACTIVE;
}
Ejemplo n.º 5
0
struct cfw_rsp_message * cfw_alloc_rsp_msg(const struct cfw_message *req, int msg_id, int size) {
    struct cfw_rsp_message * rsp = (struct cfw_rsp_message *) cfw_alloc_message(size, NULL);
    CFW_MESSAGE_TYPE(&rsp->header) = TYPE_RSP;
    CFW_MESSAGE_ID(&rsp->header) = msg_id;
    CFW_MESSAGE_LEN(&rsp->header) = size;
    CFW_MESSAGE_DST(&rsp->header) = CFW_MESSAGE_SRC(req);
    CFW_MESSAGE_SRC(&rsp->header) = CFW_MESSAGE_DST(req);
    rsp->header.priv = req->priv;
    /* Substitute server-side with client-side conn */
    if (req->conn != NULL)
        rsp->header.conn = ((conn_handle_t*)req->conn)->client_handle;
    else
        rsp->header.conn = NULL;
    return rsp;
}
Ejemplo n.º 6
0
static void send_service_avail_evt(int service_id, uint16_t port_id, void *param)
{
	cfw_svc_available_evt_msg_t * evt =
            (cfw_svc_available_evt_msg_t*) balloc(sizeof(*evt), NULL);
    evt->service_id = service_id;
    CFW_MESSAGE_LEN(&evt->header) = sizeof(*evt);
    CFW_MESSAGE_ID(&evt->header) = MSG_ID_CFW_SVC_AVAIL_EVT;
    CFW_MESSAGE_SRC(&evt->header) = service_mgr_port_id;
    CFW_MESSAGE_DST(&evt->header) = port_id;
    CFW_MESSAGE_TYPE(&evt->header) = TYPE_EVT;
    evt->header.priv = param;

    pr_debug(LOG_MODULE_MAIN, "Notify : %d to %d", service_id, port_id);
    cfw_send_message(evt);
}