FRDM K64F Metronome

Committer:
ram54288
Date:
Sun May 14 18:35:07 2017 +0000
Revision:
0:a2cb7295a1f7
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ram54288 0:a2cb7295a1f7 1 /*
ram54288 0:a2cb7295a1f7 2 * Copyright (c) 2015 ARM Limited. All rights reserved.
ram54288 0:a2cb7295a1f7 3 * SPDX-License-Identifier: Apache-2.0
ram54288 0:a2cb7295a1f7 4 * Licensed under the Apache License, Version 2.0 (the License); you may
ram54288 0:a2cb7295a1f7 5 * not use this file except in compliance with the License.
ram54288 0:a2cb7295a1f7 6 * You may obtain a copy of the License at
ram54288 0:a2cb7295a1f7 7 *
ram54288 0:a2cb7295a1f7 8 * http://www.apache.org/licenses/LICENSE-2.0
ram54288 0:a2cb7295a1f7 9 *
ram54288 0:a2cb7295a1f7 10 * Unless required by applicable law or agreed to in writing, software
ram54288 0:a2cb7295a1f7 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
ram54288 0:a2cb7295a1f7 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
ram54288 0:a2cb7295a1f7 13 * See the License for the specific language governing permissions and
ram54288 0:a2cb7295a1f7 14 * limitations under the License.
ram54288 0:a2cb7295a1f7 15 */
ram54288 0:a2cb7295a1f7 16 #include "m2mdevice_stub.h"
ram54288 0:a2cb7295a1f7 17
ram54288 0:a2cb7295a1f7 18 uint32_t m2mdevice_stub::int_value;
ram54288 0:a2cb7295a1f7 19 bool m2mdevice_stub::bool_value;
ram54288 0:a2cb7295a1f7 20 M2MResource* m2mdevice_stub::resource;
ram54288 0:a2cb7295a1f7 21 String *m2mdevice_stub::string_value;
ram54288 0:a2cb7295a1f7 22
ram54288 0:a2cb7295a1f7 23 void m2mdevice_stub::clear()
ram54288 0:a2cb7295a1f7 24 {
ram54288 0:a2cb7295a1f7 25 int_value = -1;
ram54288 0:a2cb7295a1f7 26 bool_value = false;
ram54288 0:a2cb7295a1f7 27 *string_value = "";
ram54288 0:a2cb7295a1f7 28 resource = NULL;
ram54288 0:a2cb7295a1f7 29 }
ram54288 0:a2cb7295a1f7 30
ram54288 0:a2cb7295a1f7 31 M2MDevice::M2MDevice(char *path)
ram54288 0:a2cb7295a1f7 32 : M2MObject("3", path)
ram54288 0:a2cb7295a1f7 33 {
ram54288 0:a2cb7295a1f7 34 m2mdevice_stub::string_value = new String("");
ram54288 0:a2cb7295a1f7 35 }
ram54288 0:a2cb7295a1f7 36
ram54288 0:a2cb7295a1f7 37 M2MDevice::~M2MDevice()
ram54288 0:a2cb7295a1f7 38 {
ram54288 0:a2cb7295a1f7 39 delete m2mdevice_stub::string_value;
ram54288 0:a2cb7295a1f7 40 }
ram54288 0:a2cb7295a1f7 41
ram54288 0:a2cb7295a1f7 42 M2MDevice* M2MDevice::get_instance()
ram54288 0:a2cb7295a1f7 43 {
ram54288 0:a2cb7295a1f7 44 return new M2MDevice("3");
ram54288 0:a2cb7295a1f7 45 }
ram54288 0:a2cb7295a1f7 46
ram54288 0:a2cb7295a1f7 47 void M2MDevice::delete_instance()
ram54288 0:a2cb7295a1f7 48 {
ram54288 0:a2cb7295a1f7 49 }
ram54288 0:a2cb7295a1f7 50
ram54288 0:a2cb7295a1f7 51 M2MResource* M2MDevice::create_resource(DeviceResource, const String &)
ram54288 0:a2cb7295a1f7 52 {
ram54288 0:a2cb7295a1f7 53 return m2mdevice_stub::resource;
ram54288 0:a2cb7295a1f7 54 }
ram54288 0:a2cb7295a1f7 55
ram54288 0:a2cb7295a1f7 56 M2MResource* M2MDevice::create_resource(DeviceResource)
ram54288 0:a2cb7295a1f7 57 {
ram54288 0:a2cb7295a1f7 58 return m2mdevice_stub::resource;
ram54288 0:a2cb7295a1f7 59 }
ram54288 0:a2cb7295a1f7 60
ram54288 0:a2cb7295a1f7 61 bool M2MDevice::delete_resource(DeviceResource)
ram54288 0:a2cb7295a1f7 62 {
ram54288 0:a2cb7295a1f7 63 return m2mdevice_stub::bool_value;
ram54288 0:a2cb7295a1f7 64 }
ram54288 0:a2cb7295a1f7 65
ram54288 0:a2cb7295a1f7 66 bool M2MDevice::delete_resource_instance(DeviceResource, uint16_t)
ram54288 0:a2cb7295a1f7 67 {
ram54288 0:a2cb7295a1f7 68 return m2mdevice_stub::bool_value;
ram54288 0:a2cb7295a1f7 69 }
ram54288 0:a2cb7295a1f7 70
ram54288 0:a2cb7295a1f7 71 bool M2MDevice::set_resource_value(DeviceResource,
ram54288 0:a2cb7295a1f7 72 const String &,
ram54288 0:a2cb7295a1f7 73 uint16_t )
ram54288 0:a2cb7295a1f7 74 {
ram54288 0:a2cb7295a1f7 75 return m2mdevice_stub::bool_value;
ram54288 0:a2cb7295a1f7 76 }
ram54288 0:a2cb7295a1f7 77
ram54288 0:a2cb7295a1f7 78 bool M2MDevice::set_resource_value(DeviceResource,
ram54288 0:a2cb7295a1f7 79 int64_t,
ram54288 0:a2cb7295a1f7 80 uint16_t)
ram54288 0:a2cb7295a1f7 81 {
ram54288 0:a2cb7295a1f7 82 return m2mdevice_stub::bool_value;
ram54288 0:a2cb7295a1f7 83 }
ram54288 0:a2cb7295a1f7 84
ram54288 0:a2cb7295a1f7 85 String M2MDevice::resource_value_string(DeviceResource,
ram54288 0:a2cb7295a1f7 86 uint16_t) const
ram54288 0:a2cb7295a1f7 87 {
ram54288 0:a2cb7295a1f7 88 return *m2mdevice_stub::string_value;
ram54288 0:a2cb7295a1f7 89 }
ram54288 0:a2cb7295a1f7 90
ram54288 0:a2cb7295a1f7 91 int64_t M2MDevice::resource_value_int(DeviceResource,
ram54288 0:a2cb7295a1f7 92 uint16_t) const
ram54288 0:a2cb7295a1f7 93 {
ram54288 0:a2cb7295a1f7 94 return m2mdevice_stub::int_value;
ram54288 0:a2cb7295a1f7 95 }
ram54288 0:a2cb7295a1f7 96
ram54288 0:a2cb7295a1f7 97 bool M2MDevice::is_resource_present(DeviceResource) const
ram54288 0:a2cb7295a1f7 98 {
ram54288 0:a2cb7295a1f7 99 return m2mdevice_stub::bool_value;
ram54288 0:a2cb7295a1f7 100 }
ram54288 0:a2cb7295a1f7 101
ram54288 0:a2cb7295a1f7 102 uint16_t M2MDevice::per_resource_count(DeviceResource) const
ram54288 0:a2cb7295a1f7 103 {
ram54288 0:a2cb7295a1f7 104 return (uint16_t)m2mdevice_stub::int_value;
ram54288 0:a2cb7295a1f7 105 }
ram54288 0:a2cb7295a1f7 106
ram54288 0:a2cb7295a1f7 107 uint16_t M2MDevice::total_resource_count() const
ram54288 0:a2cb7295a1f7 108 {
ram54288 0:a2cb7295a1f7 109 return (uint16_t)m2mdevice_stub::int_value;
ram54288 0:a2cb7295a1f7 110 }