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.
Dependencies: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
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") 00034 { 00035 } 00036 00037 M2MFirmware::~M2MFirmware() 00038 { 00039 } 00040 00041 M2MFirmware* M2MFirmware::get_instance() 00042 { 00043 return new M2MFirmware(); 00044 } 00045 00046 void M2MFirmware::delete_instance() 00047 { 00048 } 00049 00050 M2MResource* M2MFirmware::create_resource(FirmwareResource, const String &) 00051 { 00052 return m2mfirmware_stub::resource; 00053 } 00054 00055 bool M2MFirmware::set_resource_value(FirmwareResource, 00056 const uint8_t *, 00057 const uint32_t) 00058 { 00059 return m2mfirmware_stub::bool_value; 00060 } 00061 00062 00063 uint32_t M2MFirmware::resource_value_buffer(FirmwareResource, 00064 uint8_t *&value) const 00065 { 00066 if( m2mfirmware_stub::has_value ){ 00067 value = (uint8_t *)malloc(5); 00068 return 5; 00069 } 00070 return m2mfirmware_stub::int_value; 00071 } 00072 00073 bool M2MFirmware::delete_resource(FirmwareResource) 00074 { 00075 return m2mfirmware_stub::bool_value; 00076 } 00077 00078 bool M2MFirmware::set_resource_value(FirmwareResource, 00079 const String &) 00080 { 00081 return m2mfirmware_stub::bool_value; 00082 } 00083 00084 bool M2MFirmware::set_resource_value(FirmwareResource, 00085 int64_t) 00086 { 00087 return m2mfirmware_stub::bool_value; 00088 } 00089 00090 String M2MFirmware::resource_value_string(FirmwareResource) const 00091 { 00092 return m2mfirmware_stub::string_value; 00093 } 00094 00095 int64_t M2MFirmware::resource_value_int(FirmwareResource) const 00096 { 00097 return m2mfirmware_stub::int_value; 00098 } 00099 00100 bool M2MFirmware::is_resource_present(FirmwareResource) const 00101 { 00102 return m2mfirmware_stub::bool_value; 00103 } 00104 00105 uint16_t M2MFirmware::per_resource_count(FirmwareResource) const 00106 { 00107 return (uint16_t)m2mfirmware_stub::int_value; 00108 } 00109 00110 uint16_t M2MFirmware::total_resource_count() const 00111 { 00112 return (uint16_t)m2mfirmware_stub::int_value; 00113 }
Generated on Tue Jul 12 2022 12:28:37 by
