Commit 0f54908d authored by Christian Kellner's avatar Christian Kellner
Browse files

device: connected/disconnected setter/getter

parent 503e070c
......@@ -712,6 +712,46 @@ bolt_device_unexport (BoltDevice *device)
g_dbus_interface_skeleton_unexport (G_DBUS_INTERFACE_SKELETON (device));
}
BoltStatus
bolt_device_connected (BoltDevice *dev,
struct udev_device *udev)
{
const char *syspath;
BoltSecurity security;
BoltStatus status;
syspath = udev_device_get_syspath (udev);
status = bolt_status_from_udev (udev);
security = security_for_udev (udev);
g_object_set (G_OBJECT (dev),
"sysfs-path", syspath,
"security", security,
"status", status,
NULL);
return status;
}
BoltStatus
bolt_device_disconnected (BoltDevice *dev)
{
g_object_set (G_OBJECT (dev),
"sysfs-path", NULL,
"security", BOLT_SECURITY_NONE,
"status", BOLT_STATUS_DISCONNECTED,
NULL);
return dev->status;
}
gboolean
bolt_device_is_connected (BoltDevice *device)
{
return device->status > BOLT_STATUS_CONNECTING;
}
guint
bolt_device_get_key (BoltDevice *dev)
{
......
......@@ -43,6 +43,13 @@ const char * bolt_device_export (BoltDevice *device,
void bolt_device_unexport (BoltDevice *device);
BoltStatus bolt_device_connected (BoltDevice *dev,
struct udev_device *udev);
BoltStatus bolt_device_disconnected (BoltDevice *dev);
gboolean bolt_device_is_connected (BoltDevice *device);
guint bolt_device_get_key (BoltDevice *dev);
const char * bolt_device_get_name (BoltDevice *dev);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment