tizen beta release
[framework/web/wrt-plugins-common.git] / src / modules / API / Networking / IAdapter.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @author       Zbigniew Kostrzewa (z.kostrzewa@samsung.com)
18  */
19
20 #ifndef WRTDEVICEAPIS_NETWORKING_IADAPTER_H_
21 #define WRTDEVICEAPIS_NETWORKING_IADAPTER_H_
22
23 #include <list>
24 #include <dpl/noncopyable.h>
25 #include "IConnection.h"
26 #include "EventConnected.h"
27 #include "EventDisconnected.h"
28
29 namespace WrtDeviceApis {
30 namespace Networking {
31 namespace Api {
32 class IAdapter : public DPL::Noncopyable
33 {
34   public:
35     /**
36      * Adapter type.
37      */
38     enum Type
39     {
40         T_ETHERNET, //!< T_ETHERNET
41         T_WIFI //!< T_WIFI
42     };
43
44   public:
45     virtual ~IAdapter() = 0;
46
47     /**
48      * Checks whether network adapter has active connection.
49      * @return True when connected, false otherwsie.
50      */
51     virtual bool isConnected() const = 0;
52
53     /**
54      * Gets active connection.
55      * @return Active connection or NULL if not connected.
56      */
57     virtual IConnectionPtr getConnection() const = 0;
58
59     /**
60      * Sets on connected event emitter.
61      * @param event Event emitter.
62      */
63     virtual void addOnConnected(const EventConnectedEmitterPtr& emitter) = 0;
64
65     /**
66      * Removes on connected event emitter.
67      * @param id Emitters id.
68      */
69     virtual void removeOnConnected(EventConnectedEmitter::IdType id) = 0;
70
71     /**
72      * Sets on disconnected event emitter.
73      * @param emitter Event emitter.
74      */
75     virtual void addOnDisconnected(const EventDisconnectedEmitterPtr& emitter)
76         = 0;
77
78     /**
79      * Removes on disconnected event emitter.
80      * @param id Emitters id.
81      */
82     virtual void removeOnDisconnected(EventDisconnectedEmitter::IdType id) = 0;
83
84     /**
85      * Gets type of an adapter
86      * @return type Type of an adapter
87      */
88     virtual Type getAdapterType() const = 0;
89 };
90
91 typedef std::list<IAdapter*> AdaptersSet;
92 typedef std::list<IAdapter*>::iterator AdaptersSetIterator;
93 } // Api
94 } // Networking
95 } // WrtDeviceApis
96
97 #endif // WRTDEVICEAPIS_NETWORKING_IADAPTER_H_