mirror of
https://github.com/felis/USB_Host_Shield_2.0.git
synced 2024-03-22 11:31:26 +01:00
Check id values when GetReportParser and SetReportParser are called
This commit is contained in:
parent
8ae6f8bb1d
commit
2283753ba1
1 changed files with 15 additions and 0 deletions
15
BTHID.h
15
BTHID.h
|
@ -51,11 +51,26 @@ public:
|
|||
|
||||
/**@}*/
|
||||
|
||||
/**
|
||||
* Get HIDReportParser.
|
||||
* @param id ID of parser.
|
||||
* @return Returns the corresponding HIDReportParser. Returns NULL if id is not valid.
|
||||
*/
|
||||
HIDReportParser *GetReportParser(uint8_t id) {
|
||||
if (id >= NUM_PARSERS)
|
||||
return NULL;
|
||||
return pRptParser[id];
|
||||
};
|
||||
|
||||
/**
|
||||
* Set HIDReportParser to be used.
|
||||
* @param id Id of parser.
|
||||
* @param prs Pointer to HIDReportParser.
|
||||
* @return Returns true if the HIDReportParser is set. False otherwise.
|
||||
*/
|
||||
bool SetReportParser(uint8_t id, HIDReportParser *prs) {
|
||||
if (id >= NUM_PARSERS)
|
||||
return false;
|
||||
pRptParser[id] = prs;
|
||||
return true;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue