joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers m2mdevice_stub.cpp Source File

m2mdevice_stub.cpp

00001 /*
00002  * Copyright (c) 2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #include "m2mdevice_stub.h"
00017 
00018 uint32_t m2mdevice_stub::int_value;
00019 bool m2mdevice_stub::bool_value;
00020 M2MResource* m2mdevice_stub::resource;
00021 String m2mdevice_stub::string_value;
00022 
00023 void m2mdevice_stub::clear()
00024 {
00025     int_value = -1;
00026     bool_value = false;
00027     string_value = "";
00028     resource = NULL;
00029 }
00030 
00031 M2MDevice::M2MDevice()
00032 : M2MObject("3")
00033 {
00034 }
00035 
00036 M2MDevice::~M2MDevice()
00037 {
00038 }
00039 
00040 M2MDevice* M2MDevice::get_instance()
00041 {
00042     return new M2MDevice();
00043 }
00044 
00045 void M2MDevice::delete_instance()
00046 {
00047 }
00048 
00049 M2MResource* M2MDevice::create_resource(DeviceResource, const String &)
00050 {
00051     return m2mdevice_stub::resource;
00052 }
00053 
00054 M2MResource* M2MDevice::create_resource(DeviceResource)
00055 {
00056     return m2mdevice_stub::resource;
00057 }
00058 
00059 bool M2MDevice::delete_resource(DeviceResource)
00060 {
00061     return m2mdevice_stub::bool_value;
00062 }
00063 
00064 bool M2MDevice::delete_resource_instance(DeviceResource, uint16_t)
00065 {
00066     return m2mdevice_stub::bool_value;
00067 }
00068 
00069 bool M2MDevice::set_resource_value(DeviceResource,
00070                                    const String &,
00071                                    uint16_t )
00072 {
00073     return m2mdevice_stub::bool_value;
00074 }
00075 
00076 bool M2MDevice::set_resource_value(DeviceResource,
00077                                        int64_t,
00078                                        uint16_t)
00079 {
00080     return m2mdevice_stub::bool_value;
00081 }
00082 
00083 String M2MDevice::resource_value_string(DeviceResource,
00084                                         uint16_t) const
00085 {
00086     return m2mdevice_stub::string_value;
00087 }
00088 
00089 int64_t M2MDevice::resource_value_int(DeviceResource,
00090                                       uint16_t) const
00091 {
00092     return m2mdevice_stub::int_value;
00093 }
00094 
00095 bool M2MDevice::is_resource_present(DeviceResource) const
00096 {
00097     return m2mdevice_stub::bool_value;
00098 }
00099 
00100 uint16_t M2MDevice::per_resource_count(DeviceResource) const
00101 {
00102     return (uint16_t)m2mdevice_stub::int_value;
00103 }
00104 
00105 uint16_t M2MDevice::total_resource_count() const
00106 {
00107     return (uint16_t)m2mdevice_stub::int_value;
00108 }