Add set/get values implementation and test file for that
[platform/core/api/asp.git] / src / include / asp-client.h
1 /*
2  * Application Service Platform(ASP)
3  *
4  * Copyright (c) 2015 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  */
19
20 /**
21  * This file declares definitions, macros and structures.
22  *
23  * @file        asp-client.h
24  * @author      Yu Jiung (jiung.yu@samsung.com)
25  * @version     0.1
26  */
27
28 #ifndef __ASP_CLIENT_H__
29 #define __ASP_CLIENT_H__
30
31 #include <glib.h>
32
33 #define MACADDR_LEN 6
34 #define MACSTR_LEN 18
35 #define ASP_SERVICE_INFO_MAX_LEN 200
36
37 /**
38  * Application Service Platform(ASP) advertise data structure
39  */
40 typedef struct {
41         unsigned int adv_id;
42         long long unsigned search_id;
43         int auto_accept;
44         int discovery_tech;
45         unsigned char preferred_connection;
46
47         unsigned char status;
48         unsigned char role;
49         unsigned int config_method;
50         unsigned char tran_id;
51
52         char *instance_name;
53         char *serivce_name;
54         char *service_type;
55         GHashTable *service_info_map;
56         char *rsp_info;
57 } asp_client_advert_s;
58
59 /**
60  * Application Service Platform(ASP) seek data structure
61  */
62 typedef struct {
63         unsigned int adv_id;
64         long long unsigned search_id;
65         int auto_accept;
66         int discovery_tech;
67         unsigned char preferred_connection;
68
69         unsigned char status;
70         unsigned char role;
71         unsigned int config_method;
72         unsigned char tran_id;
73
74         char *serivce_name;
75         char *service_type;
76         GHashTable *service_info_map;
77         char *rsp_info;
78 } asp_client_seek_s;
79
80 /**
81  * Application Service Platform(ASP) session data structure
82  */
83 typedef struct {
84         char session_mac[MACSTR_LEN]; /* the MAC address of the P2P device that generated the session ID */
85         unsigned int session_id;
86         char service_mac[MACSTR_LEN];
87         unsigned int advertisement_id;
88         int network_config;
89         int network_role;
90         int port;
91         int state;
92         int persist;
93         char *session_information;
94
95         /* session information for each local setting */
96         int service_role;
97         int is_incomming;
98         unsigned char local_ip[4];
99         char *deferred_session_response;
100 } asp_client_session_s;
101
102 typedef struct {
103         bool is_registered;
104
105         asp_seek_search_result_cb seek_search_result_cb;
106         asp_advert_status_changed_cb advert_status_changed_cb;
107
108         asp_session_request_cb session_request_cb;
109         asp_session_config_request_cb session_config_request_cb;
110         asp_session_connect_status_cb session_connect_status_cb;
111         asp_session_status_cb session_status_cb;
112         asp_session_port_status_cb session_port_status_cb;
113
114         void *user_data_for_cb_seek_search_result;
115         void *user_data_for_cb_advert_status_changed;
116
117         void *user_data_for_cb_session_request;
118         void *user_data_for_cb_session_config_request;
119         void *user_data_for_cb_session_connect_status;
120         void *user_data_for_cb_session_status;
121         void *user_data_for_cb_session_port_status;
122 } asp_client_info_s;
123
124 void asp_process_seek_search_result(GDBusConnection *connection,
125                 const gchar *object_path, GVariant *parameters);
126 void asp_process_advert_status_changed(GDBusConnection *connection,
127                 const gchar *object_path, GVariant *parameters);
128
129 void asp_process_session_request(GDBusConnection *connection,
130                 const gchar *object_path, GVariant *parameters);
131 void asp_process_session_config_request(GDBusConnection *connection,
132                 const gchar *object_path, GVariant *parameters);
133 void asp_process_session_connect_status(GDBusConnection *connection,
134                 const gchar *object_path, GVariant *parameters);
135 void asp_process_session_status(GDBusConnection *connection,
136                 const gchar *object_path, GVariant *parameters);
137 void asp_process_session_port_status(GDBusConnection *connection,
138                 const gchar *object_path, GVariant *parameters);
139
140 #endif /** __ASP_CLIENT_H__ */