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.
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(char *path) 00032 : M2MObject("3", path) 00033 { 00034 m2mdevice_stub::string_value = new String(""); 00035 } 00036 00037 M2MDevice::~M2MDevice() 00038 { 00039 delete m2mdevice_stub::string_value; 00040 } 00041 00042 M2MDevice* M2MDevice::get_instance() 00043 { 00044 return new M2MDevice("3"); 00045 } 00046 00047 void M2MDevice::delete_instance() 00048 { 00049 } 00050 00051 M2MResource* M2MDevice::create_resource(DeviceResource, const String &) 00052 { 00053 return m2mdevice_stub::resource; 00054 } 00055 00056 M2MResource* M2MDevice::create_resource(DeviceResource) 00057 { 00058 return m2mdevice_stub::resource; 00059 } 00060 00061 bool M2MDevice::delete_resource(DeviceResource) 00062 { 00063 return m2mdevice_stub::bool_value; 00064 } 00065 00066 bool M2MDevice::delete_resource_instance(DeviceResource, uint16_t) 00067 { 00068 return m2mdevice_stub::bool_value; 00069 } 00070 00071 bool M2MDevice::set_resource_value(DeviceResource, 00072 const String &, 00073 uint16_t ) 00074 { 00075 return m2mdevice_stub::bool_value; 00076 } 00077 00078 bool M2MDevice::set_resource_value(DeviceResource, 00079 int64_t, 00080 uint16_t) 00081 { 00082 return m2mdevice_stub::bool_value; 00083 } 00084 00085 String M2MDevice::resource_value_string(DeviceResource, 00086 uint16_t) const 00087 { 00088 return *m2mdevice_stub::string_value; 00089 } 00090 00091 int64_t M2MDevice::resource_value_int(DeviceResource, 00092 uint16_t) const 00093 { 00094 return m2mdevice_stub::int_value; 00095 } 00096 00097 bool M2MDevice::is_resource_present(DeviceResource) const 00098 { 00099 return m2mdevice_stub::bool_value; 00100 } 00101 00102 uint16_t M2MDevice::per_resource_count(DeviceResource) const 00103 { 00104 return (uint16_t)m2mdevice_stub::int_value; 00105 } 00106 00107 uint16_t M2MDevice::total_resource_count() const 00108 { 00109 return (uint16_t)m2mdevice_stub::int_value; 00110 }
Generated on Tue Jul 12 2022 21:20:27 by
1.7.2