Innomatix Support / InnomatixSupport
Revision:
0:b9e1003fbee7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/MbedTransport/inc/MbedTransport.h	Fri Apr 15 18:35:31 2016 +0000
@@ -0,0 +1,76 @@
+/*******************************************************************
+ *
+ *  File: MbedTransport.h
+ *
+ *  Description: Communications transport layer API for Mbed
+ *
+ *  Copyright 2015 Innomatix, LLC., All Rights Reserved
+ *
+ *  THIS DOCUMENT AND ITS CONTENTS ARE INTELLECTUAL PROPERTY
+ *  OF INNOMATIX, LLC.  ANY DUPLICATION IN PART OR WHOLE
+ *  WITHOUT PRIOR WRITTEN CONSENT IS STRICTLY PROHIBITED.
+ *
+ *******************************************************************/
+#ifndef _MBEDTRANSPORT_H_ 
+#define _MBEDTRANSPORT_H_ 
+
+
+#define DO_SERIAL_NET
+
+#ifndef DO_SERIAL_NET
+#include "EthernetInterface.h"
+#endif
+
+
+#define ADDRESS_LENGTH 256
+
+
+typedef struct
+{
+    char                Address[ADDRESS_LENGTH];
+    int                 Port;
+#ifndef DO_SERIAL_NET
+    UDPSocket           sendSocket;                    
+    UDPSocket           receiveSocket;                 
+    Endpoint            sendEndpoint;                  
+    Endpoint            receiveEndpoint;
+#endif
+   
+}TransportHandle_t, *TransportHandle_p;
+
+/**
+* Function to initialize ethernet, UDP socket sending and UDP socket receiving. 
+*   
+* @param h - TransportHandle that saves all of the socket information for future
+                use when we need to send/recieve information.
+* @retval result - lets us know if there was a success or error.
+***********************************************************************************/
+int TransportInit( TransportHandle_p handle, const char *address, unsigned short port );
+
+
+
+/***********************************************************************************/
+void TransportClose( TransportHandle_p handle );
+
+
+/**
+* Function for sending a buffer via UDP with the socket we set up in Init. 
+*   
+* @param len - length of the buffer we want to send to the server.
+* @param buff - the buffer we would like to send to the server.
+* @retval result - lets us know if there was a success or error.
+******************************************************************************************/
+int TransportSend( TransportHandle_p handle, unsigned short len, const unsigned char *buff, int timeout);
+
+
+/**
+* Function for receving a buffer via UDP with the socket we set up in Init. 
+*   
+* @param maxlen - the maximum length of the buffer we want to receive from the server.
+* @param buff - the buffer we would like to receiver from the server.
+* @retval result - lets us know if there was a success or error.
+***********************************************************************************************/
+int TransportReceive( TransportHandle_p handle, unsigned short maxlen, unsigned char *buff, int timeout );
+
+
+#endif /* _MBEDTRANSPORT_H_ */
\ No newline at end of file