Пример #1
0
void wptc_enable_cfm_send(struct wptc_env_tag *wptc_env, struct prf_con_info *con_info, uint8_t status)
{
    //format response to app
    struct wptc_enable_cfm * cfm = KE_MSG_ALLOC(WPTC_ENABLE_CFM,
                                                 con_info->appid, con_info->prf_id,
                                                 wptc_enable_cfm);

    cfm->conhdl = gapc_get_conhdl(con_info->conidx);
    cfm->status = status;

    if (status == PRF_ERR_OK)
    {
        cfm->wpts = wptc_env->wpts;

        // Register WPT Client task in gatt for indication/notifications
        prf_register_atthdl2gatt(&wptc_env->con_info, &wptc_env->wpts.svc);


        // Go to connected state
        ke_state_set(con_info->prf_id, WPTC_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(wptc_envs, con_info->prf_id, WPTC);
    }

    ke_msg_send(cfm);
}
Пример #2
0
void glpc_enable_cfm_send(struct glpc_env_tag *glpc_env, struct prf_con_info *con_info, uint8_t status)
{
    // Send to APP the details of the discovered attributes on GLPS
    struct glpc_enable_cfm * rsp = KE_MSG_ALLOC(GLPC_ENABLE_CFM,
                                                con_info->appid, con_info->prf_id,
                                                glpc_enable_cfm);

    rsp->conhdl = gapc_get_conhdl(con_info->conidx);
    rsp->status = status;

    if (status == PRF_ERR_OK)
    {
        rsp->gls = glpc_env->gls;

        // Register GLPC task in gatt for indication/notifications
        prf_register_atthdl2gatt(&glpc_env->con_info, &glpc_env->gls.svc);

        // Go to connected state
        ke_state_set(con_info->prf_id, GLPC_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(glpc_envs, con_info->prf_id, GLPC);
    }

    ke_msg_send(rsp);
}
Пример #3
0
void basc_enable_cfm_send(struct basc_env_tag *basc_env, struct prf_con_info *con_info, uint8_t status)
{
    // Counter
    uint8_t svc_inst;

    // Send APP the details of the discovered attributes on BASC
    struct basc_enable_cfm * rsp = KE_MSG_ALLOC(BASC_ENABLE_CFM,
                                                con_info->appid, con_info->prf_id,
                                                basc_enable_cfm);

    rsp->conhdl = con_info->conhdl;
    rsp->status = status;

    if (status == PRF_ERR_OK)
    {
        rsp->bas_nb = basc_env->bas_nb;

        for (svc_inst = 0; svc_inst < basc_env->bas_nb; svc_inst++)
        {
            rsp->bas[svc_inst] = basc_env->bas[svc_inst];

            // Register BASC task in gatt for indication/notifications
            prf_register_atthdl2gatt(&basc_env->con_info, &basc_env->bas[svc_inst].svc);
        }

        // Go to connected state
        ke_state_set(con_info->prf_id, BASC_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(basc_envs, con_info->prf_id, BASC);
    }

    ke_msg_send(rsp);
}
Пример #4
0
void tipc_enable_cfm_send(struct tipc_env_tag *tipc_env, struct prf_con_info *con_info, uint8_t status)
{
    // Send to APP the details of the discovered attributes on TIPS
    struct tipc_enable_cfm * rsp = KE_MSG_ALLOC(TIPC_ENABLE_CFM,
                                                con_info->appid, con_info->prf_id,
                                                tipc_enable_cfm);

    rsp->conhdl = con_info->conhdl;
    rsp->status = status;

    if (status == PRF_ERR_OK)
    {
        rsp->cts    = tipc_env->cts;
        rsp->ndcs   = tipc_env->ndcs;
        rsp->rtus   = tipc_env->rtus;

        //register TIPC task in gatt for indication/notifications
        prf_register_atthdl2gatt(&tipc_env->con_info, &tipc_env->cts.svc);

        // Go to connected state
        ke_state_set(tipc_env->con_info.prf_id, TIPC_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(tipc_envs, con_info->prf_id, TIPC);
    }

    ke_msg_send(rsp);
}
Пример #5
0
void qppc_enable_cfm_send(struct qppc_env_tag *qppc_env, struct prf_con_info *con_info, uint8_t status)
{
    //send APP the details of the discovered attributes on QPPC
    struct qppc_enable_cfm * rsp = KE_MSG_ALLOC(QPPC_ENABLE_CFM,
                                   con_info->appid, con_info->prf_id,
                                   qppc_enable_cfm);

    rsp->conhdl = con_info->conhdl;
    rsp->status = status;

    if (status == PRF_ERR_OK)
    {
        rsp->qpps   = qppc_env->qpps;
        rsp->nb_ntf_char = qppc_env->nb_char - 1; // exclude one RX characteristic

        //register HRPC task in gatt for indication/notifications
        prf_register_atthdl2gatt(&qppc_env->con_info, &qppc_env->qpps.svc);

        // Go to connected state
        ke_state_set(qppc_env->con_info.prf_id, QPPC_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(qppc_env, con_info->prf_id, QPPC);
    }

    ke_msg_send(rsp);
}
Пример #6
0
void scppc_enable_cfm_send(struct scppc_env_tag *scppc_env, struct prf_con_info *con_info, uint8_t status)
{
    //send APP the details of the discovered attributes on SCPPC
    struct scppc_enable_cfm * rsp = KE_MSG_ALLOC(SCPPC_ENABLE_CFM,
                                                 con_info->appid, con_info->prf_id,
                                                 scppc_enable_cfm);

    rsp->conhdl = gapc_get_conhdl(con_info->conidx);
    rsp->status = status;

    if (status == PRF_ERR_OK)
    {
        rsp->scps = scppc_env->scps;

        // Go to connected state
        ke_state_set(con_info->prf_id, SCPPC_CONNECTED);

        // If Scan Refresh Char. has been discovered
        if (scppc_env->scps.chars[SCPPC_CHAR_SCAN_REFRESH].char_hdl != ATT_INVALID_HANDLE)
        {
            // Register SCPPC task in gatt for notifications
            prf_register_atthdl2gatt(con_info, &scppc_env->scps.svc);
        }
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(scppc_envs, con_info->prf_id, SCPPC);
    }

    ke_msg_send(rsp);
}
Пример #7
0
void proxm_enable_cfm_send(struct proxm_env_tag *proxm_env, struct prf_con_info *con_info, uint8_t status)
{
    //format response to app
    struct proxm_enable_cfm * cfm = KE_MSG_ALLOC(PROXM_ENABLE_CFM,
                                    con_info->appid, con_info->prf_id,
                                    proxm_enable_cfm);

    cfm->conhdl = gapc_get_conhdl(con_info->conidx);
    cfm->status = status;

    if (status == PRF_ERR_OK)
    {
        cfm->ias    = proxm_env->ias;
        cfm->lls    = proxm_env->lls;
        cfm->txps   = proxm_env->txps;

        // Go to connected state
        ke_state_set(con_info->prf_id, PROXM_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(proxm_envs, con_info->prf_id, PROXM);
    }

    ke_msg_send(cfm);
}
Пример #8
0
void blpc_enable_cfm_send(struct blpc_env_tag *blpc_env, struct prf_con_info *con_info, uint8_t status)
{
    // Send to APP the details of the discovered attributes on BLPS
    struct blpc_enable_cfm * rsp = KE_MSG_ALLOC(BLPC_ENABLE_CFM,
                                                con_info->appid, con_info->prf_id,
                                                blpc_enable_cfm);

    rsp->conhdl = gapc_get_conhdl(con_info->conidx);
    rsp->status = status;

    if (status == PRF_ERR_OK)
    {
        rsp->bps = blpc_env->bps;

        prf_register_atthdl2gatt(&blpc_env->con_info, &blpc_env->bps.svc);

        // Go to connected state
        ke_state_set(blpc_env->con_info.prf_id, BLPC_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(blpc_envs, con_info->prf_id, BLPC);
    }

    ke_msg_send(rsp);
}
Пример #9
0
void streamdatah_enable_cfm_send(struct streamdatah_env_tag *streamdatah_env, struct prf_con_info *con_info, uint8_t status)
{
    //format response to app
    struct streamdatah_enable_cfm * cfm = KE_MSG_ALLOC(STREAMDATAH_ENABLE_CFM,
                                                 con_info->appid, con_info->prf_id,
                                                 streamdatah_enable_cfm);

    cfm->conhdl = gapc_get_conhdl(con_info->conidx);
    cfm->status = status;

    if (status == PRF_ERR_OK)
    {
        cfm->streamdatah    = streamdatah_env->streamdatah;

		// Register STREAMDATAH task in gatt for indication/notifications
		prf_register_atthdl2gatt(&streamdatah_env->con_info, &streamdatah_env->streamdatah.svc);

        // Go to connected state
        ke_state_set(con_info->prf_id, STREAMDATAH_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(streamdatah_envs, con_info->prf_id, STREAMDATAH);
    }

    ke_msg_send(cfm);
}
Пример #10
0
void htpc_enable_cfm_send(struct htpc_env_tag *htpc_env, struct prf_con_info *con_info, uint8_t status)
{
    // Inform the APP about the status of the enabling of the Health Thermometer Profile Collector role 5awk
    struct htpc_enable_cfm *cfm = KE_MSG_ALLOC(HTPC_ENABLE_CFM,
                                               con_info->appid, con_info->prf_id,
                                               htpc_enable_cfm);

    // Connection Handle
    cfm->conhdl = gapc_get_conhdl(con_info->conidx);
    // Status
    cfm->status = status;

    // If status is PRF_ERR_OK, hts is non NULL
    if (status == PRF_ERR_OK)
    {
        // Attributes discovered in the peer device database
        cfm->hts = htpc_env->hts;

        // Register the profile task in GATT in order to receive notifications/indications
        prf_register_atthdl2gatt(con_info, &htpc_env->hts.svc);

        // Go to connected state
        ke_state_set(con_info->prf_id, HTPC_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(htpc_envs, con_info->prf_id, HTPC);
    }

    // Send the confirmation to the application
    ke_msg_send(cfm);
}
Пример #11
0
void hogpbh_enable_cfm_send(struct hogpbh_env_tag *hogpbh_env, struct prf_con_info *con_info, uint8_t status)
{
    // Counter
    uint8_t i;

    // Send APP the details of the discovered attributes on HOGPBH
    struct hogpbh_enable_cfm * rsp = KE_MSG_ALLOC(HOGPBH_ENABLE_CFM,
                                                  con_info->appid, con_info->prf_id,
                                                  hogpbh_enable_cfm);

    rsp->conhdl = gapc_get_conhdl(con_info->conidx);
    rsp->status = status;

    if (status == PRF_ERR_OK)
    {
        rsp->hids_nb = hogpbh_env->hids_nb;

        for (i = 0; i < hogpbh_env->hids_nb; i++)
        {
            rsp->hids[i] = hogpbh_env->hids[i];

            // Register HOGPBH task in gatt for indication/notifications
            prf_register_atthdl2gatt(&hogpbh_env->con_info, &hogpbh_env->hids[i].svc);
        }

        // Go to connected state
        ke_state_set(con_info->prf_id, HOGPBH_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(hogpbh_envs, con_info->prf_id, HOGPBH);
    }

    ke_msg_send(rsp);
}
Пример #12
0
void disc_enable_cfm_send(struct disc_env_tag *disc_env, struct prf_con_info *con_info, uint8_t status)
{
    // Send APP the details of the discovered attributes on DISS
    struct disc_enable_cfm * rsp = KE_MSG_ALLOC(DISC_ENABLE_CFM,
                                                con_info->appid, con_info->prf_id,
                                                disc_enable_cfm);

    rsp->conhdl = gapc_get_conhdl(con_info->conidx);
    rsp->status = status;

    if (status == PRF_ERR_OK)
    {
        rsp->dis = disc_env->dis;

        // Go to connected state
        ke_state_set(con_info->prf_id, DISC_CONNECTED);
    }
    else
    {
        PRF_CLIENT_ENABLE_ERROR(disc_envs, con_info->prf_id, DISC);
    }

    ke_msg_send(rsp);
}