Skip to content

nimble/host: Fix some codestyle in public host headers #2070

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions nimble/host/include/host/ble_cs.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,12 @@

struct ble_cs_event {
uint8_t type;
union
{
struct
{
union {
struct {
uint16_t conn_handle;
uint8_t status;
} procedure_complete;
};

};

typedef int ble_cs_event_fn(struct ble_cs_event *event, void *arg);
Expand All @@ -45,7 +42,6 @@ struct ble_cs_initiator_procedure_start_params {
ble_cs_event_fn *cb;
void *cb_arg;
};

struct ble_cs_reflector_setup_params {
ble_cs_event_fn *cb;
void *cb_arg;
Expand Down
102 changes: 52 additions & 50 deletions nimble/host/include/host/ble_gap.h
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,7 @@ struct ble_gap_ext_disc_desc {
*/
ble_addr_t direct_addr;
};

#endif

/** @brief Advertising report */
Expand Down Expand Up @@ -872,7 +873,7 @@ struct ble_gap_event {
* o 0: Notification;
* o 1: Indication.
*/
uint8_t indication:1;
uint8_t indication : 1;
} notify_rx;

/**
Expand All @@ -888,7 +889,7 @@ struct ble_gap_event {
* o 0: Command successfully sent;
* o BLE_HS_EDONE: Confirmation (indication ack) received;
* o BLE_HS_ETIMEOUT: Confirmation (indication ack) never
* received;
* received;
* o Other return code: Error.
*/
int status;
Expand All @@ -905,7 +906,7 @@ struct ble_gap_event {
* o 0: Notification;
* o 1: Indication.
*/
uint8_t indication:1;
uint8_t indication : 1;
} notify_tx;

/**
Expand Down Expand Up @@ -933,16 +934,16 @@ struct ble_gap_event {
uint8_t reason;

/** Whether the peer was previously subscribed to notifications. */
uint8_t prev_notify:1;
uint8_t prev_notify : 1;

/** Whether the peer is currently subscribed to notifications. */
uint8_t cur_notify:1;
uint8_t cur_notify : 1;

/** Whether the peer was previously subscribed to indications. */
uint8_t prev_indicate:1;
uint8_t prev_indicate : 1;

/** Whether the peer is currently subscribed to indications. */
uint8_t cur_indicate:1;
uint8_t cur_indicate : 1;
} subscribe;

/**
Expand Down Expand Up @@ -1036,7 +1037,7 @@ struct ble_gap_event {
* - BLE_HCI_LE_PHY_1M
* - LE_HCI_LE_PHY_2M
* - BLE_HCI_LE_PHY_CODED
*/
*/
uint8_t adv_phy;

/** Periodic advertising interval */
Expand Down Expand Up @@ -1103,6 +1104,7 @@ struct ble_gap_event {
struct {
/** Extended advertising instance */
uint8_t instance;

/** Address of scanner */
ble_addr_t scan_addr;
} scan_req_rcvd;
Expand Down Expand Up @@ -1138,7 +1140,7 @@ struct ble_gap_event {
* - BLE_HCI_LE_PHY_1M
* - LE_HCI_LE_PHY_2M
* - BLE_HCI_LE_PHY_CODED
*/
*/
uint8_t adv_phy;

/** Periodic advertising interval */
Expand Down Expand Up @@ -1204,45 +1206,45 @@ struct ble_gap_event {
* o BLE_GAP_EVENT_PATHLOSS_THRESHOLD
*/

struct {
/** Connection handle */
uint16_t conn_handle;
struct {
/** Connection handle */
uint16_t conn_handle;

/** Current Path Loss */
uint8_t current_path_loss;
/** Current Path Loss */
uint8_t current_path_loss;

/** Entered Zone */
uint8_t zone_entered;
} pathloss_threshold;
/** Entered Zone */
uint8_t zone_entered;
} pathloss_threshold;

/**
* Represents crossing of path loss threshold set via LE Set Path Loss
* Reporting Parameter command. Valid for the following event types:
* o BLE_GAP_EVENT_TRANSMIT_POWER
*/

struct {
/** BLE_ERR_SUCCESS on success or error code on failure */
uint8_t status;
struct {
/** BLE_ERR_SUCCESS on success or error code on failure */
uint8_t status;

/** Connection Handle */
uint16_t conn_handle;
/** Connection Handle */
uint16_t conn_handle;

/** Reason indicating why event was sent */
uint8_t reason;
/** Reason indicating why event was sent */
uint8_t reason;

/** Advertising PHY */
uint8_t phy;
/** Advertising PHY */
uint8_t phy;

/** Transmit power Level */
int8_t transmit_power_level;

/** Transmit Power Level Flag */
uint8_t transmit_power_level_flag;
/** Transmit Power Level Flag */
uint8_t transmit_power_level_flag;

/** Delta indicating change in transmit Power Level */
int8_t delta;
} transmit_power;
} transmit_power;
#endif
/**
* Represents a received Pairing Complete message
Expand Down Expand Up @@ -1712,6 +1714,7 @@ int ble_gap_ext_adv_active(uint8_t instance);
*
*/
int ble_gap_adv_get_free_instance(uint8_t *out_adv_instance);

#endif

/* Periodic Advertising */
Expand All @@ -1720,7 +1723,7 @@ int ble_gap_adv_get_free_instance(uint8_t *out_adv_instance);
/** @brief Periodic advertising parameters */
struct ble_gap_periodic_adv_params {
/** If include TX power in advertising PDU */
unsigned int include_tx_power : 1;
unsigned int include_tx_power:1;

/** Minimum advertising interval in 1.25ms units, if 0 stack use sane
* defaults
Expand All @@ -1737,23 +1740,23 @@ struct ble_gap_periodic_adv_params {
struct ble_gap_periodic_adv_start_params {
#if MYNEWT_VAL(BLE_VERSION) >= 53
/** If include adi in aux_sync_ind PDU */
unsigned int include_adi : 1;
unsigned int include_adi:1;
#endif
};

/** @brief Periodic advertising sync reporting parameters */
struct ble_gap_periodic_adv_sync_reporting_params {
#if MYNEWT_VAL(BLE_VERSION) >= 53
/** If filter duplicates */
unsigned int filter_duplicates : 1;
unsigned int filter_duplicates:1;
#endif
};

/** @brief Periodic adv set data parameters */
struct ble_gap_periodic_adv_set_data_params {
#if MYNEWT_VAL(BLE_VERSION) >= 53
/** If include adi in aux_sync_ind PDU */
unsigned int update_did : 1;
unsigned int update_did:1;
#endif
};

Expand All @@ -1769,12 +1772,12 @@ struct ble_gap_periodic_sync_params {
uint16_t sync_timeout;

/** If reports should be initially disabled when sync is created */
unsigned int reports_disabled : 1;
unsigned int reports_disabled:1;

#if MYNEWT_VAL(BLE_VERSION) >= 53
/** If duplicate filtering should be should be initially enabled when sync is
created */
unsigned int filter_duplicates : 1;
unsigned int filter_duplicates:1;
#endif
};

Expand All @@ -1800,7 +1803,7 @@ int ble_gap_periodic_adv_configure(uint8_t instance,
* @param params Additional arguments specifying the particulars
* of periodic advertising.
*
* @return 0 on success, error code on failure.
* @return 0 on success, error code on failure.
*/
int
ble_gap_periodic_adv_start(uint8_t instance,
Expand All @@ -1812,7 +1815,7 @@ ble_gap_periodic_adv_start(uint8_t instance,
*
* @param instance Instance ID
*
* @return 0 on success, error code on failure.
* @return 0 on success, error code on failure.
*/
int ble_gap_periodic_adv_stop(uint8_t instance);

Expand All @@ -1823,9 +1826,9 @@ int ble_gap_periodic_adv_stop(uint8_t instance);
* @param instance Instance ID
* @param data Chain containing the periodic advertising data.
* @param params Additional arguments specifying the particulars
of periodic advertising data.
of periodic advertising data.
*
* @return 0 on success or error code on failure.
* @return 0 on success or error code on failure.
*/
int ble_gap_periodic_adv_set_data(uint8_t instance,
struct os_mbuf *data,
Expand Down Expand Up @@ -1876,13 +1879,12 @@ int ble_gap_periodic_adv_sync_terminate(uint16_t sync_handle);
*
* @param sync_handle Handle identifying synchronization.
* @param enable If reports should be enabled.
* @param params Additional arguments specifying the particulars
* of periodic reports.
* @param params Additional arguments specifying the particulars
* of periodic reports.
*
* @return 0 on success; nonzero on failure.
*/
int ble_gap_periodic_adv_sync_reporting(uint16_t sync_handle,
bool enable,
int ble_gap_periodic_adv_sync_reporting(uint16_t sync_handle, bool enable,
const struct ble_gap_periodic_adv_sync_reporting_params *params);

/**
Expand Down Expand Up @@ -1991,7 +1993,6 @@ int ble_gap_clear_periodic_adv_list(void);
int ble_gap_read_periodic_adv_list_size(uint8_t *per_adv_list_size);
#endif


/**
* Performs the Limited or General Discovery Procedures.
*
Expand Down Expand Up @@ -2062,7 +2063,7 @@ int ble_gap_disc(uint8_t own_addr_type, int32_t duration_ms,
* of the discovery procedure for uncoded PHY.
* If NULL is provided no scan is performed for
* this PHY.
* @param coded_params Additional arguments specifying the particulars
* @param coded_params Additional arguments specifying the particulars
* of the discovery procedure for coded PHY.
* If NULL is provided no scan is performed for
* this PHY.
Expand Down Expand Up @@ -2628,6 +2629,7 @@ int
ble_gap_subrate_req(uint16_t conn_handle, uint16_t subrate_min, uint16_t subrate_max,
uint16_t max_latency, uint16_t cont_num,
uint16_t supervision_timeout);

#endif
/**
* Event listener structure
Expand Down Expand Up @@ -2698,9 +2700,9 @@ int ble_gap_conn_find_handle_by_addr(const ble_addr_t *addr, uint16_t *out_conn_
*
* @param conn_handle Connection handle
* @params enable 1: Enable
* 0: Disable
* 0: Disable
*
* @return 0 on success; nonzero on failure.
* @return 0 on success; nonzero on failure.
*/

int ble_gap_set_path_loss_reporting_enable(uint16_t conn_handle, uint8_t enable);
Expand Down Expand Up @@ -2729,7 +2731,7 @@ int ble_gap_set_transmit_power_reporting_enable(uint16_t conn_handle,
*
* @params status 0 on success; nonzero on failure.
* @params conn_handle Connection handle
* @params phy Advertising Phy
* @params phy Advertising Phy
*
* @params curr_tx_power_level Current trasnmit Power Level
*
Expand All @@ -2739,8 +2741,8 @@ int ble_gap_set_transmit_power_reporting_enable(uint16_t conn_handle,
*/
int ble_gap_enh_read_transmit_power_level(uint16_t conn_handle, uint8_t phy,
uint8_t *out_status, uint8_t *out_phy,
uint8_t *out_curr_tx_power_level,
uint8_t *out_max_tx_power_level);
uint8_t *out_curr_tx_power_level,
uint8_t *out_max_tx_power_level);

/**
* Read Remote Transmit Power Level
Expand Down
4 changes: 2 additions & 2 deletions nimble/host/include/host/ble_gatt.h
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,8 @@ int ble_gattc_disc_all_chrs(uint16_t conn_handle, uint16_t start_handle,
* @return 0 on success; nonzero on failure.
*/
int ble_gattc_disc_chrs_by_uuid(uint16_t conn_handle, uint16_t start_handle,
uint16_t end_handle, const ble_uuid_t *uuid,
ble_gatt_chr_fn *cb, void *cb_arg);
uint16_t end_handle, const ble_uuid_t *uuid,
ble_gatt_chr_fn *cb, void *cb_arg);

/**
* Initiates GATT procedure: Discover All Characteristic Descriptors.
Expand Down
2 changes: 1 addition & 1 deletion nimble/host/include/host/ble_hs.h
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ void ble_hs_init(void);
* HAL_RESET_[...] codes or an
* implementation-defined value.
*
* @return SYSDOWN_IN_PROGRESS.
* @return SYSDOWN_IN_PROGRESS.
*/
int ble_hs_shutdown(int reason);

Expand Down
4 changes: 2 additions & 2 deletions nimble/host/include/host/ble_hs_stop.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ int ble_hs_stop(struct ble_hs_stop_listener *listener,
ble_hs_stop_fn *fn, void *arg);

/**
* @}
*/
* @}
*/

#endif
4 changes: 2 additions & 2 deletions nimble/host/include/host/ble_sm.h
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,13 @@ struct ble_sm_io {
* Valid for the following actions:
* o BLE_SM_IOACT_OOB
*/
uint8_t oob[16];
uint8_t oob[16];

/** Numeric Comparison acceptance indicator.
* Valid for the following actions:
* o BLE_SM_IOACT_NUMCMP
*/
uint8_t numcmp_accept;
uint8_t numcmp_accept;

/** Out Of Band (OOB) data used in Secure Connections.
* Valid for the following actions:
Expand Down
2 changes: 1 addition & 1 deletion nimble/host/include/host/ble_uuid.h
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ typedef union {
*
* @return Pointer to a `ble_uuid_t` structure.
*/
#define BLE_UUID128_DECLARE(uuid128...) \
#define BLE_UUID128_DECLARE(uuid128 ...) \
((ble_uuid_t *) (&(ble_uuid128_t) BLE_UUID128_INIT(uuid128)))

/**
Expand Down
Loading