2 * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
4 * Contact: Suresh Kumar N (suresh.n@samsung.com)
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
10 * http://www.apache.org/licenses/LICENSE-2.0
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.
26 #include <zblib_service.h>
27 #include <zblib_plugin.h>
29 #include <zigbee_service_interface.h>
30 #include <zigbee_service.h>
32 #define NOTUSED(var) (var = var)
34 /**< ZigBee Service */
35 ZigBeeService *zigbee_service;
37 int main(int arg, char **argv)
39 ZigBeeService *service = NULL;
43 #if !GLIB_CHECK_VERSION(2, 35, 0)
46 #if !GLIB_CHECK_VERSION(2, 31, 0)
52 Z_LOGI("service mainloop start");
54 /* Create ZigBee service */
55 zigbee_service = service = zblib_service_new();
57 /* Initialize ZigBee service interface layer */
58 ret = zigbee_service_interface_init(service);
59 if (G_UNLIKELY(FALSE == ret)) {
60 Z_LOGE("zigbee_service_interface_init failed!");
64 /* Initialize ZigBee service */
65 ret = zigbee_service_init(service);
66 if (G_UNLIKELY(FALSE == ret)) {
67 Z_LOGE("zigbee_service_init failed!");
71 /* Run ZigBee service */
72 ret = zblib_service_run(service);
73 if (G_UNLIKELY(FALSE == ret)) {
74 Z_LOGE("Run service failed!");
75 ret_code = EXIT_FAILURE;
79 /* De-initialize ZigBee service */
80 zigbee_service_deinit(service);
82 /* De-initialize ZigBee service interface layer */
83 zigbee_service_interface_deinit(service);
85 /* Free ZigBee service */
86 zblib_service_free(service);
87 zigbee_service = NULL;