Net utils
[apps/native/gear-racing-car.git] / inc / net-util.h
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license/
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 #ifndef __NET_UTIL_H_
18 #define __NET_UTIL_H_
19
20 #include <net_connection.h>
21
22 /**
23  * @brief Called whenever WiFi connection has changed.
24  * @param[in] ap_mac The MAC address of access point.
25  * @param[in] ap_ssid The SSID of the access point.
26  * @param[in] ip_addr Device IP address.
27  * @param[in] user_data The user defined data.
28  */
29 typedef void (*wifi_connection_changed_cb)(const char *ap_mac, const char *ap_ssid, char *ip_addr, void *user_data);
30
31 /**
32  * @brief Initializes network utils.
33 */
34 int net_util_init();
35
36 /**
37  * @brief Finalizes network utils.
38 */
39 void net_util_fini();
40
41 /**
42  * @brief Sets WiFi connection changed callback.
43  * @param[in] callback Callback to be set.
44  * @param[in] user_data User defined data.
45 */
46 int net_util_set_wifi_connection_changed_cb(wifi_connection_changed_cb callback, void *user_data);
47
48 /**
49  * @brief Gets access point MAC address.
50  * @param[out] mac The MAC address.
51 */
52 int net_util_get_ap_mac(char **mac);
53
54 /**
55  * @brief Gets access point SSID.
56  * @param[out] The SSID.
57 */
58 int net_util_get_ap_ssid(char **ssid);
59
60 /**
61  * @brief Gets device IP address.
62  * @param[out] The IP address
63 */
64 int net_util_get_ip_addr(char **ip);
65
66 #endif