Toyomasa Watarai / simple-mbed-cloud-client

Dependents:  

Committer:
MACRUM
Date:
Mon Jul 02 06:30:39 2018 +0000
Revision:
0:276e7a263c35
Initial commit

Who changed what in which revision?

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