Exemplo n.º 1
0
void pasps_disable(struct pasps_idx_env_tag *idx_env)
{
    // Disable PAS service
    attsdb_svc_set_permission(pasps_env.pass_shdl, PERM(SVC, DISABLE));

    struct pasps_disable_ind *ind = KE_MSG_ALLOC(PASPS_DISABLE_IND,
                                                 idx_env->con_info.appid, idx_env->con_info.prf_id,
                                                 pasps_disable_ind);

    memset(ind, 0x00, sizeof(struct pasps_disable_ind));

    ind->conhdl = idx_env->con_info.conhdl;

    if (PASPS_IS_NTF_ENABLED(idx_env, PASPS_FLAG_ALERT_STATUS_CFG))
    {
        ind->alert_status_ntf_cfg = PRF_CLI_START_NTF;
    }

    if (PASPS_IS_NTF_ENABLED(idx_env, PASPS_FLAG_RINGER_SETTING_CFG))
    {
        ind->ringer_setting_ntf_cfg = PRF_CLI_START_NTF;
    }

    ke_msg_send(ind);

    // Go to idle state
    ke_state_set(idx_env->con_info.prf_id, PASPS_IDLE);

    // Free the environment allocated for this connection
    prf_client_disable((prf_env_struct ***)&pasps_idx_envs, KE_IDX_GET(idx_env->con_info.prf_id));
}
Exemplo n.º 2
0
void prf_client_disable_ind_send(prf_env_struct ***p_envs, ke_msg_id_t msg_id,
                                 ke_task_id_t task_id, uint8_t state, uint16_t conhdl)
{
    // retrieve current state
    uint8_t cur_state = ke_state_get(task_id);

    // prevent doing freeing structure if state already of profile is already free.
    if(cur_state != state)
    {
        // Get the address of the environment
        prf_env_struct *env = prf_client_get_env(*p_envs, task_id);

        ASSERT_WARN(env != NULL);

        if (env != NULL)
        {
            struct prf_client_disable_ind *ind = KE_MSG_ALLOC(msg_id,
                                                 env->con_info.appid, env->con_info.prf_id,
                                                 prf_client_disable_ind);

            ind->conhdl    = conhdl;
            ind->status    = prf_client_disable(p_envs, KE_IDX_GET(env->con_info.prf_id));

            // Send the message
            ke_msg_send(ind);

            // Go to idle state
            ke_state_set(task_id, state);
        }
    }
}
Exemplo n.º 3
0
void prf_client_enable_error(prf_env_struct ***p_envs, ke_task_id_t prf_task_id,
                             ke_state_t disc_state, ke_state_t idle_state)
{
    /* An error has been raised, three possibilities:
     *      - Either the state is IDLE, no environment has been created, nothing to do,
     *      - Or the state is DISCOVERING, we need to come back to the IDLE state and to remove the
     * environment,
     *      - Or the state is CONNECTED, the profile was already connected for the provided connection,
     * nothing to do
     */
    if (ke_state_get(prf_task_id) == disc_state)
    {
        // Come back to IDLE State
        ke_state_set(prf_task_id, idle_state);

        // Remove the allocated environment
        prf_client_disable(p_envs, KE_IDX_GET(prf_task_id));
    }
}