1 /******************************************************************************
3 * Copyright (C) 2014 Google, Inc.
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 ******************************************************************************/
20 #include "support/adapter.h"
21 #include "support/callbacks.h"
22 #include "support/property.h"
24 static bt_state_t state;
25 static int property_count = 0;
26 static bt_property_t *properties = NULL;
27 static bt_discovery_state_t discovery_state;
29 bt_state_t adapter_get_state() {
33 int adapter_get_property_count() {
34 return property_count;
37 bt_property_t *adapter_get_property(bt_property_type_t type) {
38 for (int i = 0; i < property_count; ++i) {
39 if (properties[i].type == type) {
40 return &properties[i];
47 bt_discovery_state_t adapter_get_discovery_state() {
48 return discovery_state;
52 void adapter_state_changed(bt_state_t new_state) {
58 void adapter_properties(bt_status_t status,
60 bt_property_t *new_properties) {
61 property_free_array(properties, property_count);
62 properties = property_copy_array(new_properties, num_properties);
63 property_count = num_properties;
69 void discovery_state_changed(bt_discovery_state_t state) {
70 discovery_state = state;