dhgdh

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by joey shelton

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers m2msecurity_stub.cpp Source File

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