X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fdevice.h;h=5cb34d7430e9589b7227668f9d84edd5bcdb92bc;hb=b136bbf0dde4220eb6d54fe8dabb0a0193f34335;hp=4985f6e8a169b3b2220fe9b80f763039ea3f0f70;hpb=7a3e397e2cc0c275f81eec419fa144ad258b4b87;p=framework%2Fconnectivity%2Fconnman.git diff --git a/include/device.h b/include/device.h index 4985f6e..5cb34d7 100644 --- a/include/device.h +++ b/include/device.h @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2010 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -22,72 +22,84 @@ #ifndef __CONNMAN_DEVICE_H #define __CONNMAN_DEVICE_H +#include +#include + #ifdef __cplusplus extern "C" { #endif -#include - /** * SECTION:device - * @title: Device driver premitives - * @short_description: Functions for registering device drivers + * @title: Device premitives + * @short_description: Functions for handling devices */ enum connman_device_type { - CONNMAN_DEVICE_TYPE_UNKNOWN = CONNMAN_ELEMENT_SUBTYPE_UNKNOWN, - CONNMAN_DEVICE_TYPE_FAKE = CONNMAN_ELEMENT_SUBTYPE_FAKE, - CONNMAN_DEVICE_TYPE_ETHERNET = CONNMAN_ELEMENT_SUBTYPE_ETHERNET, - CONNMAN_DEVICE_TYPE_WIFI = CONNMAN_ELEMENT_SUBTYPE_WIFI, - CONNMAN_DEVICE_TYPE_WIMAX = CONNMAN_ELEMENT_SUBTYPE_WIMAX, - CONNMAN_DEVICE_TYPE_MODEM = CONNMAN_ELEMENT_SUBTYPE_MODEM, - CONNMAN_DEVICE_TYPE_BLUETOOTH = CONNMAN_ELEMENT_SUBTYPE_BLUETOOTH, + CONNMAN_DEVICE_TYPE_UNKNOWN = 0, + CONNMAN_DEVICE_TYPE_ETHERNET = 1, + CONNMAN_DEVICE_TYPE_WIFI = 2, + CONNMAN_DEVICE_TYPE_WIMAX = 3, + CONNMAN_DEVICE_TYPE_BLUETOOTH = 4, + CONNMAN_DEVICE_TYPE_CELLULAR = 5, + CONNMAN_DEVICE_TYPE_GPS = 6, + CONNMAN_DEVICE_TYPE_GADGET = 7, + CONNMAN_DEVICE_TYPE_VENDOR = 10000, }; -enum connman_device_capabilities { - CONNMAN_DEVICE_CAPABILITY_SCANNING = (1 << 0), -}; +#define CONNMAN_DEVICE_PRIORITY_LOW -100 +#define CONNMAN_DEVICE_PRIORITY_DEFAULT 0 +#define CONNMAN_DEVICE_PRIORITY_HIGH 100 -enum connman_device_policy { - CONNMAN_DEVICE_POLICY_UNKNOWN = 0, - CONNMAN_DEVICE_POLICY_IGNORE = 1, - CONNMAN_DEVICE_POLICY_AUTO = 2, - CONNMAN_DEVICE_POLICY_OFF = 3, -}; +struct connman_device; -enum connman_device_state { - CONNMAN_DEVICE_STATE_UNKNOWN = 0, - CONNMAN_DEVICE_STATE_OFF = 1, -}; +struct connman_device *connman_device_create(const char *node, + enum connman_device_type type); +struct connman_device *connman_device_ref(struct connman_device *device); +void connman_device_unref(struct connman_device *device); -struct connman_device_driver; +enum connman_device_type connman_device_get_type(struct connman_device *device); +void connman_device_set_index(struct connman_device *device, int index); +int connman_device_get_index(struct connman_device *device); +void connman_device_set_interface(struct connman_device *device, + const char *interface); -struct connman_device { - struct connman_element *element; - unsigned long capabilities; - enum connman_device_policy policy; - enum connman_device_state state; - gboolean powered; +void connman_device_set_ident(struct connman_device *device, + const char *ident); +const char *connman_device_get_ident(struct connman_device *device); - struct connman_device_driver *driver; - void *driver_data; +int connman_device_set_powered(struct connman_device *device, + connman_bool_t powered); +int connman_device_set_scanning(struct connman_device *device, + connman_bool_t scanning); +void connman_device_reset_scanning(struct connman_device *device); - GSList *networks; -}; +int connman_device_set_disconnected(struct connman_device *device, + connman_bool_t disconnected); +connman_bool_t connman_device_get_disconnected(struct connman_device *device); +int connman_device_set_connected(struct connman_device *device, + connman_bool_t connected); -extern int connman_device_set_powered(struct connman_device *device, - gboolean powered); +int connman_device_set_string(struct connman_device *device, + const char *key, const char *value); +const char *connman_device_get_string(struct connman_device *device, + const char *key); -static inline void *connman_device_get_data(struct connman_device *device) -{ - return device->driver_data; -} +int connman_device_add_network(struct connman_device *device, + struct connman_network *network); +struct connman_network *connman_device_get_network(struct connman_device *device, + const char *identifier); +int connman_device_remove_network(struct connman_device *device, + const char *identifier); +void connman_device_remove_all_networks(struct connman_device *device); -static inline void connman_device_set_data(struct connman_device *device, - void *data) -{ - device->driver_data = data; -} +void connman_device_schedule_scan(struct connman_device *device); + +int connman_device_register(struct connman_device *device); +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); struct connman_device_driver { const char *name; @@ -100,8 +112,8 @@ struct connman_device_driver { int (*scan) (struct connman_device *device); }; -extern int connman_device_driver_register(struct connman_device_driver *driver); -extern void connman_device_driver_unregister(struct connman_device_driver *driver); +int connman_device_driver_register(struct connman_device_driver *driver); +void connman_device_driver_unregister(struct connman_device_driver *driver); #ifdef __cplusplus }