aboutsummaryrefslogtreecommitdiffstats
path: root/include/connman-glib.h
blob: 63412c0d55c2af94b75714708f1cc6ed736ac66d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
/*
 * Copyright 2022 Konsulko Group
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#ifndef CONNMAN_GLIB_H
#define CONNMAN_GLIB_H

#include <glib.h>

#ifdef __cplusplus
extern "C"
{
#endif

typedef enum {
	CONNMAN_LOG_LEVEL_ERROR,
	CONNMAN_LOG_LEVEL_WARNING,
	CONNMAN_LOG_LEVEL_INFO,
	CONNMAN_LOG_LEVEL_DEBUG
} connman_log_level_t;

// Hook to allow users to override the default level
#ifndef CONNMAN_LOG_LEVEL_DEFAULT
#define CONNMAN_LOG_LEVEL_DEFAULT CONNMAN_LOG_LEVEL_ERROR
#endif

typedef enum {
	CONNMAN_MANAGER_EVENT_TECHNOLOGY_ADD,
	CONNMAN_MANAGER_EVENT_TECHNOLOGY_REMOVE,
	CONNMAN_MANAGER_EVENT_SERVICE_CHANGE,
	CONNMAN_MANAGER_EVENT_SERVICE_REMOVE,
	CONNMAN_MANAGER_EVENT_PROPERTY_CHANGE
} connman_manager_event_t;


typedef void (*connman_manager_event_cb_t)(const gchar *path,
					   connman_manager_event_t event,
					   GVariant *properties,
					   gpointer user_data);

typedef void (*connman_technology_property_event_cb_t)(const gchar *technology,
						       GVariant *properties,
						       gpointer user_data);

typedef void (*connman_service_property_event_cb_t)(const gchar *service,
						    GVariant *property,
						    gpointer user_data);

typedef void (*connman_agent_event_cb_t)(const gchar *service,
					 const int id,
					 GVariant *property,
					 gpointer user_data);

typedef void (*connman_service_connect_cb_t)(const gchar *service,
					     gboolean status,
					     const char *error,
					     gpointer user_data);

void connman_add_manager_event_callback(connman_manager_event_cb_t cb,
					gpointer user_data);

void connman_add_technology_property_event_callback(connman_technology_property_event_cb_t cb,
						    gpointer user_data);

void connman_add_service_property_event_callback(connman_service_property_event_cb_t cb,
						 gpointer user_data);

void connman_add_agent_event_callback(connman_agent_event_cb_t cb,
				      gpointer user_data);

void connman_set_log_level(connman_log_level_t level);

gboolean connman_init(gboolean register_agent);

gboolean connman_manager_get_state(gchar **state);

gboolean connman_manager_get_online(void);

gboolean connman_manager_set_offline(gboolean state);

gboolean connman_get_technologies(GVariant **reply);

gboolean connman_get_services(GVariant **reply);

gboolean connman_technology_enable(const gchar *technology);

gboolean connman_technology_disable(const gchar *technology);

gboolean connman_technology_scan_services(const gchar *technology);

gboolean connman_service_move(const gchar *service,
			      const gchar *target_service,
			      gboolean after);

gboolean connman_service_remove(const gchar *service);

gboolean connman_service_connect(const gchar *service,
				 connman_service_connect_cb_t cb,
				 gpointer user_data);

gboolean connman_service_disconnect(const gchar *service);

typedef enum {
	CONNMAN_PROPERTY_MANAGER,
	CONNMAN_PROPERTY_TECHNOLOGY,
	CONNMAN_PROPERTY_SERVICE
} connman_property_type_t;

GVariant *connman_get_property(connman_property_type_t prop_type,
			       const char *path,
			       const char *name);

gboolean connman_set_property(connman_property_type_t prop_type,
			      const char *path,
			      const char *name,
			      GVariant *value);

gboolean connman_agent_response(const int id, GVariant *parameters);

#ifdef __cplusplus
} // extern "C"
#endif

#endif /* CONNMAN_GLIB_H */