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

Additional Device Informations for ble #336

Merged
merged 2 commits into from
Sep 26, 2019
Merged

Additional Device Informations for ble #336

merged 2 commits into from
Sep 26, 2019

Conversation

elral
Copy link
Contributor

@elral elral commented Sep 2, 2019

Added some methods for setting more device informations.
See also Issue #335

Copy link
Member

@hathach hathach left a comment

Choose a reason for hiding this comment

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

Thank you very much for your PR, sorry for the wait, I have been busy with other works. Please check out my review comment, I am open for any further discussion.

};

public:
BLEDis(void);

void setModel(const char* model);
void setModel(const char* model,uint8_t length);
Copy link
Member

Choose a reason for hiding this comment

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

for using this API with length, I would suggest to

  1. change the type of 1st parameter to const uint8_t* e.g setModel(const uint8_t model, uint8_t length)
  2. also please implement the const char* as inline function as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

  1. Yes, you are right. Then inside function it must be "_model = (const char*)model;"
  2. Sorry, I don't know what to change, or do you mean "_model = (const char*)model;"

chars.setFixedLen(strlen(_strarr[i]));

if (_strarr_length[i]) {
chars.setFixedLen(_strarr_length[i]);
Copy link
Member

Choose a reason for hiding this comment

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

  1. should only use the _strarr_legnth[i], there is no point to use the strlen() function anymore.

Copy link
Contributor Author

@elral elral Sep 13, 2019

Choose a reason for hiding this comment

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

Yes, you are right.

VERIFY_STATUS( chars.begin() );
chars.write(_strarr[i]);
if (_strarr_length[i]) {
Copy link
Member

Choose a reason for hiding this comment

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

same as above

Copy link
Contributor Author

@elral elral Sep 13, 2019

Choose a reason for hiding this comment

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

Yes, you are right.

}
}

if ( _strarr[arrcount(_strarr)-1] != NULL )
Copy link
Member

Choose a reason for hiding this comment

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

  1. I am not familliar with PNP_ID, but why this characteristic isn't included in the above loop

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Last characteristic from the loop is 0x2A2A (IEEE_REGULATORY_CERTIFICATION), PNP_ID is 0x2A50. So there is a big gap between last entry from loop and PNP_ID. I had no better idea than to do it seperatly.

Copy link
Member

Choose a reason for hiding this comment

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

ah i see the reason now.

Copy link
Member

@hathach hathach left a comment

Choose a reason for hiding this comment

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

@elral you should update your code then commit and push following my review. However, since you are new to PR, I will merge this and do the clean up myself. Thank you very much for the PR. Looking forward to more of your contribution in the future.

@hathach hathach merged commit 5f1b5d5 into adafruit:master Sep 26, 2019
hathach added a commit that referenced this pull request Sep 26, 2019
- inline function for no-length API
- clean up using strarr_len
- handle PNP_ID char
hathach added a commit that referenced this pull request Sep 26, 2019
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.

None yet

2 participants