# mco_iot_comm_unregister_callback

Delete the callback function from the specified context.

### For an overview see page ARF Applications in C

### Prototype

        MCO_RET mco_iot_comm_unregister_callback(mco_iot_comm_h comm,
                                void *context);

### Arguments

comm | The communicator object to unregister the callbacks on
context | A user-defined context (a pointer to a structure containing application-specific data)

### Description

This function deletes the callback structure `iot_comm_callback_t` for communicator `comm` from the specified context. Note that this function does not delete the context. It finds the registered callback using `context` as a key and removes the callbacks from the list. If `context` is a heap pointer to some application data, the data will not be freed by this function.

### Return Codes

MCO_S_OK | Callbacks successfully deleted
MCO_E_IOT_INVALID_HANDLE | The communicator handle `comm` is invalid
MCO_E_IOT_CALLBACK_NOT_FOUND | Unable to find the callback with the specified `context`

### Example

The code snippet below unregisters the callbacks previously registered for this context (see `mco_iot_comm_register_callback()` for definition of the callbacks):

        int main(int argc, char *argv[])
        {
            ...
            void *context = ...;
            ...

            mco_iot_comm_register_callback(comm, &iot_callbacks, context);
            ...
            CHECK(mco_iot_comm_unregister_callback(comm, context));
            ...
        }

### Files

Header file:
mcoiot.h
Source file:
mcoiotcomm.c
Library:
libmcoiotcomm.a