leo hendrickson / Mbed OS example-Ethernet-mbed-Cloud-connect
Committer:
leothedragon
Date:
Tue May 04 08:55:12 2021 +0000
Revision:
0:8f0bb79ddd48
nmn

Who changed what in which revision?

UserRevisionLine numberNew contents of line
leothedragon 0:8f0bb79ddd48 1 /*
leothedragon 0:8f0bb79ddd48 2 * Copyright (c) 2015 ARM Limited. All rights reserved.
leothedragon 0:8f0bb79ddd48 3 * SPDX-License-Identifier: Apache-2.0
leothedragon 0:8f0bb79ddd48 4 * Licensed under the Apache License, Version 2.0 (the License); you may
leothedragon 0:8f0bb79ddd48 5 * not use this file except in compliance with the License.
leothedragon 0:8f0bb79ddd48 6 * You may obtain a copy of the License at
leothedragon 0:8f0bb79ddd48 7 *
leothedragon 0:8f0bb79ddd48 8 * http://www.apache.org/licenses/LICENSE-2.0
leothedragon 0:8f0bb79ddd48 9 *
leothedragon 0:8f0bb79ddd48 10 * Unless required by applicable law or agreed to in writing, software
leothedragon 0:8f0bb79ddd48 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
leothedragon 0:8f0bb79ddd48 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
leothedragon 0:8f0bb79ddd48 13 * See the License for the specific language governing permissions and
leothedragon 0:8f0bb79ddd48 14 * limitations under the License.
leothedragon 0:8f0bb79ddd48 15 */
leothedragon 0:8f0bb79ddd48 16 #include "mbed-client-classic/m2mconnectionhandlerpimpl.h"
leothedragon 0:8f0bb79ddd48 17 #include "mbed-client/m2mconnectionobserver.h"
leothedragon 0:8f0bb79ddd48 18 #include "mbed-client/m2mconnectionhandler.h"
leothedragon 0:8f0bb79ddd48 19 #include "mbed-client/m2mconstants.h"
leothedragon 0:8f0bb79ddd48 20
leothedragon 0:8f0bb79ddd48 21 M2MConnectionHandler::M2MConnectionHandler(M2MConnectionObserver &observer,
leothedragon 0:8f0bb79ddd48 22 M2MConnectionSecurity* sec,
leothedragon 0:8f0bb79ddd48 23 M2MInterface::BindingMode mode,
leothedragon 0:8f0bb79ddd48 24 M2MInterface::NetworkStack stack)
leothedragon 0:8f0bb79ddd48 25 :_observer(observer)
leothedragon 0:8f0bb79ddd48 26 {
leothedragon 0:8f0bb79ddd48 27 _private_impl = new M2MConnectionHandlerPimpl(this, observer, sec, mode, stack);
leothedragon 0:8f0bb79ddd48 28 }
leothedragon 0:8f0bb79ddd48 29
leothedragon 0:8f0bb79ddd48 30 M2MConnectionHandler::~M2MConnectionHandler()
leothedragon 0:8f0bb79ddd48 31 {
leothedragon 0:8f0bb79ddd48 32 delete _private_impl;
leothedragon 0:8f0bb79ddd48 33 }
leothedragon 0:8f0bb79ddd48 34
leothedragon 0:8f0bb79ddd48 35 bool M2MConnectionHandler::bind_connection(const uint16_t listen_port)
leothedragon 0:8f0bb79ddd48 36 {
leothedragon 0:8f0bb79ddd48 37
leothedragon 0:8f0bb79ddd48 38 return _private_impl->bind_connection(listen_port);
leothedragon 0:8f0bb79ddd48 39 }
leothedragon 0:8f0bb79ddd48 40
leothedragon 0:8f0bb79ddd48 41 bool M2MConnectionHandler::resolve_server_address(const String& server_address,
leothedragon 0:8f0bb79ddd48 42 const uint16_t server_port,
leothedragon 0:8f0bb79ddd48 43 M2MConnectionObserver::ServerType server_type,
leothedragon 0:8f0bb79ddd48 44 const M2MSecurity* security)
leothedragon 0:8f0bb79ddd48 45 {
leothedragon 0:8f0bb79ddd48 46 return _private_impl->resolve_server_address(server_address, server_port,
leothedragon 0:8f0bb79ddd48 47 server_type, security);
leothedragon 0:8f0bb79ddd48 48 }
leothedragon 0:8f0bb79ddd48 49
leothedragon 0:8f0bb79ddd48 50 bool M2MConnectionHandler::start_listening_for_data()
leothedragon 0:8f0bb79ddd48 51 {
leothedragon 0:8f0bb79ddd48 52 return _private_impl->start_listening_for_data();
leothedragon 0:8f0bb79ddd48 53 }
leothedragon 0:8f0bb79ddd48 54
leothedragon 0:8f0bb79ddd48 55 void M2MConnectionHandler::stop_listening()
leothedragon 0:8f0bb79ddd48 56 {
leothedragon 0:8f0bb79ddd48 57 _private_impl->stop_listening();
leothedragon 0:8f0bb79ddd48 58 }
leothedragon 0:8f0bb79ddd48 59
leothedragon 0:8f0bb79ddd48 60 bool M2MConnectionHandler::send_data(uint8_t *data,
leothedragon 0:8f0bb79ddd48 61 uint16_t data_len,
leothedragon 0:8f0bb79ddd48 62 sn_nsdl_addr_s *address)
leothedragon 0:8f0bb79ddd48 63 {
leothedragon 0:8f0bb79ddd48 64 return _private_impl->send_data(data, data_len, address);
leothedragon 0:8f0bb79ddd48 65 }
leothedragon 0:8f0bb79ddd48 66
leothedragon 0:8f0bb79ddd48 67 void M2MConnectionHandler::handle_connection_error(int error)
leothedragon 0:8f0bb79ddd48 68 {
leothedragon 0:8f0bb79ddd48 69 _private_impl->handle_connection_error(error);
leothedragon 0:8f0bb79ddd48 70 }
leothedragon 0:8f0bb79ddd48 71
leothedragon 0:8f0bb79ddd48 72 void M2MConnectionHandler::set_platform_network_handler(void *handler)
leothedragon 0:8f0bb79ddd48 73 {
leothedragon 0:8f0bb79ddd48 74 _private_impl->set_platform_network_handler(handler);
leothedragon 0:8f0bb79ddd48 75 }
leothedragon 0:8f0bb79ddd48 76
leothedragon 0:8f0bb79ddd48 77 void M2MConnectionHandler::claim_mutex()
leothedragon 0:8f0bb79ddd48 78 {
leothedragon 0:8f0bb79ddd48 79 _private_impl->claim_mutex();
leothedragon 0:8f0bb79ddd48 80 }
leothedragon 0:8f0bb79ddd48 81
leothedragon 0:8f0bb79ddd48 82 void M2MConnectionHandler::release_mutex()
leothedragon 0:8f0bb79ddd48 83 {
leothedragon 0:8f0bb79ddd48 84 _private_impl->release_mutex();
leothedragon 0:8f0bb79ddd48 85 }
leothedragon 0:8f0bb79ddd48 86
leothedragon 0:8f0bb79ddd48 87 void M2MConnectionHandler::force_close()
leothedragon 0:8f0bb79ddd48 88 {
leothedragon 0:8f0bb79ddd48 89 _private_impl->force_close();
leothedragon 0:8f0bb79ddd48 90 }
leothedragon 0:8f0bb79ddd48 91
leothedragon 0:8f0bb79ddd48 92 void M2MConnectionHandler::unregister_network_handler()
leothedragon 0:8f0bb79ddd48 93 {
leothedragon 0:8f0bb79ddd48 94 _private_impl->unregister_network_handler();
leothedragon 0:8f0bb79ddd48 95 }