Skip to content

Commit 1d21079

Browse files
Add static API_ID constant to response classes
All response classes that represent an actual API packet, now have this constant, which should make it easier to use templates to define generic methods that work for all response types.
1 parent a46fbd2 commit 1d21079

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

XBee.h

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -382,6 +382,8 @@ class ZBTxStatusResponse : public FrameIdResponse {
382382
uint8_t getDeliveryStatus();
383383
uint8_t getDiscoveryStatus();
384384
bool isSuccess();
385+
386+
static const uint8_t API_ID = ZB_TX_STATUS_RESPONSE;
385387
};
386388

387389
/**
@@ -396,6 +398,8 @@ class ZBRxResponse : public RxDataResponse {
396398
uint8_t getDataLength();
397399
// frame position where data starts
398400
uint8_t getDataOffset();
401+
402+
static const uint8_t API_ID = ZB_RX_RESPONSE;
399403
private:
400404
XBeeAddress64 _remoteAddress64;
401405
};
@@ -417,6 +421,8 @@ class ZBExplicitRxResponse : public ZBRxResponse {
417421
uint8_t getDataLength();
418422
// frame position where data starts
419423
uint8_t getDataOffset();
424+
425+
static const uint8_t API_ID = ZB_EXPLICIT_RX_RESPONSE;
420426
};
421427

422428
/**
@@ -448,6 +454,8 @@ class ZBRxIoSampleResponse : public ZBRxResponse {
448454
uint8_t getDigitalMaskMsb();
449455
uint8_t getDigitalMaskLsb();
450456
uint8_t getAnalogMask();
457+
458+
static const uint8_t API_ID = ZB_IO_SAMPLE_RESPONSE;
451459
};
452460

453461
#endif
@@ -461,6 +469,8 @@ class TxStatusResponse : public FrameIdResponse {
461469
TxStatusResponse();
462470
uint8_t getStatus();
463471
bool isSuccess();
472+
473+
static const uint8_t API_ID = TX_STATUS_RESPONSE;
464474
};
465475

466476
/**
@@ -487,6 +497,8 @@ class Rx16Response : public RxResponse {
487497
Rx16Response();
488498
uint8_t getRssiOffset();
489499
uint16_t getRemoteAddress16();
500+
501+
static const uint8_t API_ID = RX_16_RESPONSE;
490502
protected:
491503
uint16_t _remoteAddress;
492504
};
@@ -499,6 +511,8 @@ class Rx64Response : public RxResponse {
499511
Rx64Response();
500512
uint8_t getRssiOffset();
501513
XBeeAddress64& getRemoteAddress64();
514+
515+
static const uint8_t API_ID = RX_64_RESPONSE;
502516
private:
503517
XBeeAddress64 _remoteAddress;
504518
};
@@ -543,13 +557,16 @@ class Rx16IoSampleResponse : public RxIoSampleBaseResponse {
543557
uint16_t getRemoteAddress16();
544558
uint8_t getRssiOffset();
545559

560+
static const uint8_t API_ID = RX_16_IO_RESPONSE;
546561
};
547562

548563
class Rx64IoSampleResponse : public RxIoSampleBaseResponse {
549564
public:
550565
Rx64IoSampleResponse();
551566
XBeeAddress64& getRemoteAddress64();
552567
uint8_t getRssiOffset();
568+
569+
static const uint8_t API_ID = RX_64_IO_RESPONSE;
553570
private:
554571
XBeeAddress64 _remoteAddress;
555572
};
@@ -563,6 +580,8 @@ class ModemStatusResponse : public XBeeResponse {
563580
public:
564581
ModemStatusResponse();
565582
uint8_t getStatus();
583+
584+
static const uint8_t API_ID = MODEM_STATUS_RESPONSE;
566585
};
567586

568587
/**
@@ -593,6 +612,8 @@ class AtCommandResponse : public FrameIdResponse {
593612
* Returns true if status equals AT_OK
594613
*/
595614
bool isOk();
615+
616+
static const uint8_t API_ID = AT_COMMAND_RESPONSE;
596617
};
597618

598619
/**
@@ -631,6 +652,8 @@ class RemoteAtCommandResponse : public AtCommandResponse {
631652
* Returns true if command was successful
632653
*/
633654
bool isOk();
655+
656+
static const uint8_t API_ID = REMOTE_AT_COMMAND_RESPONSE;
634657
private:
635658
XBeeAddress64 _remoteAddress64;
636659
};

0 commit comments

Comments
 (0)