diff --git a/src/rfcomm.h b/src/rfcomm.h index 193f208d8..f2909f757 100644 --- a/src/rfcomm.h +++ b/src/rfcomm.h @@ -257,43 +257,43 @@ void rfcomm_close_connection(void *connection); /** Embedded API **/ -// Set up RFCOMM +// Set up RFCOMM. void rfcomm_init(void); -// register packet handler +// Register packet handler. void rfcomm_register_packet_handler(void (*handler)(void * connection, uint8_t packet_type, uint16_t channel, uint8_t *packet, uint16_t size)); -// Creates RFCOMM channel to a given server channel on a remote device with baseband address. A new baseband connection will be initiated if necessary. -// This channel will automatically provides enough credits to the remote side +// Creates RFCOMM connection (channel) to a given server channel on a remote device with baseband address. A new baseband connection will be initiated if necessary. +// This channel will automatically provide enough credits to the remote side void rfcomm_create_channel_internal(void * connection, bd_addr_t *addr, uint8_t channel); -// Creates RFCOMM channel to a given server channel on a remote device with baseband address. new baseband connection will be initiated if necessary. -// This channel will use explicit credit management. During channel establishment, an initial amount of credits are provided. +// Creates RFCOMM connection (channel) to a given server channel on a remote device with baseband address. new baseband connection will be initiated if necessary. +// This channel will use explicit credit management. During channel establishment, an initial amount of credits is provided. void rfcomm_create_channel_with_initial_credits_internal(void * connection, bd_addr_t *addr, uint8_t server_channel, uint8_t initial_credits); // Disconencts RFCOMM channel with given identifier. void rfcomm_disconnect_internal(uint16_t rfcomm_cid); // Registers RFCOMM service for a server channel and a maximum frame size, and assigns a packet handler. On embedded systems, use NULL for connection parameter. -// This channel will automatically provides enough credits to the remote side +// This channel provides automatically enough credits to the remote side. void rfcomm_register_service_internal(void * connection, uint8_t channel, uint16_t max_frame_size); // Registers RFCOMM service for a server channel and a maximum frame size, and assigns a packet handler. On embedded systems, use NULL for connection parameter. -// This channel will use explicit credit management. During channel establishment, an initial amount of credits are provided. +// This channel will use explicit credit management. During channel establishment, an initial amount of credits is provided. void rfcomm_register_service_with_initial_credits_internal(void * connection, uint8_t channel, uint16_t max_frame_size, uint8_t initial_credits); -// Unregister RFCOMM service +// Unregister RFCOMM service. void rfcomm_unregister_service_internal(uint8_t service_channel); // Accepts/Deny incoming RFCOMM connection. void rfcomm_accept_connection_internal(uint16_t rfcomm_cid); void rfcomm_decline_connection_internal(uint16_t rfcomm_cid); -// Grant more incoming credits to the remote side for the given channel ID +// Grant more incoming credits to the remote side for the given RFCOMM channel identifier. void rfcomm_grant_credits(uint16_t rfcomm_cid, uint8_t credits); -// Sends RFCOMM data packet to the channel with given identifier. +// Sends RFCOMM data packet to the RFCOMM channel with given identifier. int rfcomm_send_internal(uint16_t rfcomm_cid, uint8_t *data, uint16_t len); #if defined __cplusplus diff --git a/src/sdp.h b/src/sdp.h index daac77387..1b500caa6 100644 --- a/src/sdp.h +++ b/src/sdp.h @@ -75,10 +75,8 @@ int sdp_handle_service_attribute_request(uint8_t * packet, uint16_t remote_mtu); int sdp_handle_service_search_attribute_request(uint8_t * packet, uint16_t remote_mtu); #ifndef EMBEDDED -// register service record internally - this special version doesn't copy the record, it cannot be freeed -// pre: AttributeIDs are in ascending order -// pre: ServiceRecordHandle is first attribute and valid -// pre: record +// Register service record internally - this version creates a copy of the record +// precondition: AttributeIDs are in ascending order => ServiceRecordHandle is first attribute if present // @returns ServiceRecordHandle or 0 if registration failed uint32_t sdp_register_service_internal(void *connection, uint8_t * service_record); #endif @@ -88,15 +86,18 @@ void sdp_unregister_services_for_connection(void *connection); /** Embedded API **/ +// Set up SDP. void sdp_init(void); #ifdef EMBEDDED -// register service record internally - the normal version creates a copy of the record -// pre: AttributeIDs are in ascending order => ServiceRecordHandle is first attribute if present -// @returns ServiceRecordHandle or 0 if registration failed +// Register service record internally - this version doesn't copy the record therefore it must be forever accessible. +// Preconditions: +// - AttributeIDs are in ascending order; +// - ServiceRecordHandle is first attribute and valid. +// @returns ServiceRecordHandle or 0 if registration failed. uint32_t sdp_register_service_internal(void *connection, service_record_item_t * record_item); #endif -// unregister service record internally +// Unregister service record internally. void sdp_unregister_service_internal(void *connection, uint32_t service_record_handle);