diff options
-rw-r--r-- | include/hardware/bluetooth.h | 4 | ||||
-rw-r--r-- | include/hardware/bt_sdp.h | 144 | ||||
-rw-r--r-- | include/hardware/bt_sock.h | 34 | ||||
-rw-r--r-- | include/hardware/hwcomposer.h | 27 | ||||
-rw-r--r-- | include/hardware/hwcomposer_defs.h | 1 | ||||
-rw-r--r-- | include/hardware/sensors.h | 50 |
6 files changed, 209 insertions, 51 deletions
diff --git a/include/hardware/bluetooth.h b/include/hardware/bluetooth.h index 75c9e9c..1be4009 100644 --- a/include/hardware/bluetooth.h +++ b/include/hardware/bluetooth.h @@ -46,7 +46,7 @@ __BEGIN_DECLS #define BT_PROFILE_HIDHOST_ID "hidhost" #define BT_PROFILE_PAN_ID "pan" #define BT_PROFILE_MAP_CLIENT_ID "map_client" - +#define BT_PROFILE_SDP_CLIENT_ID "sdp" #define BT_PROFILE_GATT_ID "gatt" #define BT_PROFILE_AV_RC_ID "avrcp" #define BT_PROFILE_AV_RC_CTRL_ID "avrcp_ctrl" @@ -546,6 +546,8 @@ typedef struct { } bluetooth_device_t; typedef bluetooth_device_t bluetooth_module_t; + + __END_DECLS #endif /* ANDROID_INCLUDE_BLUETOOTH_H */ diff --git a/include/hardware/bt_sdp.h b/include/hardware/bt_sdp.h new file mode 100644 index 0000000..d298ad6 --- /dev/null +++ b/include/hardware/bt_sdp.h @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2015 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#pragma once + +#include "bluetooth.h" + +#define SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH 15 + +__BEGIN_DECLS + +/** + * These events are handled by the state machine + */ +typedef enum { + SDP_TYPE_RAW, // Used to carry raw SDP search data for unknown UUID's + SDP_TYPE_MAP_MAS, + SDP_TYPE_MAP_MNS, + SDP_TYPE_PBAP_PSE, + SDP_TYPE_PBAP_PCE, + SDP_TYPE_OPP_SERVER +} bluetooth_sdp_types; + +typedef struct _bluetooth_sdp_hdr { + bluetooth_sdp_types type; + bt_uuid_t uuid; + uint32_t service_name_length; + char *service_name; + int32_t rfcomm_channel_number; + int32_t l2cap_psm; + int32_t profile_version; +} bluetooth_sdp_hdr; + +/** + * Some signals need additional pointers, hence we introduce a + * generic way to handle these pointers. + */ +typedef struct _bluetooth_sdp_hdr_overlay { + bluetooth_sdp_types type; + bt_uuid_t uuid; + uint32_t service_name_length; + char *service_name; + int32_t rfcomm_channel_number; + int32_t l2cap_psm; + int32_t profile_version; + + // User pointers, only used for some signals - see bluetooth_sdp_ops_record + int user1_ptr_len; + uint8_t *user1_ptr; + int user2_ptr_len; + uint8_t *user2_ptr; +} bluetooth_sdp_hdr_overlay; + +typedef struct _bluetooth_sdp_mas_record { + bluetooth_sdp_hdr_overlay hdr; + uint32_t mas_instance_id; + uint32_t supported_features; + uint32_t supported_message_types; +} bluetooth_sdp_mas_record; + +typedef struct _bluetooth_sdp_mns_record { + bluetooth_sdp_hdr_overlay hdr; + uint32_t supported_features; +} bluetooth_sdp_mns_record; + +typedef struct _bluetooth_sdp_pse_record { + bluetooth_sdp_hdr_overlay hdr; + uint32_t supported_features; + uint32_t supported_repositories; +} bluetooth_sdp_pse_record; + +typedef struct _bluetooth_sdp_pce_record { + bluetooth_sdp_hdr_overlay hdr; +} bluetooth_sdp_pce_record; + +typedef struct _bluetooth_sdp_ops_record { + bluetooth_sdp_hdr_overlay hdr; + int supported_formats_list_len; + uint8_t supported_formats_list[SDP_OPP_SUPPORTED_FORMATS_MAX_LENGTH]; +} bluetooth_sdp_ops_record; + +typedef union { + bluetooth_sdp_hdr_overlay hdr; + bluetooth_sdp_mas_record mas; + bluetooth_sdp_mns_record mns; + bluetooth_sdp_pse_record pse; + bluetooth_sdp_pce_record pce; + bluetooth_sdp_ops_record ops; +} bluetooth_sdp_record; + + +/** Callback for SDP search */ +typedef void (*btsdp_search_callback)(bt_status_t status, bt_bdaddr_t *bd_addr, uint8_t* uuid, int num_records, bluetooth_sdp_record *records); + +typedef struct { + /** Set to sizeof(btsdp_callbacks_t) */ + size_t size; + btsdp_search_callback sdp_search_cb; +} btsdp_callbacks_t; + +typedef struct { + /** Set to size of this struct */ + size_t size; + + /** Register BT SDP search callbacks */ + bt_status_t (*init)(btsdp_callbacks_t *callbacks); + + /** Unregister BT SDP */ + bt_status_t (*deinit)(); + + /** Search for SDP records with specific uuid on remote device */ + bt_status_t (*sdp_search)(bt_bdaddr_t *bd_addr, const uint8_t* uuid); + + /** + * Use listen in the socket interface to create rfcomm and/or l2cap PSM channels, + * (without UUID and service_name and set the BTSOCK_FLAG_NO_SDP flag in flags). + * Then use createSdpRecord to create the SDP record associated with the rfcomm/l2cap channels. + * + * Returns a handle to the SDP record, which can be parsed to remove_sdp_record. + * + * record (in) The SDP record to create + * record_handle (out)The corresponding record handle will be written to this pointer. + */ + bt_status_t (*create_sdp_record)(bluetooth_sdp_record *record, int* record_handle); + + /** Remove a SDP record created by createSdpRecord */ + bt_status_t (*remove_sdp_record)(int sdp_handle); +} btsdp_interface_t; + +__END_DECLS + diff --git a/include/hardware/bt_sock.h b/include/hardware/bt_sock.h index a4aa046..1c937d8 100644 --- a/include/hardware/bt_sock.h +++ b/include/hardware/bt_sock.h @@ -14,13 +14,13 @@ * limitations under the License. */ -#ifndef ANDROID_INCLUDE_BT_SOCK_H -#define ANDROID_INCLUDE_BT_SOCK_H +#pragma once __BEGIN_DECLS #define BTSOCK_FLAG_ENCRYPT 1 #define BTSOCK_FLAG_AUTH (1 << 1) +#define BTSOCK_FLAG_NO_SDP (1 << 2) typedef enum { BTSOCK_RFCOMM = 1, @@ -34,25 +34,37 @@ typedef struct { bt_bdaddr_t bd_addr; int channel; int status; + + // The writer must make writes using a buffer of this maximum size + // to avoid loosing data. (L2CAP only) + unsigned short max_tx_packet_size; + + // The reader must read using a buffer of at least this size to avoid + // loosing data. (L2CAP only) + unsigned short max_rx_packet_size; } __attribute__((packed)) sock_connect_signal_t; typedef struct { - /** set to size of this struct*/ size_t size; + /** - * listen to a rfcomm uuid or channel. It returns the socket fd from which - * btsock_connect_signal can be read out when a remote device connected + * Listen to a RFCOMM UUID or channel. It returns the socket fd from which + * btsock_connect_signal can be read out when a remote device connected. + * If neither a UUID nor a channel is provided, a channel will be allocated + * and a service record can be created providing the channel number to + * create_sdp_record(...) in bt_sdp. */ - bt_status_t (*listen)(btsock_type_t type, const char* service_name, const uint8_t* service_uuid, int channel, int* sock_fd, int flags); - /* - * connect to a rfcomm uuid channel of remote device, It returns the socket fd from which + bt_status_t (*listen)(btsock_type_t type, const char* service_name, + const uint8_t* service_uuid, int channel, int* sock_fd, int flags); + + /** + * Connect to a RFCOMM UUID channel of remote device, It returns the socket fd from which * the btsock_connect_signal and a new socket fd to be accepted can be read out when connected */ - bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t* uuid, int channel, int* sock_fd, int flags); - + bt_status_t (*connect)(const bt_bdaddr_t *bd_addr, btsock_type_t type, const uint8_t* uuid, + int channel, int* sock_fd, int flags); } btsock_interface_t; __END_DECLS -#endif /* ANDROID_INCLUDE_BT_SOCK_H */ diff --git a/include/hardware/hwcomposer.h b/include/hardware/hwcomposer.h index 3dfb4fd..aa466b3 100644 --- a/include/hardware/hwcomposer.h +++ b/include/hardware/hwcomposer.h @@ -299,8 +299,29 @@ typedef struct hwc_layer_1 { */ uint8_t planeAlpha; - /* reserved for future use */ + /* Pad to 32 bits */ uint8_t _pad[3]; + + /* + * Availability: HWC_DEVICE_API_VERSION_1_5 + * + * This defines the region of the source buffer that has been + * modified since the last frame. + * + * If surfaceDamage.numRects > 0, then it may be assumed that any + * portion of the source buffer not covered by one of the rects has + * not been modified this frame. If surfaceDamage.numRects == 0, + * then the whole source buffer must be treated as if it had been + * modified. + * + * If the layer's contents are not modified relative to the prior + * prepare/set cycle, surfaceDamage will contain exactly one empty + * rect ([0, 0, 0, 0]). + * + * The damage rects are relative to the pre-transformed buffer, and + * their origin is the top-left corner. + */ + hwc_region_t surfaceDamage; }; }; @@ -309,13 +330,13 @@ typedef struct hwc_layer_1 { * For 64-bit mode, this struct is 120 bytes (and 8-byte aligned), and needs * to be padded as such to maintain binary compatibility. */ - uint8_t reserved[120 - 96]; + uint8_t reserved[120 - 112]; #else /* * For 32-bit mode, this struct is 96 bytes, and needs to be padded as such * to maintain binary compatibility. */ - uint8_t reserved[96 - 76]; + uint8_t reserved[96 - 84]; #endif } hwc_layer_1_t; diff --git a/include/hardware/hwcomposer_defs.h b/include/hardware/hwcomposer_defs.h index 9a52436..e650bd2 100644 --- a/include/hardware/hwcomposer_defs.h +++ b/include/hardware/hwcomposer_defs.h @@ -37,6 +37,7 @@ __BEGIN_DECLS #define HWC_DEVICE_API_VERSION_1_2 HARDWARE_DEVICE_API_VERSION_2(1, 2, HWC_HEADER_VERSION) #define HWC_DEVICE_API_VERSION_1_3 HARDWARE_DEVICE_API_VERSION_2(1, 3, HWC_HEADER_VERSION) #define HWC_DEVICE_API_VERSION_1_4 HARDWARE_DEVICE_API_VERSION_2(1, 4, HWC_HEADER_VERSION) +#define HWC_DEVICE_API_VERSION_1_5 HARDWARE_DEVICE_API_VERSION_2(1, 5, HWC_HEADER_VERSION) enum { /* hwc_composer_device_t::set failed in EGL */ diff --git a/include/hardware/sensors.h b/include/hardware/sensors.h index 90036b6..b8b550f 100644 --- a/include/hardware/sensors.h +++ b/include/hardware/sensors.h @@ -95,7 +95,7 @@ enum { /* * Availability: SENSORS_DEVICE_API_VERSION_1_4 - * Sensor HAL modes uses in set_operation_mode method + * Sensor HAL modes used in set_operation_mode method */ enum { /* @@ -108,7 +108,8 @@ enum { */ SENSOR_HAL_NORMAL_MODE = 0, - /* Loopback mode. In this mode, the device shall not source data from the + /* + * Loopback mode. In this mode, the device shall not source data from the * physical sensors as it would in normal mode. Instead sensor data is * injected by the sensor service. */ @@ -642,36 +643,6 @@ enum { #define SENSOR_STRING_TYPE_WRIST_TILT_GESTURE "android.sensor.wrist_tilt_gesture" /** - * SENSOR_TYPE_TIME_SYNC - * reporting-mode: continuous - * - * A time synchronization mechanism sensor to synchronize timing between - * differnt parts of the device. - * This sensor returns the following values in the sensor_event - * Time_stamp of the event - * u64.data[0] -> Type of event latched - * u64.data[1] -> count - * - * Implement only the wake-up version of this sensor. - */ -#define SENSOR_TYPE_TIME_SYNC (SENSOR_TYPE_DEVICE_PRIVATE_BASE + 0x10) -#define SENSOR_STRING_TYPE_TIME_SYNC "android.sensor.time_sync" - -/** - * SENSOR_TYPE_NUDGE_GESTURE - * reporting-mode: one-shot - * - * A sensor of this type triggers when the device is nudged. - * - * The only allowed return value is 1.0. This sensor - * de-activates itself immediately after it triggers. - * - * Implement only the wake-up version of this sensor. - */ -#define SENSOR_TYPE_NUDGE_GESTURE (SENSOR_TYPE_DEVICE_PRIVATE_BASE + 0x11) -#define SENSOR_STRING_NUDGE_UP_GESTURE "android.sensor.nudge_gesture" - -/** * Values returned by the accelerometer in various locations in the universe. * all values are in SI units (m/s^2) */ @@ -864,9 +835,12 @@ struct sensors_module_t { /** * Place the module in a specific mode. The following modes are defined * - * 0 - Normal operation. Default state of the module. - * 1 - Loopback mode. Data is injected for the the supported sensors by - * the sensor service in this mode. + * 0 - Normal operation. Default state of the module. + * 1 - Loopback mode. Data is injected for the the supported + * sensors by the sensor service in this mode. + * @return 0 on success + * -EINVAL if requested mode is not supported + * -EPERM if operation is not allowed */ int (*set_operation_mode)(unsigned int mode); }; @@ -1067,7 +1041,11 @@ typedef struct sensors_poll_device_1 { int (*flush)(struct sensors_poll_device_1* dev, int sensor_handle); /* - * Inject a sensor samples to be to this device. + * Inject a single sensor sample to be to this device. + * data points to the sensor event to be injected + * @return 0 on success + * -EPERM if operation is not allowed + * -EINVAL if sensor event cannot be injected */ int (*inject_sensor_data)(struct sensors_poll_device_1 *dev, const sensors_event_t *data); |