Imported Upstream version 1.1.0
[platform/upstream/iotivity.git] / service / easy-setup / enrollee / linux / wifi / networkhandler.h
1 //******************************************************************
2 //
3 // Copyright 2015 Samsung Electronics All Rights Reserved.
4 //
5 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
6 //
7 // Licensed under the Apache License, Version 2.0 (the "License");
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
10 //
11 //      http://www.apache.org/licenses/LICENSE-2.0
12 //
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an "AS IS" BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
18 //
19 //-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
20
21 /**
22  * @file
23  *
24  * This file contains IP network handling functionality for Enrollee device
25  */
26
27 #ifndef ES_NETWORK_HANDLER_H_
28 #define ES_NETWORK_HANDLER_H_
29
30
31 #include <string.h>
32 #include "easysetup.h"
33 #include "logger.h"
34 #include "escommon.h"
35
36 #define MAXSSIDLEN 33
37 #define MAXNETCREDLEN 20
38 #define MAXNUMTYPE 5
39 #define MAXADDRLEN 15
40
41 /*
42  * Callback function for updating the Network status to the subscribers
43  *
44  * @param esResult ESResult provides the current state of the network connection status
45  */
46 typedef void (*ESEnrolleeNetworkEventCallback)(ESResult esResult);
47
48 typedef struct
49 {
50     OCConnectivityType type;
51     // for WiFI
52     //IPAddress ipaddr;
53     char *ipaddr;
54     char ssid[MAXSSIDLEN];
55     // for BT, BLE
56     //byte mac[6];
57 } NetworkInfo;
58
59 void ConnectToWiFiNetwork(const char *ssid, const char *pass,
60                                                             ESEnrolleeNetworkEventCallback);
61 ESResult getCurrentNetworkInfo(OCConnectivityType targetType, NetworkInfo *info);
62
63 #endif