From 93ce464cee7f8eaa315823ba63922285902be445 Mon Sep 17 00:00:00 2001 From: Andelf Date: Tue, 21 Nov 2023 19:04:47 +0800 Subject: [PATCH] enhance(ble): refine types --- Cargo.toml | 2 +- examples/ble-peripheral-simple.rs | 24 +++---- examples/ble-peripheral.rs | 5 +- examples/uart-echo.rs | 1 - src/ble/ffi.rs | 101 +++--------------------------- src/ble/gatt_uuid.rs | 73 +++++++++++---------- src/ble/gattservapp.rs | 57 ++++++----------- 7 files changed, 77 insertions(+), 186 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4c8631d..9e5d02f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ readme = "README.md" license = "MIT/Apache-2.0" [features] -default = [] +default = ["ble", "embassy"] embassy = ["dep:embassy-time"] ble = [] diff --git a/examples/ble-peripheral-simple.rs b/examples/ble-peripheral-simple.rs index 0272e83..a3d0b58 100644 --- a/examples/ble-peripheral-simple.rs +++ b/examples/ble-peripheral-simple.rs @@ -106,56 +106,56 @@ const DEVINFO_SYSTEM_ID_LEN: usize = 8; // The list must start with a Service attribute followed by // all attributes associated with this Service attribute. -static DEVICE_INFO_TABLE: &[gattAttribute_t] = &[ +static DEVICE_INFO_TABLE: &[GattAttribute] = &[ // Device Information Service - gattAttribute_t { + GattAttribute { type_: gattAttrType_t { len: ATT_BT_UUID_SIZE, uuid: unsafe { primaryServiceUUID.as_ptr() }, }, permissions: GATT_PERMIT_READ, handle: 0, - pValue: &DEV_INFO_SERVICE as *const _ as _, + value: &DEV_INFO_SERVICE as *const _ as _, }, // System ID Declaration - gattAttribute_t { + GattAttribute { type_: gattAttrType_t { len: ATT_BT_UUID_SIZE, uuid: unsafe { characterUUID.as_ptr() }, }, permissions: GATT_PERMIT_READ, handle: 0, - pValue: &GATT_PROP_READ as *const _ as _, + value: &GATT_PROP_READ as *const _ as _, }, // System ID Value - gattAttribute_t { + GattAttribute { type_: gattAttrType_t { len: ATT_BT_UUID_SIZE, uuid: &hal::ble::gatt_uuid::SYSTEM_ID_UUID as *const _ as _, }, permissions: GATT_PERMIT_READ, handle: 0, - pValue: [0, 0, 0, 0, 0, 0, 0, 0].as_ptr() as *const _ as _, // 8 bytes + value: [0, 0, 0, 0, 0, 0, 0, 0].as_ptr() as *const _ as _, // 8 bytes }, // Serial Number String Declaration - gattAttribute_t { + GattAttribute { type_: gattAttrType_t { len: ATT_BT_UUID_SIZE, uuid: unsafe { characterUUID.as_ptr() }, }, permissions: GATT_PERMIT_READ, handle: 0, - pValue: &GATT_PROP_READ as *const _ as _, + value: &GATT_PROP_READ as *const _ as _, }, // Serial Number Value - gattAttribute_t { + GattAttribute { type_: gattAttrType_t { len: ATT_BT_UUID_SIZE, uuid: &hal::ble::gatt_uuid::SERIAL_NUMBER_UUID as *const _ as _, }, permissions: GATT_PERMIT_READ, handle: 0, - pValue: b"Serial Number xxxx\0".as_ptr() as *const _ as _, + value: b"Serial Number xxxx\0".as_ptr() as *const _ as _, }, ]; @@ -226,7 +226,7 @@ fn peripheral_init() { unsafe { unsafe extern "C" fn on_read_attr( connHandle: u16, - pAttr: *mut gattAttribute_t, + pAttr: *mut GattAttribute, pValue: *mut u8, pLen: *mut u16, offset: u16, diff --git a/examples/ble-peripheral.rs b/examples/ble-peripheral.rs index a201da3..57143d7 100644 --- a/examples/ble-peripheral.rs +++ b/examples/ble-peripheral.rs @@ -135,10 +135,7 @@ fn peripheral_init() { // Initialize GATT attributes unsafe { GGS_AddService(GATT_ALL_SERVICES); // GAP - GATTServApp_AddService(GATT_ALL_SERVICES); // GATT attributes - - //DevInfo_AddService(); // Device Information Service - //SimpleProfile_AddService(GATT_ALL_SERVICES); // Simple GATT Profile + GATTServApp::add_service(GATT_ALL_SERVICES); // GATT attributes } // Setup the SimpleProfile Characteristic Values diff --git a/examples/uart-echo.rs b/examples/uart-echo.rs index 0f56e24..611ff98 100644 --- a/examples/uart-echo.rs +++ b/examples/uart-echo.rs @@ -3,7 +3,6 @@ use ch32v_rt::highcode; use ch58x_hal as hal; - use hal::gpio::{Level, Output, OutputDrive}; use hal::peripherals; use hal::rtc::Rtc; diff --git a/src/ble/ffi.rs b/src/ble/ffi.rs index c0c2762..1217751 100644 --- a/src/ble/ffi.rs +++ b/src/ble/ffi.rs @@ -50,39 +50,6 @@ pub type tmosEvents = u16; pub type tmosTimer = u32; pub type BOOL = u8; -// UUID defined -extern "C" { - // GATT Services - pub static gapServiceUUID: [u8; 2]; - pub static gattServiceUUID: [u8; 2]; - - // GATT Attribute Types - pub static primaryServiceUUID: [u8; 2]; - pub static secondaryServiceUUID: [u8; 2]; - pub static includeUUID: [u8; 2]; - pub static characterUUID: [u8; 2]; - - // GATT Characteristic Descriptors - pub static charExtPropsUUID: [u8; 2]; - pub static charUserDescUUID: [u8; 2]; - pub static clientCharCfgUUID: [u8; 2]; - pub static servCharCfgUUID: [u8; 2]; - pub static charFormatUUID: [u8; 2]; - pub static charAggFormatUUID: [u8; 2]; - pub static validRangeUUID: [u8; 2]; - pub static extReportRefUUID: [u8; 2]; - pub static reportRefUUID: [u8; 2]; - - // GATT Characteristic Types - pub static deviceNameUUID: [u8; 2]; - pub static appearanceUUID: [u8; 2]; - pub static periPrivacyFlagUUID: [u8; 2]; - pub static reconnectAddrUUID: [u8; 2]; - pub static periConnParamUUID: [u8; 2]; - pub static serviceChangedUUID: [u8; 2]; - pub static centAddrResUUID: [u8; 2]; -} - /*** Opcode fields: bitmasks ***/ /// Size of 16-bit Bluetooth UUID pub const ATT_BT_UUID_SIZE: u8 = 2; @@ -803,7 +770,7 @@ pub const GATT_MAX_ENCRYPT_KEY_SIZE: u8 = 16; pub type pfnGATTReadAttrCB_t = Option< unsafe extern "C" fn( connHandle: u16, - pAttr: *mut gattAttribute_t, + pAttr: *mut GattAttribute, pValue: *mut u8, pLen: *mut u16, offset: u16, @@ -815,7 +782,7 @@ pub type pfnGATTReadAttrCB_t = Option< pub type pfnGATTWriteAttrCB_t = Option< unsafe extern "C" fn( connHandle: u16, - pAttr: *mut gattAttribute_t, + pAttr: *mut GattAttribute, pValue: *mut u8, len: u16, offset: u16, @@ -824,7 +791,7 @@ pub type pfnGATTWriteAttrCB_t = Option< >; #[doc = " @brief Callback function prototype to authorize a Read or Write operation\n on a given attribute.\n\n @param connHandle - connection request was received on\n @param pAttr - pointer to attribute\n @param opcode - request opcode (ATT_READ_REQ or ATT_WRITE_REQ)\n\n @return SUCCESS: Operation authorized.
\n ATT_ERR_INSUFFICIENT_AUTHOR: Authorization required.
"] pub type pfnGATTAuthorizeAttrCB_t = - Option bStatus_t>; + Option bStatus_t>; #[doc = " GATT Attribute Type format."] #[repr(C)] @@ -839,10 +806,11 @@ pub struct gattAttrType_t { unsafe impl Sync for gattAttrType_t {} unsafe impl Send for gattAttrType_t {} +// Renamed from gattAttribute_t #[doc = " GATT Attribute format."] #[repr(C)] #[derive(Debug, Copy, Clone)] -pub struct gattAttribute_t { +pub struct GattAttribute { #[doc = "!< Attribute type (2 or 16 octet UUIDs)"] pub type_: gattAttrType_t, #[doc = "!< Attribute permissions"] @@ -850,61 +818,8 @@ pub struct gattAttribute_t { #[doc = "!< Attribute handle - assigned internally by attribute server"] pub handle: u16, #[doc = "!< Attribute value - encoding of the octet array is defined in\n!< the applicable profile. The maximum length of an attribute\n!< value shall be 512 octets."] - pub pValue: *const u8, -} - -unsafe impl Sync for gattAttribute_t {} -unsafe impl Send for gattAttribute_t {} - -#[doc = " GATT Structure for service callback functions - must be setup by the application\n and used when GATTServApp_RegisterService() is called."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct gattServiceCBs_t { - #[doc = "!< Read callback function pointer. pfnGATTReadAttrCB_t"] - pub pfnReadAttrCB: pfnGATTReadAttrCB_t, - #[doc = "!< Write callback function pointer"] - pub pfnWriteAttrCB: pfnGATTWriteAttrCB_t, - #[doc = "!< Authorization callback function pointer"] - pub pfnAuthorizeAttrCB: pfnGATTAuthorizeAttrCB_t, -} - -#[doc = " GATT Structure for Client Characteristic Configuration."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct gattCharCfg_t { - #[doc = "!< Client connection handle"] - pub connHandle: u16, - #[doc = "!< Characteristic configuration value for this client"] - pub value: u8, + pub value: *const u8, } -extern "C" { - #[doc = " @brief Register a service's attribute list and callback functions with\n the GATT Server Application.\n\n @param pAttrs - Array of attribute records to be registered\n @param numAttrs - Number of attributes in array\n @param encKeySize - Minimum encryption key size required by service (7-16 bytes)\n @param pServiceCBs - Service callback function pointers\n\n @return SUCCESS: Service registered successfully.
\n INVALIDPARAMETER: Invalid service fields.
\n FAILURE: Not enough attribute handles available.
\n bleMemAllocError: Memory allocation error occurred.
\n bleInvalidRange: Encryption key size's out of range.
"] - pub fn GATTServApp_RegisterService( - pAttrs: *mut gattAttribute_t, - numAttrs: u16, - encKeySize: u8, - pServiceCBs: *const gattServiceCBs_t, - ) -> bStatus_t; - #[doc = " @brief Add function for the GATT Service.\n\n @param services - services to add. This is a bit map and can\n contain more than one service.\n\n @return SUCCESS: Service added successfully.
\n INVALIDPARAMETER: Invalid service field.
\n FAILURE: Not enough attribute handles available.
\n bleMemAllocError: Memory allocation error occurred.
"] - pub fn GATTServApp_AddService(services: u32) -> bStatus_t; - #[doc = " @brief Deregister a service's attribute list and callback functions from\n the GATT Server Application.\n\n @note It's the caller's responsibility to free the service attribute\n list returned from this API.\n\n @param handle - handle of service to be deregistered\n @param p2pAttrs - pointer to array of attribute records (to be returned)\n\n @return SUCCESS: Service deregistered successfully.
\n FAILURE: Service not found.
"] - pub fn GATTServApp_DeregisterService(handle: u16, p2pAttrs: *mut *mut gattAttribute_t) -> bStatus_t; - #[doc = " @brief Initialize the client characteristic configuration table.\n\n @note Each client has its own instantiation of the ClientCharacteristic Configuration.\n Reads/Writes of the Client Characteristic Configuration only only affect the\n configuration of that client.\n\n @param connHandle - connection handle (0xFFFF for all connections).\n @param charCfgTbl - client characteristic configuration table.\n\n @return none"] - pub fn GATTServApp_InitCharCfg(connHandle: u16, charCfgTbl: *mut gattCharCfg_t); - #[doc = " @brief Send out a Service Changed Indication.\n\n @param connHandle - connection to use\n @param taskId - task to be notified of confirmation\n\n @return SUCCESS: Indication was sent successfully.
\n FAILURE: Service Changed attribute not found.
\n INVALIDPARAMETER: Invalid connection handle or request field.
\n MSG_BUFFER_NOT_AVAIL: No HCI buffer is available.
\n bleNotConnected: Connection is down.
\n blePending: A confirmation is pending with this client.
"] - pub fn GATTServApp_SendServiceChangedInd(connHandle: u16, taskId: u8) -> bStatus_t; - #[doc = " @brief Read the client characteristic configuration for a given client.\n\n @note Each client has its own instantiation of the Client Characteristic Configuration.\n Reads of the Client Characteristic Configuration only shows the configuration\n for that client.\n\n @param connHandle - connection handle.\n @param charCfgTbl - client characteristic configuration table.\n\n @return attribute value"] - pub fn GATTServApp_ReadCharCfg(connHandle: u16, charCfgTbl: *mut gattCharCfg_t) -> u16; - #[doc = " @brief Write the client characteristic configuration for a given client.\n\n @note Each client has its own instantiation of the Client Characteristic Configuration.\n Writes of the Client Characteristic Configuration only only affect the\n configuration of that client.\n\n @param connHandle - connection handle.\n @param charCfgTbl - client characteristic configuration table.\n @param value - attribute new value.\n\n @return Success or Failure"] - pub fn GATTServApp_WriteCharCfg(connHandle: u16, charCfgTbl: *mut gattCharCfg_t, value: u16) -> u8; - #[doc = " @brief Process the client characteristic configuration\n write request for a given client.\n\n @param connHandle - connection message was received on.\n @param pAttr - pointer to attribute.\n @param pValue - pointer to data to be written.\n @param len - length of data.\n @param offset - offset of the first octet to be written.\n @param validCfg - valid configuration.\n\n @return Success or Failure"] - pub fn GATTServApp_ProcessCCCWriteReq( - connHandle: u16, - pAttr: *mut gattAttribute_t, - pValue: *mut u8, - len: u16, - offset: u16, - validCfg: u16, - ) -> bStatus_t; -} +unsafe impl Sync for GattAttribute {} +unsafe impl Send for GattAttribute {} diff --git a/src/ble/gatt_uuid.rs b/src/ble/gatt_uuid.rs index c9b5ed1..0d02a01 100644 --- a/src/ble/gatt_uuid.rs +++ b/src/ble/gatt_uuid.rs @@ -3,7 +3,43 @@ //! The 16-bit UUIDs are assigned by the Bluetooth SIG and published //! in the Bluetooth Assigned Numbers page. Do not change these values. //! Changing them will cause Bluetooth interoperability issues. +//! +//! Ref: https://www.bluetooth.com/specifications/assigned-numbers/ + +// UUID defined +extern "C" { + // GATT Services + /// 1800 + pub static gapServiceUUID: [u8; 2usize]; + /// 1801 + pub static gattServiceUUID: [u8; 2usize]; + // GATT Attribute Types + pub static primaryServiceUUID: [u8; 2usize]; + pub static secondaryServiceUUID: [u8; 2usize]; + pub static includeUUID: [u8; 2usize]; + pub static characterUUID: [u8; 2usize]; + + // GATT Characteristic Descriptors + pub static charExtPropsUUID: [u8; 2usize]; + pub static charUserDescUUID: [u8; 2usize]; + pub static clientCharCfgUUID: [u8; 2usize]; + pub static servCharCfgUUID: [u8; 2usize]; + pub static charFormatUUID: [u8; 2usize]; + pub static charAggFormatUUID: [u8; 2usize]; + pub static validRangeUUID: [u8; 2usize]; + pub static extReportRefUUID: [u8; 2usize]; + pub static reportRefUUID: [u8; 2usize]; + + // GATT Characteristic Types + pub static deviceNameUUID: [u8; 2usize]; + pub static appearanceUUID: [u8; 2usize]; + pub static periPrivacyFlagUUID: [u8; 2usize]; + pub static reconnectAddrUUID: [u8; 2usize]; + pub static periConnParamUUID: [u8; 2usize]; + pub static serviceChangedUUID: [u8; 2usize]; + pub static centAddrResUUID: [u8; 2usize]; +} /** * GATT Services */ @@ -45,43 +81,6 @@ pub const RL_PRIVATE_ADDR_ONLY_UUID: u16 = 0x2AC9; // Resolvable Private Address pub const ENC_DATA_KEY_MATERIAL_UUID: u16 = 0x2B88; // Encrypted Data Key Material pub const LE_GATT_SEC_LEVELS_UUID: u16 = 0x2BF5; // LE GATT Security Levels -// UUID defined -extern "C" { - // [u8; 2] - - // GATT Services - /// 1800 - pub static gapServiceUUID: [u8; 0usize]; - /// 1801 - pub static gattServiceUUID: [u8; 0usize]; - - // GATT Attribute Types - pub static primaryServiceUUID: [u8; 0usize]; - pub static secondaryServiceUUID: [u8; 0usize]; - pub static includeUUID: [u8; 0usize]; - pub static characterUUID: [u8; 0usize]; - - // GATT Characteristic Descriptors - pub static charExtPropsUUID: [u8; 0usize]; - pub static charUserDescUUID: [u8; 0usize]; - pub static clientCharCfgUUID: [u8; 0usize]; - pub static servCharCfgUUID: [u8; 0usize]; - pub static charFormatUUID: [u8; 0usize]; - pub static charAggFormatUUID: [u8; 0usize]; - pub static validRangeUUID: [u8; 0usize]; - pub static extReportRefUUID: [u8; 0usize]; - pub static reportRefUUID: [u8; 0usize]; - - // GATT Characteristic Types - pub static deviceNameUUID: [u8; 0usize]; - pub static appearanceUUID: [u8; 0usize]; - pub static periPrivacyFlagUUID: [u8; 0usize]; - pub static reconnectAddrUUID: [u8; 0usize]; - pub static periConnParamUUID: [u8; 0usize]; - pub static serviceChangedUUID: [u8; 0usize]; - pub static centAddrResUUID: [u8; 0usize]; -} - /** * GATT Service UUIDs */ diff --git a/src/ble/gattservapp.rs b/src/ble/gattservapp.rs index 4b7e55b..025b25a 100644 --- a/src/ble/gattservapp.rs +++ b/src/ble/gattservapp.rs @@ -2,7 +2,15 @@ //! //! This module implements the GATT Server App. -use super::ffi::bStatus_t; +#![allow( + non_camel_case_types, + non_snake_case, + non_upper_case_globals, + unused_variables, + non_camel_case_types +)] + +use super::ffi::{bStatus_t, GattAttribute}; // GATT Characteristic Properties Bit Fields pub const GATT_PROP_BCAST: u32 = 1; @@ -39,7 +47,7 @@ pub const GATT_PERMIT_ENCRYPT_WRITE: u8 = 128; pub type pfnGATTReadAttrCB_t = Option< unsafe extern "C" fn( conn_handle: u16, - pAttr: *mut gattAttribute_t, + pAttr: *mut GattAttribute, pValue: *mut u8, pLen: *mut u16, offset: u16, @@ -51,7 +59,7 @@ pub type pfnGATTReadAttrCB_t = Option< pub type pfnGATTWriteAttrCB_t = Option< unsafe extern "C" fn( connHandle: u16, - pAttr: *mut gattAttribute_t, + pAttr: *mut GattAttribute, pValue: *mut u8, len: u16, offset: u16, @@ -60,33 +68,7 @@ pub type pfnGATTWriteAttrCB_t = Option< >; #[doc = " @brief Callback function prototype to authorize a Read or Write operation\n on a given attribute.\n\n @param connHandle - connection request was received on\n @param pAttr - pointer to attribute\n @param opcode - request opcode (ATT_READ_REQ or ATT_WRITE_REQ)\n\n @return SUCCESS: Operation authorized.
\n ATT_ERR_INSUFFICIENT_AUTHOR: Authorization required.
"] pub type pfnGATTAuthorizeAttrCB_t = - Option bStatus_t>; - -#[doc = " GATT Attribute Type format."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct gattAttrType_t { - #[doc = "!< Length of UUID (2 or 16)"] - pub len: u8, - #[doc = "!< Pointer to UUID"] - pub uuid: *const u8, -} -#[doc = " GATT Attribute format."] -#[repr(C)] -#[derive(Debug, Copy, Clone)] -pub struct gattAttribute_t { - #[doc = "!< Attribute type (2 or 16 octet UUIDs)"] - pub type_: gattAttrType_t, - #[doc = "!< Attribute permissions"] - pub permissions: u8, - #[doc = "!< Attribute handle - assigned internally by attribute server"] - pub handle: u16, - #[doc = "!< Attribute value - encoding of the octet array is defined in\n!< the applicable profile. The maximum length of an attribute\n!< value shall be 512 octets."] - pub pValue: *mut u8, -} - -unsafe impl Send for gattAttribute_t {} -unsafe impl Sync for gattAttribute_t {} + Option bStatus_t>; #[doc = " GATT Structure for service callback functions - must be setup by the application\n and used when GATTServApp_RegisterService() is called."] #[repr(C)] @@ -115,12 +97,11 @@ pub struct GATTServApp; impl GATTServApp { #[inline] pub fn register_service( - attrs: *mut gattAttribute_t, - num_attrs: u16, + attrs: &'static mut [GattAttribute], enc_key_size: u8, service_cbs: &'static gattServiceCBs_t, ) -> bStatus_t { - unsafe { ffi::GATTServApp_RegisterService(attrs, num_attrs, enc_key_size, service_cbs) } + unsafe { ffi::GATTServApp_RegisterService(attrs.as_mut_ptr(), attrs.len() as _, enc_key_size, service_cbs) } } #[inline] @@ -129,7 +110,7 @@ impl GATTServApp { } #[inline] - pub fn deregister_service(handle: u16, p2pAttrs: *mut *mut gattAttribute_t) -> bStatus_t { + pub fn deregister_service(handle: u16, p2pAttrs: *mut *mut GattAttribute) -> bStatus_t { unsafe { ffi::GATTServApp_DeregisterService(handle, p2pAttrs) } } @@ -157,7 +138,7 @@ impl GATTServApp { #[inline] pub fn process_ccc_write_req( connHandle: u16, - pAttr: *mut gattAttribute_t, + pAttr: *mut GattAttribute, pValue: *mut u8, len: u16, offset: u16, @@ -172,7 +153,7 @@ mod ffi { extern "C" { #[doc = " @brief Register a service's attribute list and callback functions with\n the GATT Server Application.\n\n @param pAttrs - Array of attribute records to be registered\n @param numAttrs - Number of attributes in array\n @param encKeySize - Minimum encryption key size required by service (7-16 bytes)\n @param pServiceCBs - Service callback function pointers\n\n @return SUCCESS: Service registered successfully.
\n INVALIDPARAMETER: Invalid service fields.
\n FAILURE: Not enough attribute handles available.
\n bleMemAllocError: Memory allocation error occurred.
\n bleInvalidRange: Encryption key size's out of range.
"] pub fn GATTServApp_RegisterService( - pAttrs: *mut gattAttribute_t, + pAttrs: *mut GattAttribute, numAttrs: u16, encKeySize: u8, pServiceCBs: *const gattServiceCBs_t, @@ -180,7 +161,7 @@ mod ffi { #[doc = " @brief Add function for the GATT Service.\n\n @param services - services to add. This is a bit map and can\n contain more than one service.\n\n @return SUCCESS: Service added successfully.
\n INVALIDPARAMETER: Invalid service field.
\n FAILURE: Not enough attribute handles available.
\n bleMemAllocError: Memory allocation error occurred.
"] pub fn GATTServApp_AddService(services: u32) -> bStatus_t; #[doc = " @brief Deregister a service's attribute list and callback functions from\n the GATT Server Application.\n\n @note It's the caller's responsibility to free the service attribute\n list returned from this API.\n\n @param handle - handle of service to be deregistered\n @param p2pAttrs - pointer to array of attribute records (to be returned)\n\n @return SUCCESS: Service deregistered successfully.
\n FAILURE: Service not found.
"] - pub fn GATTServApp_DeregisterService(handle: u16, p2pAttrs: *mut *mut gattAttribute_t) -> bStatus_t; + pub fn GATTServApp_DeregisterService(handle: u16, p2pAttrs: *mut *mut GattAttribute) -> bStatus_t; #[doc = " @brief Initialize the client characteristic configuration table.\n\n @note Each client has its own instantiation of the ClientCharacteristic Configuration.\n Reads/Writes of the Client Characteristic Configuration only only affect the\n configuration of that client.\n\n @param connHandle - connection handle (0xFFFF for all connections).\n @param charCfgTbl - client characteristic configuration table.\n\n @return none"] pub fn GATTServApp_InitCharCfg(connHandle: u16, charCfgTbl: *mut gattCharCfg_t); #[doc = " @brief Send out a Service Changed Indication.\n\n @param connHandle - connection to use\n @param taskId - task to be notified of confirmation\n\n @return SUCCESS: Indication was sent successfully.
\n FAILURE: Service Changed attribute not found.
\n INVALIDPARAMETER: Invalid connection handle or request field.
\n MSG_BUFFER_NOT_AVAIL: No HCI buffer is available.
\n bleNotConnected: Connection is down.
\n blePending: A confirmation is pending with this client.
"] @@ -192,7 +173,7 @@ mod ffi { #[doc = " @brief Process the client characteristic configuration\n write request for a given client.\n\n @param connHandle - connection message was received on.\n @param pAttr - pointer to attribute.\n @param pValue - pointer to data to be written.\n @param len - length of data.\n @param offset - offset of the first octet to be written.\n @param validCfg - valid configuration.\n\n @return Success or Failure"] pub fn GATTServApp_ProcessCCCWriteReq( connHandle: u16, - pAttr: *mut gattAttribute_t, + pAttr: *mut GattAttribute, pValue: *mut u8, len: u16, offset: u16,