Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: CircularBuffer FixedLengthList
Dependents: XBeeApiTest XBeeApiSimpleATCmdsExample XBeeApiBroadcastExample XBeeApiBroadcastExampleRTOS ... more
Remote/XBeeDeviceRemoteAt.hpp@53:7b65422d7a32, 2014-07-28 (annotated)
- Committer:
- johnb
- Date:
- Mon Jul 28 13:27:58 2014 +0000
- Revision:
- 53:7b65422d7a32
- Parent:
- 52:0950b05d5270
- Child:
- 55:610aa4a2ed3b
Comments & clean-up
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| johnb | 50:f76b7e7959a2 | 1 | /** |
| johnb | 50:f76b7e7959a2 | 2 | @file |
| johnb | 50:f76b7e7959a2 | 3 | @brief Class to provide an abstract representation of a remote |
| johnb | 50:f76b7e7959a2 | 4 | XBee device's AT command interface |
| johnb | 50:f76b7e7959a2 | 5 | |
| johnb | 50:f76b7e7959a2 | 6 | @author John Bailey |
| johnb | 50:f76b7e7959a2 | 7 | |
| johnb | 50:f76b7e7959a2 | 8 | @copyright Copyright 2014 John Bailey |
| johnb | 50:f76b7e7959a2 | 9 | |
| johnb | 50:f76b7e7959a2 | 10 | @section LICENSE |
| johnb | 50:f76b7e7959a2 | 11 | |
| johnb | 50:f76b7e7959a2 | 12 | Licensed under the Apache License, Version 2.0 (the "License"); |
| johnb | 50:f76b7e7959a2 | 13 | you may not use this file except in compliance with the License. |
| johnb | 50:f76b7e7959a2 | 14 | You may obtain a copy of the License at |
| johnb | 50:f76b7e7959a2 | 15 | |
| johnb | 50:f76b7e7959a2 | 16 | http://www.apache.org/licenses/LICENSE-2.0 |
| johnb | 50:f76b7e7959a2 | 17 | |
| johnb | 50:f76b7e7959a2 | 18 | Unless required by applicable law or agreed to in writing, software |
| johnb | 50:f76b7e7959a2 | 19 | distributed under the License is distributed on an "AS IS" BASIS, |
| johnb | 50:f76b7e7959a2 | 20 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| johnb | 50:f76b7e7959a2 | 21 | See the License for the specific language governing permissions and |
| johnb | 50:f76b7e7959a2 | 22 | limitations under the License. |
| johnb | 50:f76b7e7959a2 | 23 | |
| johnb | 50:f76b7e7959a2 | 24 | */ |
| johnb | 50:f76b7e7959a2 | 25 | |
| johnb | 50:f76b7e7959a2 | 26 | #if !defined XBEEDEVICEREMOTEAT_HPP |
| johnb | 50:f76b7e7959a2 | 27 | #define XBEEDEVICEREMOTEAT_HPP |
| johnb | 50:f76b7e7959a2 | 28 | |
| johnb | 50:f76b7e7959a2 | 29 | #include "XBeeApiCfg.hpp" |
| johnb | 50:f76b7e7959a2 | 30 | #include "XBeeApiFrame.hpp" |
| johnb | 50:f76b7e7959a2 | 31 | #include "XBeeApiCmdAt.hpp" |
| johnb | 50:f76b7e7959a2 | 32 | |
| johnb | 53:7b65422d7a32 | 33 | /** Class used to provide a command interface to a remove XBee via the Remote AT interface. |
| johnb | 53:7b65422d7a32 | 34 | The class inherits from XBeeApiCmdAt, hence the interface for the local and remote |
| johnb | 53:7b65422d7a32 | 35 | XBees is generally the same. |
| johnb | 53:7b65422d7a32 | 36 | */ |
| johnb | 50:f76b7e7959a2 | 37 | class XBeeDeviceRemoteAt : public XBeeApiCmdAt |
| johnb | 50:f76b7e7959a2 | 38 | { |
| johnb | 50:f76b7e7959a2 | 39 | protected: |
| johnb | 50:f76b7e7959a2 | 40 | /** Called by XBeeDevice in order to offer frame data to the object for |
| johnb | 50:f76b7e7959a2 | 41 | decoding |
| johnb | 50:f76b7e7959a2 | 42 | |
| johnb | 50:f76b7e7959a2 | 43 | \param p_data Pointer to the content of the received data |
| johnb | 50:f76b7e7959a2 | 44 | \param p_len Length of the data pointed to by p_data |
| johnb | 50:f76b7e7959a2 | 45 | */ |
| johnb | 50:f76b7e7959a2 | 46 | virtual bool decodeCallback( const uint8_t* const p_data, size_t p_len ); |
| johnb | 50:f76b7e7959a2 | 47 | |
| johnb | 53:7b65422d7a32 | 48 | /* TODO: doc */ |
| johnb | 50:f76b7e7959a2 | 49 | virtual void SendCmd_uint8_t( const uint8_t p_frameId, |
| johnb | 50:f76b7e7959a2 | 50 | const uint8_t* const p_data, |
| johnb | 50:f76b7e7959a2 | 51 | const uint8_t& p_val ); |
| johnb | 53:7b65422d7a32 | 52 | /* TODO: doc */ |
| johnb | 50:f76b7e7959a2 | 53 | virtual void SendCmd_uint16_t( const uint8_t p_frameId, |
| johnb | 50:f76b7e7959a2 | 54 | const uint8_t* const p_data, |
| johnb | 50:f76b7e7959a2 | 55 | const uint16_t& p_val ); |
| johnb | 53:7b65422d7a32 | 56 | /* TODO: doc */ |
| johnb | 51:a7d0d2ef9261 | 57 | virtual void SendCmd_uint32_t( const uint8_t p_frameId, |
| johnb | 51:a7d0d2ef9261 | 58 | const uint8_t* const p_data, |
| johnb | 51:a7d0d2ef9261 | 59 | const uint32_t& p_val ); |
| johnb | 53:7b65422d7a32 | 60 | /* TODO: doc */ |
| johnb | 50:f76b7e7959a2 | 61 | virtual void SendReq( const uint8_t p_frameId, |
| johnb | 50:f76b7e7959a2 | 62 | const uint8_t* p_data ); |
| johnb | 50:f76b7e7959a2 | 63 | |
| johnb | 53:7b65422d7a32 | 64 | /* TODO: doc */ |
| johnb | 50:f76b7e7959a2 | 65 | virtual size_t getResponseStatusPos( void ) const; |
| johnb | 50:f76b7e7959a2 | 66 | |
| johnb | 53:7b65422d7a32 | 67 | /** Keep track of whether we're applying changes when the AT command is sent |
| johnb | 53:7b65422d7a32 | 68 | or not */ |
| johnb | 51:a7d0d2ef9261 | 69 | bool m_applyChanges; |
| johnb | 50:f76b7e7959a2 | 70 | |
| johnb | 50:f76b7e7959a2 | 71 | public: |
| johnb | 53:7b65422d7a32 | 72 | |
| johnb | 53:7b65422d7a32 | 73 | /* TODO: doc */ |
| johnb | 50:f76b7e7959a2 | 74 | /** Constructor */ |
| johnb | 50:f76b7e7959a2 | 75 | XBeeDeviceRemoteAt( XBeeDevice* p_device, |
| johnb | 50:f76b7e7959a2 | 76 | const uint16_t& p_addr16Bit, |
| johnb | 51:a7d0d2ef9261 | 77 | const uint64_t& p_addr64Bit = 0, |
| johnb | 51:a7d0d2ef9261 | 78 | const bool p_applyChanges = false ); |
| johnb | 50:f76b7e7959a2 | 79 | |
| johnb | 50:f76b7e7959a2 | 80 | /** Destructor */ |
| johnb | 50:f76b7e7959a2 | 81 | virtual ~XBeeDeviceRemoteAt( void ); |
| johnb | 51:a7d0d2ef9261 | 82 | |
| johnb | 53:7b65422d7a32 | 83 | /** Control whether or not changes are applied when the command is sent or not. |
| johnb | 53:7b65422d7a32 | 84 | There are three possibilities for appling changes on the remote: |
| johnb | 53:7b65422d7a32 | 85 | 1) Use this method, specifying a 'true' parameter so that changes are applied as soon as a command is sent |
| johnb | 53:7b65422d7a32 | 86 | 2) Use requestApplyChanges() to apply all pending changes |
| johnb | 53:7b65422d7a32 | 87 | 3) Use requestWriteSettings() followed by requestReset() to write the settings to non-volatile memory and reset the device |
| johnb | 53:7b65422d7a32 | 88 | |
| johnb | 53:7b65422d7a32 | 89 | \param Specified whether or not the settings should be applied when the command is sent to the remote device */ |
| johnb | 51:a7d0d2ef9261 | 90 | void setApplyChanges( const bool p_apply ); |
| johnb | 50:f76b7e7959a2 | 91 | }; |
| johnb | 50:f76b7e7959a2 | 92 | |
| johnb | 50:f76b7e7959a2 | 93 | #endif |