Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
halo
hardware_libhardware
Commits
68669afe
Commit
68669afe
authored
8 years ago
by
Treehugger Robot
Committed by
Gerrit Code Review
8 years ago
Browse files
Options
Download
Plain Diff
Merge "Convert advertising HAL from struct into class (1/3)"
parents
e1582496
4a635288
master
sdk-release
android-n-mr1-preview-2
android-n-mr1-preview-1
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
58 deletions
+44
-58
include/hardware/ble_advertiser.h
include/hardware/ble_advertiser.h
+43
-54
include/hardware/bt_gatt.h
include/hardware/bt_gatt.h
+1
-4
No files found.
include/hardware/ble_advertiser.h
View file @
68669afe
...
...
@@ -14,68 +14,57 @@
* limitations under the License.
*/
#ifndef ANDROID_INCLUDE_BLE_ADVERTISER_H
#define ANDROID_INCLUDE_BLE_ADVERTISER_H
#include <base/callback_forward.h>
#include <stdint.h>
#include <vector>
#include "bt_gatt_types.h"
#include "bt_common_types.h"
#include "bt_gatt_types.h"
using
std
::
vector
;
__BEGIN_DECLS
/** Callback invoked in response to register_advertiser */
typedef
void
(
*
register_advertiser_callback
)(
int
status
,
int
advertiser_id
,
bt_uuid_t
*
uuid
);
/** Callback invoked when multi-adv param set_params operation has completed */
typedef
void
(
*
multi_adv_set_params_callback
)(
int
advertiser_id
,
int
status
);
/** Callback invoked when multi-adv instance data set operation has completed */
typedef
void
(
*
multi_adv_data_callback
)(
int
advertiser_id
,
int
status
);
/** Callback invoked when multi-adv enable operation has completed */
typedef
void
(
*
multi_adv_enable_callback
)(
int
advertiser_id
,
int
status
,
bool
enable
);
typedef
struct
{
register_advertiser_callback
register_advertiser_cb
;
multi_adv_set_params_callback
multi_adv_set_params_cb
;
multi_adv_data_callback
multi_adv_data_cb
;
multi_adv_enable_callback
multi_adv_enable_cb
;
}
ble_advertiser_callbacks_t
;
typedef
struct
{
/** Registers an advertiser with the stack */
bt_status_t
(
*
register_advertiser
)(
bt_uuid_t
*
uuid
);
/** Unregister a advertiser from the stack */
bt_status_t
(
*
unregister_advertiser
)(
int
advertiser_id
);
/** Set the advertising data or scan response data */
bt_status_t
(
*
set_adv_data
)(
int
advertiser_id
,
bool
set_scan_rsp
,
bool
include_name
,
bool
include_txpower
,
int
min_interval
,
int
max_interval
,
int
appearance
,
vector
<
uint8_t
>
manufacturer_data
,
vector
<
uint8_t
>
service_data
,
vector
<
uint8_t
>
service_uuid
);
/* Set the parameters as per spec, user manual specified values */
bt_status_t
(
*
multi_adv_set_params
)(
int
advertiser_id
,
int
min_interval
,
int
max_interval
,
int
adv_type
,
int
chnl_map
,
int
tx_power
);
/* Setup the data for the specified instance */
bt_status_t
(
*
multi_adv_set_inst_data
)(
int
advertiser_id
,
bool
set_scan_rsp
,
bool
include_name
,
bool
incl_txpower
,
int
appearance
,
vector
<
uint8_t
>
manufacturer_data
,
vector
<
uint8_t
>
service_data
,
vector
<
uint8_t
>
service_uuid
);
/* Enable the advertising instance as per spec */
bt_status_t
(
*
multi_adv_enable
)(
int
advertiser_id
,
bool
enable
,
int
timeout_s
);
}
ble_advertiser_interface_t
;
__END_DECLS
/** Callback invoked when multi-adv operation has completed */
using
BleAdvertiserCb
=
base
::
Callback
<
void
(
uint8_t
/* status */
)
>
;
class
BleAdvertiserInterface
{
public:
virtual
~
BleAdvertiserInterface
()
=
default
;
/** Registers an advertiser with the stack */
virtual
void
RegisterAdvertiser
(
base
::
Callback
<
void
(
uint8_t
/* advertiser_id */
,
uint8_t
/* status */
)
>
)
=
0
;
/* This function disable a Multi-ADV instance */
virtual
void
Unregister
(
uint8_t
advertiser_id
)
=
0
;
/** Set the advertising data or scan response data */
virtual
void
SetData
(
int
advertiser_id
,
bool
set_scan_rsp
,
bool
include_name
,
bool
include_txpower
,
int
min_interval
,
int
max_interval
,
int
appearance
,
vector
<
uint8_t
>
manufacturer_data
,
vector
<
uint8_t
>
service_data
,
vector
<
uint8_t
>
service_uuid
)
=
0
;
/* Set the parameters as per spec, user manual specified values */
virtual
void
MultiAdvSetParameters
(
int
advertiser_id
,
int
min_interval
,
int
max_interval
,
int
adv_type
,
int
chnl_map
,
int
tx_power
,
BleAdvertiserCb
cb
)
=
0
;
/* Setup the data for the specified instance */
virtual
void
MultiAdvSetInstData
(
int
advertiser_id
,
bool
set_scan_rsp
,
bool
include_name
,
bool
incl_txpower
,
int
appearance
,
vector
<
uint8_t
>
manufacturer_data
,
vector
<
uint8_t
>
service_data
,
vector
<
uint8_t
>
service_uuid
,
BleAdvertiserCb
cb
)
=
0
;
/* Enable the advertising instance as per spec */
virtual
void
MultiAdvEnable
(
uint8_t
advertiser_id
,
bool
enable
,
BleAdvertiserCb
cb
,
int
timeout_s
,
BleAdvertiserCb
timeout_cb
)
=
0
;
};
#endif
/* ANDROID_INCLUDE_BLE_ADVERTISER_H */
This diff is collapsed.
Click to expand it.
include/hardware/bt_gatt.h
View file @
68669afe
...
...
@@ -35,9 +35,6 @@ typedef struct {
/** GATT Server callbacks */
const
btgatt_server_callbacks_t
*
server
;
/** Advertiser callbacks */
const
ble_advertiser_callbacks_t
*
advertiser
;
}
btgatt_callbacks_t
;
/** Represents the standard Bluetooth GATT interface. */
...
...
@@ -60,7 +57,7 @@ typedef struct {
const
btgatt_server_interface_t
*
server
;
/** Pointer to the advertiser interface methods.*/
const
ble_a
dvertiser
_i
nterface
_t
*
advertiser
;
BleA
dvertiser
I
nterface
*
advertiser
;
}
btgatt_interface_t
;
__END_DECLS
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment