mbedConnectorInterface sample endpoint utilizing 3g cellular radio as the underlying connection transport.

Dependencies:   LM75B mbed mbedConnectorInterface mbedEndpointNetwork_Ublox

Committer:
ansond
Date:
Mon Dec 07 17:33:17 2015 +0000
Revision:
14:e5eb4aa35430
Parent:
0:a507bbd93e47
updates

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ansond 0:a507bbd93e47 1 /**
ansond 0:a507bbd93e47 2 * @file SampleDynamicResource.h
ansond 0:a507bbd93e47 3 * @brief mbed CoAP Endpoint example dynamic resource supporting CoAP GET and PUT
ansond 0:a507bbd93e47 4 * @author Doug Anson
ansond 0:a507bbd93e47 5 * @version 1.0
ansond 0:a507bbd93e47 6 * @see
ansond 0:a507bbd93e47 7 *
ansond 0:a507bbd93e47 8 * Copyright (c) 2014
ansond 0:a507bbd93e47 9 *
ansond 0:a507bbd93e47 10 * Licensed under the Apache License, Version 2.0 (the "License");
ansond 0:a507bbd93e47 11 * you may not use this file except in compliance with the License.
ansond 0:a507bbd93e47 12 * You may obtain a copy of the License at
ansond 0:a507bbd93e47 13 *
ansond 0:a507bbd93e47 14 * http://www.apache.org/licenses/LICENSE-2.0
ansond 0:a507bbd93e47 15 *
ansond 0:a507bbd93e47 16 * Unless required by applicable law or agreed to in writing, software
ansond 0:a507bbd93e47 17 * distributed under the License is distributed on an "AS IS" BASIS,
ansond 0:a507bbd93e47 18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ansond 0:a507bbd93e47 19 * See the License for the specific language governing permissions and
ansond 0:a507bbd93e47 20 * limitations under the License.
ansond 0:a507bbd93e47 21 */
ansond 0:a507bbd93e47 22
ansond 0:a507bbd93e47 23 #ifndef __SAMPLE_DYNAMIC_RESOURCE_H__
ansond 0:a507bbd93e47 24 #define __SAMPLE_DYNAMIC_RESOURCE_H__
ansond 0:a507bbd93e47 25
ansond 0:a507bbd93e47 26 // Base class
ansond 0:a507bbd93e47 27 #include "DynamicResource.h"
ansond 0:a507bbd93e47 28
ansond 0:a507bbd93e47 29 // Put any physical abstractions here (i.e. DigitalOut, etc...). For this sample, its simply a string...
ansond 0:a507bbd93e47 30 string my_physical_resource("hello mbed");
ansond 0:a507bbd93e47 31
ansond 0:a507bbd93e47 32 /** SampleDynamicResource class
ansond 0:a507bbd93e47 33 */
ansond 0:a507bbd93e47 34 class SampleDynamicResource : public DynamicResource
ansond 0:a507bbd93e47 35 {
ansond 0:a507bbd93e47 36
ansond 0:a507bbd93e47 37 public:
ansond 0:a507bbd93e47 38 /**
ansond 0:a507bbd93e47 39 Default constructor
ansond 0:a507bbd93e47 40 @param logger input logger instance for this resource
ansond 0:a507bbd93e47 41 @param name input the sample resource name
ansond 0:a507bbd93e47 42 @param observable input the resource is Observable (default: FALSE)
ansond 0:a507bbd93e47 43 */
ansond 0:a507bbd93e47 44 SampleDynamicResource(const Logger *logger,const char *name,const bool observable = false) : DynamicResource(logger,name,"SampleResource",SN_GRS_GET_ALLOWED|SN_GRS_PUT_ALLOWED,observable) {
ansond 0:a507bbd93e47 45 }
ansond 0:a507bbd93e47 46
ansond 0:a507bbd93e47 47 /**
ansond 0:a507bbd93e47 48 Get the value of the Sample Resource
ansond 0:a507bbd93e47 49 @returns string representing the current value of this resource
ansond 0:a507bbd93e47 50 */
ansond 0:a507bbd93e47 51 virtual string get() {
ansond 0:a507bbd93e47 52 return my_physical_resource;
ansond 0:a507bbd93e47 53 }
ansond 0:a507bbd93e47 54
ansond 0:a507bbd93e47 55 /**
ansond 0:a507bbd93e47 56 Set the value of the Sample Resource
ansond 0:a507bbd93e47 57 @param string input the new string value for this resource
ansond 0:a507bbd93e47 58 */
ansond 0:a507bbd93e47 59 virtual void put(const string value) {
ansond 0:a507bbd93e47 60 my_physical_resource = value;
ansond 0:a507bbd93e47 61 }
ansond 0:a507bbd93e47 62 };
ansond 0:a507bbd93e47 63
ansond 0:a507bbd93e47 64 #endif // __SAMPLE_DYNAMIC_RESOURCE_H__