mbed Connector Endpoint interface. This interface permits a mbed endpoint to easily setup MDS resources and emit those resources to an MDS server.

Dependents:   IoT_LED_demo ServoTest uWater_Project hackathon ... more

Committer:
ansond
Date:
Fri Mar 20 04:08:59 2015 +0000
Revision:
24:a6915e19814e
Child:
25:1fc958ac14d1
added DataWrapper

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 24:a6915e19814e 1 /**
ansond 24:a6915e19814e 2 * @file DataWrapper.h
ansond 24:a6915e19814e 3 * @brief mbed CoAP Endpoint Data Wrapper class
ansond 24:a6915e19814e 4 * @author Doug Anson
ansond 24:a6915e19814e 5 * @version 1.0
ansond 24:a6915e19814e 6 * @see
ansond 24:a6915e19814e 7 *
ansond 24:a6915e19814e 8 * Copyright (c) 2014
ansond 24:a6915e19814e 9 *
ansond 24:a6915e19814e 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 24:a6915e19814e 11 * you may not use this file except in compliance with the License.
ansond 24:a6915e19814e 12 * You may obtain a copy of the License at
ansond 24:a6915e19814e 13 *
ansond 24:a6915e19814e 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 24:a6915e19814e 15 *
ansond 24:a6915e19814e 16 * Unless required by applicable law or agreed to in writing, software
ansond 24:a6915e19814e 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 24:a6915e19814e 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 24:a6915e19814e 19 * See the License for the specific language governing permissions and
ansond 24:a6915e19814e 20 * limitations under the License.
ansond 24:a6915e19814e 21 */
ansond 24:a6915e19814e 22
ansond 24:a6915e19814e 23 #ifndef __DATA_WRAPPER_H__
ansond 24:a6915e19814e 24 #define __DATA_WRAPPER_H__
ansond 24:a6915e19814e 25
ansond 24:a6915e19814e 26 // mbed support
ansond 24:a6915e19814e 27 #include "mbed.h"
ansond 24:a6915e19814e 28
ansond 24:a6915e19814e 29 class DataWrapper {
ansond 24:a6915e19814e 30 public:
ansond 24:a6915e19814e 31 /**
ansond 24:a6915e19814e 32 Default constructor
ansond 24:a6915e19814e 33 */
ansond 24:a6915e19814e 34 DataWrapper(uint8_t *data,int data_length);
ansond 24:a6915e19814e 35
ansond 24:a6915e19814e 36 /**
ansond 24:a6915e19814e 37 Default copy constructor
ansond 24:a6915e19814e 38 */
ansond 24:a6915e19814e 39 DataWrapper(const DataWrapper &data);
ansond 24:a6915e19814e 40
ansond 24:a6915e19814e 41 /**
ansond 24:a6915e19814e 42 Destructor
ansond 24:a6915e19814e 43 */
ansond 24:a6915e19814e 44 virtual ~DataWrapper();
ansond 24:a6915e19814e 45
ansond 24:a6915e19814e 46 /**
ansond 24:a6915e19814e 47 Wrap the data
ansond 24:a6915e19814e 48 */
ansond 24:a6915e19814e 49 virtual void wrap(uint8_t *data,int data_length);
ansond 24:a6915e19814e 50
ansond 24:a6915e19814e 51 /**
ansond 24:a6915e19814e 52 Unwrap the data
ansond 24:a6915e19814e 53 */
ansond 24:a6915e19814e 54 virtual void unwrap(uint8_t *data,int data_length);
ansond 24:a6915e19814e 55
ansond 24:a6915e19814e 56 /**
ansond 24:a6915e19814e 57 Get the wrap/unwrap result
ansond 24:a6915e19814e 58 @return pointer to the data buffer of DataWrapper containing the wrap/unwrap result
ansond 24:a6915e19814e 59 */
ansond 24:a6915e19814e 60 uint8_t *get() { return this->m_data; }
ansond 24:a6915e19814e 61
ansond 24:a6915e19814e 62 /**
ansond 24:a6915e19814e 63 Get the wrap/unwrap result length
ansond 24:a6915e19814e 64 @return length of the wrap/unwrap data result
ansond 24:a6915e19814e 65 */
ansond 24:a6915e19814e 66 int length() { return this->m_data_length; }
ansond 24:a6915e19814e 67
ansond 24:a6915e19814e 68 /**
ansond 24:a6915e19814e 69 Reset the wrapper
ansond 24:a6915e19814e 70 */
ansond 24:a6915e19814e 71 void reset();
ansond 24:a6915e19814e 72
ansond 24:a6915e19814e 73 private:
ansond 24:a6915e19814e 74 uint8_t *m_data;
ansond 24:a6915e19814e 75 int m_data_length;
ansond 24:a6915e19814e 76 };
ansond 24:a6915e19814e 77
ansond 24:a6915e19814e 78 #endif // __DATA_WRAPPER_H__