Ram Gandikota / Mbed OS ABCD
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers m2mconnectionhandler_stub.cpp Source File

m2mconnectionhandler_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 "m2mconnectionhandler_stub.h"
00017 #include "m2mconnectionsecurity.h"
00018 #include "common_stub.h"
00019 
00020 int m2mconnectionhandler_stub::int_value;
00021 uint16_t m2mconnectionhandler_stub::uint_value;
00022 bool m2mconnectionhandler_stub::bool_value;
00023 M2MConnectionSecurity* secu = NULL;
00024 
00025 void m2mconnectionhandler_stub::clear()
00026 {
00027     int_value = -1;
00028     uint_value = 0;
00029     bool_value = false;
00030 }
00031 
00032 M2MConnectionHandler::M2MConnectionHandler(M2MConnectionObserver &observer,
00033                                            M2MConnectionSecurity* sec,
00034                                            M2MInterface::BindingMode,
00035                                            M2MInterface::NetworkStack)
00036 :_observer(observer)
00037 {
00038     if (secu) {
00039         delete secu;
00040         secu = NULL;
00041     }
00042     secu = sec;
00043 }
00044 
00045 M2MConnectionHandler::~M2MConnectionHandler()
00046 {
00047     if( secu ){
00048         delete secu;
00049         secu = NULL;
00050     }
00051 }
00052 
00053 bool M2MConnectionHandler::bind_connection(const uint16_t)
00054 {
00055     return m2mconnectionhandler_stub::bool_value;
00056 }
00057 
00058 bool M2MConnectionHandler::resolve_server_address(const String&,
00059                                                   const uint16_t,
00060                                                   M2MConnectionObserver::ServerType,
00061                                                   const M2MSecurity* )
00062 {
00063     return m2mconnectionhandler_stub::bool_value;
00064 }
00065 
00066 bool M2MConnectionHandler::start_listening_for_data()
00067 {
00068     return m2mconnectionhandler_stub::bool_value;
00069 }
00070 
00071 bool M2MConnectionHandler::send_data(uint8_t *,
00072                                      uint16_t ,
00073                                      sn_nsdl_addr_s *)
00074 {
00075     return m2mconnectionhandler_stub::bool_value;
00076 }
00077 
00078 void M2MConnectionHandler::stop_listening()
00079 {
00080 }
00081 
00082 int M2MConnectionHandler::send_to_socket(const unsigned char *, size_t ){
00083     return m2mconnectionhandler_stub::int_value;
00084 }
00085 
00086 int M2MConnectionHandler::receive_from_socket(unsigned char *, size_t){
00087     return m2mconnectionhandler_stub::int_value;
00088 }
00089 
00090 void M2MConnectionHandler::set_platform_network_handler(void *)
00091 {
00092 }
00093 
00094 void M2MConnectionHandler::claim_mutex()
00095 {
00096 }
00097 
00098 void M2MConnectionHandler::release_mutex()
00099 {
00100 }