John Bailey / XBeeApi

Dependencies:   CircularBuffer FixedLengthList

Dependents:   XBeeApiTest XBeeApiSimpleATCmdsExample XBeeApiBroadcastExample XBeeApiBroadcastExampleRTOS ... more

Revision:
5:b40a6fd3a334
Child:
6:3cb62daace78
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Base/XBeeApiFrame.cpp	Wed Jan 29 20:19:59 2014 +0000
@@ -0,0 +1,65 @@
+/** 
+
+Copyright 2013 John Bailey
+   
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+*/
+
+#include "XBeeApiFrame.hpp"
+#include "XBeeDevice.hpp"
+
+#include <stdlib.h>
+
+XBeeApiFrame::XBeeApiFrame( void ) : m_apiId ( XBEE_CMD_INVALID ), m_dataLen( 0 ), m_data( NULL )
+{
+}
+
+uint16_t XBeeApiFrame::getCmdLen( void ) const
+{
+    return m_dataLen + m_cmdHeaderLen;    
+}
+
+
+XBeeApiIdentifier_e XBeeApiFrame::getApiId( void ) const
+{
+    return m_apiId;
+}
+        
+const uint8_t* XBeeApiFrame::getDataPtr( void ) const
+{
+    return m_data;
+}
+
+XBeeApiFrameDecoder::XBeeApiFrameDecoder() : m_device( NULL )
+{
+    
+}
+
+XBeeApiFrameDecoder::~XBeeApiFrameDecoder()
+{
+    if( m_device != NULL )
+    {
+        m_device->unregisterDecoder( this );
+    }    
+}
+
+void XBeeApiFrameDecoder::registerCallback( XBeeDevice* const p_device )
+{
+    m_device = p_device;
+}
+
+void XBeeApiFrameDecoder::unregisterCallback( void )
+{
+    m_device = NULL;
+}
\ No newline at end of file