Skip to content
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

Verbose logging of the peripheral GATT server content #355

Merged
merged 3 commits into from
Jan 15, 2018

Conversation

uKL
Copy link
Collaborator

@uKL uKL commented Jan 15, 2018

Extended logger for the peripheral GATT content. If the logger is set to verbose then structure of the:

  • services
  • characteristics
  • descriptors

is printed in logs.

Example output:

--------------- ====== Printing peripheral content ====== ---------------
PERIPHERAL ADDRESS: 00:08:7B:00:BB:84
PERIPHERAL NAME: Some device
-------------------------------------------------------------------------

Primary Service - Generic Access (00001800-0000-1000-8000-00805f9b34fb)
Instance ID: 1
-> Characteristics:
	* Device Name (00002a00-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ ]
	* Appearance (00002a01-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ ]
	* Peripheral Privacy Flag (00002a02-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ WRITE ]
	* Peripheral Preferred Connection Parameters (00002a04-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ ]

Primary Service - Generic Attribute (00001801-0000-1000-8000-00805f9b34fb)
Instance ID: 12
-> Characteristics:
	* Service Changed (00002a05-0000-1000-8000-00805f9b34fb)
	  Properties: [ INDICATE ]
	  -> Descriptors: 
		* Client Characteristic Configuration (00002902-0000-1000-8000-00805f9b34fb)

Primary Service - Battery Service (0000180f-0000-1000-8000-00805f9b34fb)
Instance ID: 16
-> Characteristics:
	* Battery Level (00002a19-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ NOTIFY ]
	  -> Descriptors: 
		* Client Characteristic Configuration (00002902-0000-1000-8000-00805f9b34fb)

Primary Service - Device Information (0000180a-0000-1000-8000-00805f9b34fb)
Instance ID: 20
-> Characteristics:
	* Manufacturer Name String (00002a29-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ ]
	* Model Number String (00002a24-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ ]
	* Firmware Revision String (00002a26-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ ]
	* Software Revision String (00002a28-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ ]
	* System ID (00002a23-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ ]
	* PnP ID (00002a50-0000-1000-8000-00805f9b34fb)
	  Properties: [ READ ]

Primary Service - Unknown service (edfec62e-9910-0bac-5241-d8bda6932a2f)
Instance ID: 33
-> Characteristics:
	* Unknown characteristic (2d86686a-53dc-25b3-0c4a-f0e10c8dee20)
	  Properties: [ WRITE ]
	  -> Descriptors: 
		* Characteristic User Description (00002901-0000-1000-8000-00805f9b34fb)
	* Unknown characteristic (9e1547ba-c365-57b5-2947-c5e1c1e1d528)
	  Properties: [ READ WRITE ]
	  -> Descriptors: 
		* Characteristic User Description (00002901-0000-1000-8000-00805f9b34fb)
	* Unknown characteristic (772ae377-b3d2-4f8e-4042-5481d1e0098c)
	  Properties: [ READ WRITE NOTIFY ]
	  -> Descriptors: 
		* Client Characteristic Configuration (00002902-0000-1000-8000-00805f9b34fb)
		* Characteristic User Description (00002901-0000-1000-8000-00805f9b34fb)
	* Unknown characteristic (6eb675ab-8bd1-1b9a-7444-621e52ec6823)
	  Properties: [ READ WRITE ]
	  -> Descriptors: 
		* Characteristic User Description (00002901-0000-1000-8000-00805f9b34fb)
	* Unknown characteristic (5a87b4ef-3bfa-76a8-e642-92933c31434f)
	  Properties: [ WRITE ]
	  -> Descriptors: 
		* Characteristic User Description (00002901-0000-1000-8000-00805f9b34fb)
	* Unknown characteristic (6c290d2e-1c03-aca1-ab48-a9b908bae79e)
	  Properties: [ WRITE ]
	  -> Descriptors: 
		* Characteristic User Description (00002901-0000-1000-8000-00805f9b34fb)
--------------- ====== Finished peripheral content ====== ---------------

…verbose then structure of the:

- services
- characteristics
- descriptors

is printed in logs.
Copy link
Owner

@dariuszseweryn dariuszseweryn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A neat feat. Although I can imagine why it is checking for VERBOSE level and prints a DEBUG it is not very consistent.
Either should be .v(...) or maybe we should have another flag? Let's discuss.

public void log(RxBleDeviceServices rxBleDeviceServices, BluetoothDevice device) {
if (RxBleLog.isAtLeast(RxBleLog.VERBOSE)) {
RxBleLog.v("Preparing services description");
RxBleLog.d(prepareServicesDescription(rxBleDeviceServices, device));
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't it be .v(...) as well?

Copy link
Collaborator Author

@uKL uKL Jan 15, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with .v level. I'd go for an additional flag if this would require an operation to be performed for logging, so the user could decide about the flow. In this case (passive) I'd stick with verbose level. Would that be ok?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup.

Copy link
Owner

@dariuszseweryn dariuszseweryn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💯

@dariuszseweryn
Copy link
Owner

Just add the Changelog

@uKL
Copy link
Collaborator Author

uKL commented Jan 15, 2018

Done with the changelog.

@uKL uKL merged commit 72f0f20 into master Jan 15, 2018
@uKL uKL deleted the feature/services_content_logger branch January 15, 2018 15:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants