Example #1
0
/** stop the probe **/
void battery_probe_stop(void) {
	
	/** cancell all MESSAGE_ADC_RESULT and BATTERY_PROBE_TICK message **/
	MessageFlushTask(getBatteryProbeTask());
	
	/** cancell all BATTERY_PROBE_READING message sent to client **/
	MessageCancelAll(battery_probe.client, BATTERY_PROBING_MESSAGE);
}
void a2dpHandleDeleteTask(A2DP *a2dp)
{
	a2dpFreeConfiguredCapsMemory(a2dp);

	a2dpFreeSeidListMemory(a2dp);

    /* Discard all messages for the task and free it. */
	(void) MessageFlushTask(&a2dp->task);
    free(a2dp);
}
/****************************************************************************
NAME 
	hidDestroy
DESCRIPTION
	Destroys specified HID instance, deletes any associated memory.
RETURNS
	void
*/
void hidDestroy(HID *hid)
{
	HID_PRINT(("hidDestroy\n"));

    if (hid->prev)
    {
        hid->prev->next = hid->next;
        if (hid->next)
            hid->next->prev = hid->prev;
    }
    else
    {
        hid->hid_lib->list = hid->next;
        if (hid->next)
            hid->next->prev = NULL;
    }
    MessageFlushTask(&hid->task);
    free(hid);
}
bool GattScanParamsClientDeInit(GSPC_T *scan_params_client)
{
    bool result = FALSE;

    /* Check parameters */
    if (scan_params_client == NULL)
    {
        GATT_SCAN_PARAMS_CLIENT_PANIC(("GSPC: Null instance"));
    }
    
    /* Register with the GATT Manager and verify the result */
    if (GattManagerUnregisterClient(&scan_params_client->lib_task) == gatt_manager_status_success)
    {
        result = TRUE;
        /* Clear pending messages */
        MessageFlushTask((Task)&scan_params_client->lib_task);
    }
    
    return result;
}
gatt_battery_client_status_t GattBatteryClientDestroy(GBASC *battery_client, uint16 cid)
{
    gatt_battery_client_status_t result = gatt_battery_client_status_invalid_parameter;

    /* Check parameters */
    if (battery_client != NULL)
    {
        /* Register with the GATT Manager and verify the result */
        if (GattManagerUnregisterClient(&battery_client->lib_task) == gatt_manager_status_success)
        {
            result = gatt_battery_client_status_success;
        }
        else
        {
            result = gatt_battery_client_status_failed;
        }
        
        /* Clear pending messages */
        MessageFlushTask((Task)&battery_client->lib_task);
    }
    
    return result;
}