2 * Copyright (c) 2016 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 /*****************************************************************************
19 *****************************************************************************/
26 /*****************************************************************************
28 *****************************************************************************/
35 /*****************************************************************************
36 * Application Service Platform Daemon headers
37 *****************************************************************************/
38 #include "asp-manager-util.h"
39 #include "asp-manager-gdbus.h"
40 #include "asp-service.h"
41 #include "asp-session.h"
44 #include "generated-code.h"
46 /*****************************************************************************
48 *****************************************************************************/
50 /* TODO : define service data structure */
52 /*****************************************************************************
54 *****************************************************************************/
56 /* TODO : define local memory for service data structure */
58 /*****************************************************************************
59 * Local Functions Definition
60 *****************************************************************************/
62 static guint64 asp_service_search_id;
64 gint32 asp_service_init()
66 __ASP_LOG_FUNC_ENTER__;
68 asp_service_search_id = 0;
70 __ASP_LOG_FUNC_EXIT__;
74 gint32 asp_service_deinit()
76 __ASP_LOG_FUNC_ENTER__;
79 __ASP_LOG_FUNC_EXIT__;
83 gint32 asp_service_advertise(asp_service_advertise_s *service, gint32 replace)
85 __ASP_LOG_FUNC_ENTER__;
86 gint32 discovery_tech = service->discovery_tech;
89 ASP_LOGD("Discovery tech %x", discovery_tech);
90 result = asp_tech_advertise(discovery_tech, service, replace);
97 __ASP_LOG_FUNC_EXIT__;
101 gint32 asp_service_cancel_advertise(asp_service_advertise_s *service)
103 __ASP_LOG_FUNC_ENTER__;
104 gint32 discovery_tech = service->discovery_tech;
107 ASP_LOGD("Discovery tech %x", discovery_tech);
108 result = asp_tech_cancel_advertise(discovery_tech, service);
115 __ASP_LOG_FUNC_EXIT__;
119 gint32 asp_service_seek(asp_service_seek_s *service, guint64 *search_id)
121 __ASP_LOG_FUNC_ENTER__;
122 gint32 discovery_tech = service->discovery_tech;
125 ASP_LOGD("Discovery tech %x", discovery_tech);
126 service->search_id = asp_service_search_id;
127 result = asp_tech_seek(discovery_tech, service);
134 *search_id = service->search_id;
135 asp_service_search_id++;
137 __ASP_LOG_FUNC_EXIT__;
141 gint32 asp_service_cancel_seek(asp_service_seek_s *service)
143 __ASP_LOG_FUNC_ENTER__;
144 gint32 discovery_tech = service->discovery_tech;
147 ASP_LOGD("Discovery tech %x", discovery_tech);
148 result = asp_tech_cancel_seek(discovery_tech, service);
155 __ASP_LOG_FUNC_EXIT__;
159 gint32 asp_service_notify_advertise_status(guint32 adv_id,
160 asp_service_advertise_status_e status,
161 asp_service_advertise_reason_e reason)
163 __ASP_LOG_FUNC_ENTER__;
166 asp_manager_gdbus_notify_advertise_status(adv_id, (guint8)status, (gint32)reason);
168 __ASP_LOG_FUNC_EXIT__;
172 gint32 asp_service_notify_search_result(guint32 search_id,
173 const gchar *service_mac, const gchar *service_device_name,
174 guint32 adv_id, const gchar *instance_name,
175 GHashTable *service_info_map, asp_service_status_e service_status)
177 __ASP_LOG_FUNC_ENTER__;
180 asp_manager_gdbus_notify_search_result(search_id,
186 (guint8)service_status);
188 __ASP_LOG_FUNC_EXIT__;