XBee and XBee-PRO ZigBee RF modules provide cost-effective wireless connectivity to electronic devices. They are interoperable with other ZigBee PRO feature set devices, including devices from other vendors.
Diff: Core/CoreAPI.h
- Revision:
- 1:3dc0ec2f9fd6
- Parent:
- 0:837e6c48e90d
- Child:
- 3:6b205ec8624b
--- a/Core/CoreAPI.h Thu Oct 22 12:28:26 2015 +0000 +++ b/Core/CoreAPI.h Thu Oct 22 20:02:11 2015 +0000 @@ -16,7 +16,6 @@ #include "ZigBeeExplicitTxRequest.h" #include "ZigBeeTxRequest.h" - #include "XBeeRx64Indicator.h" #include "XBeeRx16Indicator.h" #include "XBeeRx64IOSampleIndicator.h" @@ -34,6 +33,7 @@ #include "RouteRecordIndicator.h" #include "ManyToOneRouteIndicator.h" +/// The core API class which responseable for processing frame data, but not the serial operation. class CoreAPI { private: @@ -68,22 +68,23 @@ protected: - /// <summary> - /// read one byte payload, which allready handle the escape char, if less than 0 means error occured - /// </summary> - /// <returns></returns> + /** Read one byte payload, which allready handle the escape char, if less than 0 means error occured + * @returns if less than 0 means error occured. + */ int readByte(); - /// <summary> - /// write one byte to the payload, which allready handle the escape char - /// </summary> - /// <param name="data"></param> + /** Write one byte to the payload, which allready handle the escape char. + * @param data one byte [0x00-0xFF] + */ void writeByte(char data); - + + /// Processing API frame. void packetProcess(); - + + /// Get the next avaliable API frame length. int getLength(); - + + /// Read the next avaliable API frame data. void readPayLoad(int length); public: @@ -91,59 +92,125 @@ ~CoreAPI(); - /// <summary> - /// get or set whether to verify receive packet's checksum - /// </summary> + /** Set whether to verify checksum during receiving, default is not verify. + * + * @param isCheck true only to process API frame when checksum matches. + * false ignore the checksum. + */ void setVerifyChecksum(bool isCheck); - /// <summary> - /// to start send and process response, must be called before any function - /// </summary> + /// Start send and process response, must call this method before starting processing data. void start(); - /// <summary> - /// stop so the serial port can be used for other purpose - /// </summary> + /// Stop the serial port. void stop(); - /// <summary> - /// a general function to send frame out, do not process response - /// </summary> - /// <param name="request"></param> + /** A general function to send frame out + * + * @param request any API frame + */ void send(APIFrame * request); + /** Read the next avaliable API frame, and the type of fram can be retrieved from getFrameType(). + * + * @returns a API frame, NULL means data not avaliable. + */ APIFrame * getResponse(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ XBeeRx64Indicator * getXBeeRx64(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ XBeeRx16Indicator * getXBeeRx16(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ XBeeRx64IOSampleIndicator * getXBeeRx64IOSample(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ XBeeRx16IOSampleIndicator * getXBeeRx16IOSample(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ XBeeTxStatusIndicator * getXBeeTxStatus(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ ATCommandIndicator * getATCommand(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ ModemStatusIndicator * getModemStatus(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ ZigBeeTxStatusIndicator * getZigBeeTxStatus(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ ZigBeeRxIndicator * getZigBeeRx(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ ZigBeeExplicitRxIndicator * getZigBeeExplicitRx(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ ZigBeeIOSampleIndicator * getZigBeeIOSample(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ SensorReadIndicator * getSensorRead(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ NodeIdentificationIndicator * getNodeIdentification(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ RemoteCommandIndicator * getRemoteCommand(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ RouteRecordIndicator * getRouteRecord(); + /** Read the next avaliable API frame. + * + * @returns a API frame, NULL means data not avaliable. + */ ManyToOneRouteIndicator * getManyToOneRoute(); };