CONNMAN_DEVICE_TYPE_VENDOR = 42,
};
+enum connman_device_mode {
+ CONNMAN_DEVICE_MODE_NO_NETWORK = 0,
+ CONNMAN_DEVICE_MODE_SINGLE_NETWORK = 1,
+ CONNMAN_DEVICE_MODE_MULTIPLE_NETWORKS = 2,
+};
+
enum connman_device_policy {
CONNMAN_DEVICE_POLICY_UNKNOWN = 0,
CONNMAN_DEVICE_POLICY_IGNORE = 1,
const char *interface);
extern const char *connman_device_get_interface(struct connman_device *device);
+extern void connman_device_set_mode(struct connman_device *device,
+ enum connman_device_mode mode);
+
extern int connman_device_set_powered(struct connman_device *device,
gboolean powered);
extern int connman_device_set_carrier(struct connman_device *device,
connman_device_set_interface(adapter, node);
+ connman_device_set_mode(adapter, CONNMAN_DEVICE_MODE_MULTIPLE_NETWORKS);
+
if (connman_device_register(adapter) < 0) {
connman_device_unref(adapter);
return;
struct connman_device {
struct connman_element element;
enum connman_device_type type;
+ enum connman_device_mode mode;
enum connman_device_policy policy;
gboolean powered;
gboolean carrier;
device->element.destruct = device_destruct;
device->type = type;
+ device->mode = CONNMAN_DEVICE_MODE_NO_NETWORK;
device->policy = CONNMAN_DEVICE_POLICY_AUTO;
return device;
}
/**
+ * connman_device_set_mode:
+ * @device: device structure
+ * @mode: network mode
+ *
+ * Change network mode of device
+ */
+void connman_device_set_mode(struct connman_device *device,
+ enum connman_device_mode mode)
+{
+ device->mode = mode;
+}
+
+/**
* connman_device_set_powered:
* @device: device structure
* @powered: powered state
{
DBG("driver %p carrier %d", device, carrier);
- if (!device->driver)
- return -EINVAL;
-
- if (device->driver->scan)
+ if (device->mode != CONNMAN_DEVICE_MODE_NO_NETWORK)
return -EINVAL;
if (device->carrier == carrier)
DBG("driver %p scanning %d", device, scanning);
- if (!device->driver)
- return -EINVAL;
-
- if (!device->driver->scan)
+ if (!device->driver || !device->driver->scan)
return -EINVAL;
if (device->scanning == scanning)