Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterface NTPClient iothub_amqp_transport iothub_client mbed-rtos mbed
Fork of iothub_client_sample_amqp by
tcpsocketconnection_c.cpp
00001 // Copyright (c) Microsoft. All rights reserved. 00002 // Licensed under the MIT license. See LICENSE file in the project root for full license information. 00003 00004 #include "mbed.h" 00005 00006 #include <stddef.h> 00007 #include "TCPSocketConnection.h" 00008 #include "azure_c_shared_utility/tcpsocketconnection_c.h" 00009 00010 00011 TCPSOCKETCONNECTION_HANDLE tcpsocketconnection_create(void) 00012 { 00013 return new TCPSocketConnection(); 00014 } 00015 00016 void tcpsocketconnection_set_blocking(TCPSOCKETCONNECTION_HANDLE tcpSocketConnectionHandle, bool blocking, unsigned int timeout) 00017 { 00018 TCPSocketConnection* tsc = (TCPSocketConnection*)tcpSocketConnectionHandle; 00019 tsc->set_blocking(blocking, timeout); 00020 } 00021 00022 void tcpsocketconnection_destroy(TCPSOCKETCONNECTION_HANDLE tcpSocketConnectionHandle) 00023 { 00024 delete (TCPSocketConnection*)tcpSocketConnectionHandle; 00025 } 00026 00027 int tcpsocketconnection_connect(TCPSOCKETCONNECTION_HANDLE tcpSocketConnectionHandle, const char* host, const int port) 00028 { 00029 TCPSocketConnection* tsc = (TCPSocketConnection*)tcpSocketConnectionHandle; 00030 return tsc->connect(host, port); 00031 } 00032 00033 bool tcpsocketconnection_is_connected(TCPSOCKETCONNECTION_HANDLE tcpSocketConnectionHandle) 00034 { 00035 TCPSocketConnection* tsc = (TCPSocketConnection*)tcpSocketConnectionHandle; 00036 return tsc->is_connected(); 00037 } 00038 00039 void tcpsocketconnection_close(TCPSOCKETCONNECTION_HANDLE tcpSocketConnectionHandle) 00040 { 00041 TCPSocketConnection* tsc = (TCPSocketConnection*)tcpSocketConnectionHandle; 00042 tsc->close(); 00043 } 00044 00045 int tcpsocketconnection_send(TCPSOCKETCONNECTION_HANDLE tcpSocketConnectionHandle, const char* data, int length) 00046 { 00047 TCPSocketConnection* tsc = (TCPSocketConnection*)tcpSocketConnectionHandle; 00048 return tsc->send((char*)data, length); 00049 } 00050 00051 int tcpsocketconnection_send_all(TCPSOCKETCONNECTION_HANDLE tcpSocketConnectionHandle, const char* data, int length) 00052 { 00053 TCPSocketConnection* tsc = (TCPSocketConnection*)tcpSocketConnectionHandle; 00054 return tsc->send_all((char*)data, length); 00055 } 00056 00057 int tcpsocketconnection_receive(TCPSOCKETCONNECTION_HANDLE tcpSocketConnectionHandle, char* data, int length) 00058 { 00059 TCPSocketConnection* tsc = (TCPSocketConnection*)tcpSocketConnectionHandle; 00060 return tsc->receive(data, length); 00061 } 00062 00063 int tcpsocketconnection_receive_all(TCPSOCKETCONNECTION_HANDLE tcpSocketConnectionHandle, char* data, int length) 00064 { 00065 TCPSocketConnection* tsc = (TCPSocketConnection*)tcpSocketConnectionHandle; 00066 return tsc->receive_all(data, length); 00067 }
Generated on Tue Jul 12 2022 12:43:24 by
