mirror of git://git.sysmocom.de/ofono
mbim: Add mbim_device_set_ready_handler
This commit is contained in:
parent
d8686704e7
commit
4e058ece2c
|
@ -75,6 +75,9 @@ struct mbim_device {
|
|||
mbim_device_disconnect_func_t disconnect_handler;
|
||||
void *disconnect_data;
|
||||
mbim_device_destroy_func_t disconnect_destroy;
|
||||
mbim_device_ready_func_t ready_handler;
|
||||
mbim_device_destroy_func_t ready_destroy;
|
||||
void *ready_data;
|
||||
};
|
||||
|
||||
static void disconnect_handler(struct l_io *io, void *user_data)
|
||||
|
@ -202,3 +205,21 @@ bool mbim_device_set_close_on_unref(struct mbim_device *device, bool do_close)
|
|||
l_io_set_close_on_destroy(device->io, do_close);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool mbim_device_set_ready_handler(struct mbim_device *device,
|
||||
mbim_device_ready_func_t function,
|
||||
void *user_data,
|
||||
mbim_device_destroy_func_t destroy)
|
||||
{
|
||||
if (unlikely(!device))
|
||||
return false;
|
||||
|
||||
if (device->ready_destroy)
|
||||
device->ready_destroy(device->ready_data);
|
||||
|
||||
device->ready_handler = function;
|
||||
device->ready_destroy = destroy;
|
||||
device->ready_data = user_data;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -24,6 +24,7 @@ struct mbim_device;
|
|||
typedef void (*mbim_device_debug_func_t) (const char *str, void *user_data);
|
||||
typedef void (*mbim_device_disconnect_func_t) (void *user_data);
|
||||
typedef void (*mbim_device_destroy_func_t) (void *user_data);
|
||||
typedef void (*mbim_device_ready_func_t) (void *user_data);
|
||||
|
||||
extern const uint8_t mbim_uuid_basic_connect[];
|
||||
extern const uint8_t mbim_uuid_sms[];
|
||||
|
@ -47,3 +48,7 @@ bool mbim_device_set_disconnect_handler(struct mbim_device *device,
|
|||
mbim_device_disconnect_func_t function,
|
||||
void *user_data,
|
||||
mbim_device_destroy_func_t destroy);
|
||||
bool mbim_device_set_ready_handler(struct mbim_device *device,
|
||||
mbim_device_ready_func_t function,
|
||||
void *user_data,
|
||||
mbim_device_destroy_func_t destroy);
|
||||
|
|
Loading…
Reference in New Issue