device: Add driver capability to set regulatory domain on device basis
authorTomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
Wed, 4 Jul 2012 13:48:00 +0000 (16:48 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Thu, 5 Jul 2012 07:04:53 +0000 (09:04 +0200)
include/device.h
src/device.c

index f787cf4..f4e802e 100644 (file)
@@ -108,6 +108,9 @@ void connman_device_unregister(struct connman_device *device);
 void *connman_device_get_data(struct connman_device *device);
 void connman_device_set_data(struct connman_device *device, void *data);
 
+int connman_device_set_regdom(struct connman_device *device,
+                                               const char *alpha2);
+
 struct connman_device_driver {
        const char *name;
        enum connman_device_type type;
@@ -122,6 +125,8 @@ struct connman_device_driver {
                        const char *ssid, unsigned int ssid_len,
                        const char *identity, const char* passphrase,
                        void *user_data);
+       int (*set_regdom) (struct connman_device *device,
+                                               const char *alpha2);
 };
 
 int connman_device_driver_register(struct connman_device_driver *driver);
index f2f3ce5..43ebb6c 100644 (file)
@@ -1045,6 +1045,22 @@ struct connman_device *__connman_device_find_device(
        return NULL;
 }
 
+/**
+ * connman_device_set_regdom
+ * @device: device structure
+ * @alpha2: string representing regulatory domain
+ *
+ * Set regulatory domain on device basis
+ */
+int connman_device_set_regdom(struct connman_device *device,
+                                               const char *alpha2)
+{
+       if (device->driver == NULL || device->driver->set_regdom == NULL)
+               return -ENOTSUP;
+
+       return device->driver->set_regdom(device, alpha2);
+}
+
 int __connman_device_request_scan(enum connman_service_type type)
 {
        connman_bool_t success = FALSE;