This is a fork due to permission issues

Dependencies:   mbed Socket lwip-eth lwip-sys lwip

Fork of 6_songs-from-the-cloud by MakingMusicWorkshop

Committer:
timbeight
Date:
Thu May 19 16:02:10 2016 +0000
Revision:
1:0ddbe2d3319c
Parent:
0:f7c60d3e7b8a
This is my first commit while in the class.

Who changed what in which revision?

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