Add the check logic for the client connection
[platform/core/connectivity/bluetooth-frwk.git] / bt-oal / oal-hardware.c
1 /*
2  * Open Adaptation Layer (OAL)
3  *
4  * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
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 #include <stdio.h>
21 #include <stdlib.h>
22 #include <sys/types.h>
23 #include <sys/wait.h>
24 #include <string.h>
25 #include <unistd.h>
26 #include <fcntl.h>
27 #include <tzplatform_config.h>
28
29 #include "oal-hardware.h"
30 #include "oal-manager.h"
31 #include "oal-internal.h"
32
33 #define MAX_LINE_SIZE                   256
34 #define MAX_STRING_SIZE                 128
35
36 static bt_chip_type_t try_get_chip_type(void);
37
38 static bt_chip_type_t bt_chip_type = BT_CHIP_TYPE_PLATFORM;
39
40 const unsigned int nBTVidPidArry[][3] = {               /**< list of BT dongle's vid, pid */
41         /* { Vendor ID, Product ID, Chip Vendor } */
42         {0x0000, 0x0001, BT_CHIP_TYPE_PLATFORM},        /* Tizen Platform BT Chip */
43 };
44
45 static const char *str_chip_type[] = {
46         FOREACH_TYPE(GENERATE_TYPE_STRING)
47 };
48
49 int hw_is_chip_connected()
50 {
51         /* Currently not supported, return TRUE as default */
52         return TRUE;
53 }
54
55 bt_chip_type_t hw_get_chip_type(void)
56 {
57         bt_chip_type_t type;
58
59         type = ((bt_chip_type != BT_CHIP_TYPE_UNKNOWN) ? bt_chip_type : try_get_chip_type());
60
61         API_TRACE("Type: %s", str_chip_type[type]);
62         return type;
63 }
64
65 oal_status_t hw_chip_firmware_update(void)
66 {
67         return OAL_STATUS_NOT_SUPPORT;
68 }
69
70 oal_status_t hw_is_module_ready(void)
71 {
72         /* For Tizen Platform, set HW module ready to TRUE by default */
73         return OAL_STATUS_SUCCESS;
74 }
75
76 oal_status_t hw_is_fwupgrade_required(gboolean *is_required)
77 {
78         return OAL_STATUS_NOT_SUPPORT;
79 }
80
81 static bt_chip_type_t try_get_chip_type(void)
82 {
83         return bt_chip_type;
84 }
85