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.
m2mfirmware_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 "m2mfirmware_stub.h" 00017 bool m2mfirmware_stub::has_value; 00018 uint32_t m2mfirmware_stub::int_value; 00019 bool m2mfirmware_stub::bool_value; 00020 M2MResource* m2mfirmware_stub::resource; 00021 String *m2mfirmware_stub::string_value; 00022 00023 void m2mfirmware_stub::clear() 00024 { 00025 int_value = -1; 00026 bool_value = false; 00027 *string_value = ""; 00028 resource = NULL; 00029 has_value = false; 00030 } 00031 00032 M2MFirmware::M2MFirmware() 00033 : M2MObject("5", "5") 00034 { 00035 m2mfirmware_stub::string_value = new String(""); 00036 } 00037 00038 M2MFirmware::~M2MFirmware() 00039 { 00040 delete m2mfirmware_stub::string_value; 00041 } 00042 00043 M2MFirmware* M2MFirmware::get_instance() 00044 { 00045 return new M2MFirmware(); 00046 } 00047 00048 void M2MFirmware::delete_instance() 00049 { 00050 } 00051 00052 M2MResource* M2MFirmware::create_resource(FirmwareResource, const String &) 00053 { 00054 return m2mfirmware_stub::resource; 00055 } 00056 00057 bool M2MFirmware::set_resource_value(FirmwareResource, 00058 const uint8_t *, 00059 const uint32_t) 00060 { 00061 return m2mfirmware_stub::bool_value; 00062 } 00063 00064 00065 uint32_t M2MFirmware::resource_value_buffer(FirmwareResource, 00066 uint8_t *&value) const 00067 { 00068 if( m2mfirmware_stub::has_value ){ 00069 value = (uint8_t *)malloc(5); 00070 return 5; 00071 } 00072 return m2mfirmware_stub::int_value; 00073 } 00074 00075 bool M2MFirmware::delete_resource(FirmwareResource) 00076 { 00077 return m2mfirmware_stub::bool_value; 00078 } 00079 00080 bool M2MFirmware::set_resource_value(FirmwareResource, 00081 const String &) 00082 { 00083 return m2mfirmware_stub::bool_value; 00084 } 00085 00086 bool M2MFirmware::set_resource_value(FirmwareResource, 00087 int64_t) 00088 { 00089 return m2mfirmware_stub::bool_value; 00090 } 00091 00092 String M2MFirmware::resource_value_string(FirmwareResource) const 00093 { 00094 return *m2mfirmware_stub::string_value; 00095 } 00096 00097 int64_t M2MFirmware::resource_value_int(FirmwareResource) const 00098 { 00099 return m2mfirmware_stub::int_value; 00100 } 00101 00102 bool M2MFirmware::is_resource_present(FirmwareResource) const 00103 { 00104 return m2mfirmware_stub::bool_value; 00105 } 00106 00107 uint16_t M2MFirmware::per_resource_count(FirmwareResource) const 00108 { 00109 return (uint16_t)m2mfirmware_stub::int_value; 00110 } 00111 00112 uint16_t M2MFirmware::total_resource_count() const 00113 { 00114 return (uint16_t)m2mfirmware_stub::int_value; 00115 }
Generated on Tue Jul 12 2022 21:20:27 by
1.7.2