OSDN Git Service

osi: Remove error_fclose goto and redundant fflush.
[android-x86/system-bt.git] / test / suite / support / adapter.c
index 0a78253..34ce107 100644 (file)
@@ -1,6 +1,6 @@
 /******************************************************************************
  *
- *  Copyright (C) 2014 Google, Inc.
+ *  Copyright (C) 2015 Google, Inc.
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
  *  you may not use this file except in compliance with the License.
  ******************************************************************************/
 
 #include "base.h"
+#include "btcore/include/bdaddr.h"
+#include "btcore/include/property.h"
 #include "support/adapter.h"
 #include "support/callbacks.h"
-#include "support/property.h"
 
 static bt_state_t state;
 static int property_count = 0;
 static bt_property_t *properties = NULL;
 static bt_discovery_state_t discovery_state;
+static bt_acl_state_t acl_state;
+static bt_bond_state_t bond_state;
 
 bt_state_t adapter_get_state() {
   return state;
@@ -35,7 +38,8 @@ int adapter_get_property_count() {
 }
 
 bt_property_t *adapter_get_property(bt_property_type_t type) {
-  for (int i = 0; i < property_count; ++i) {
+  int i;
+  for (i = 0; i < property_count; ++i) {
     if (properties[i].type == type) {
       return &properties[i];
     }
@@ -48,6 +52,21 @@ bt_discovery_state_t adapter_get_discovery_state() {
   return discovery_state;
 }
 
+bt_acl_state_t adapter_get_acl_state() {
+  return acl_state;
+}
+
+// Returns the device bond state.
+bt_bond_state_t adapter_get_bond_state() {
+  return bond_state;
+}
+
+// callback
+void acl_state_changed(bt_status_t status, bt_bdaddr_t *remote_bd_addr, bt_acl_state_t state) {
+  acl_state = state;
+  CALLBACK_RET();
+}
+
 // callback
 void adapter_state_changed(bt_state_t new_state) {
   state = new_state;
@@ -56,8 +75,8 @@ void adapter_state_changed(bt_state_t new_state) {
 
 // callback
 void adapter_properties(bt_status_t status,
-                        int num_properties,
-                        bt_property_t *new_properties) {
+    int num_properties,
+    bt_property_t *new_properties) {
   property_free_array(properties, property_count);
   properties = property_copy_array(new_properties, num_properties);
   property_count = num_properties;
@@ -66,7 +85,42 @@ void adapter_properties(bt_status_t status,
 }
 
 // callback
+void bond_state_changed(bt_status_t status,
+    bt_bdaddr_t *bdaddr,
+    bt_bond_state_t state) {
+  bond_state = state;
+  CALLBACK_RET();
+}
+
+// callback
+void device_found(int num_properties, bt_property_t *properties) {
+  CALLBACK_RET();
+}
+
+// callback
 void discovery_state_changed(bt_discovery_state_t state) {
   discovery_state = state;
   CALLBACK_RET();
 }
+
+// callback
+void remote_device_properties(bt_status_t status, bt_bdaddr_t *bd_addr,
+    int num_properties, bt_property_t *properties) {
+  CALLBACK_RET();
+}
+
+// callback
+void ssp_request(
+    bt_bdaddr_t *remote_bd_addr,
+    bt_bdname_t *bd_name,
+    uint32_t cod,
+    bt_ssp_variant_t pairing_variant,
+    uint32_t pass_key) {
+
+  CALLBACK_RET();
+}
+
+// callback
+void thread_evt(bt_cb_thread_evt evt) {
+  CALLBACK_RET();
+}