Racelogic / Mbed 2 deprecated VIPS_LTC_RAW_IMU

Dependencies:   BufferedSerial FatFileSystemCpp mbed

Committer:
JamieB
Date:
Thu Feb 03 11:50:12 2022 +0000
Revision:
69:47f800793d00
Parent:
22:0dd9c1b5664a
v24, Added TCP upload of VIPS configuration to Rover

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AndyA 22:0dd9c1b5664a 1 /* Copyright (C) 2012 mbed.org, MIT License
AndyA 22:0dd9c1b5664a 2 *
AndyA 22:0dd9c1b5664a 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
AndyA 22:0dd9c1b5664a 4 * and associated documentation files (the "Software"), to deal in the Software without restriction,
AndyA 22:0dd9c1b5664a 5 * including without limitation the rights to use, copy, modify, merge, publish, distribute,
AndyA 22:0dd9c1b5664a 6 * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is
AndyA 22:0dd9c1b5664a 7 * furnished to do so, subject to the following conditions:
AndyA 22:0dd9c1b5664a 8 *
AndyA 22:0dd9c1b5664a 9 * The above copyright notice and this permission notice shall be included in all copies or
AndyA 22:0dd9c1b5664a 10 * substantial portions of the Software.
AndyA 22:0dd9c1b5664a 11 *
AndyA 22:0dd9c1b5664a 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
AndyA 22:0dd9c1b5664a 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
AndyA 22:0dd9c1b5664a 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
AndyA 22:0dd9c1b5664a 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
AndyA 22:0dd9c1b5664a 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
AndyA 22:0dd9c1b5664a 17 */
AndyA 22:0dd9c1b5664a 18
AndyA 22:0dd9c1b5664a 19 #ifndef TCPSOCKET_H
AndyA 22:0dd9c1b5664a 20 #define TCPSOCKET_H
AndyA 22:0dd9c1b5664a 21
AndyA 22:0dd9c1b5664a 22 #include "Socket/Socket.h"
AndyA 22:0dd9c1b5664a 23 #include "Socket/Endpoint.h"
AndyA 22:0dd9c1b5664a 24
AndyA 22:0dd9c1b5664a 25 /**
AndyA 22:0dd9c1b5664a 26 TCP socket connection
AndyA 22:0dd9c1b5664a 27 */
AndyA 22:0dd9c1b5664a 28 class TCPSocketConnection : public Socket, public Endpoint {
AndyA 22:0dd9c1b5664a 29 friend class TCPSocketServer;
AndyA 22:0dd9c1b5664a 30
AndyA 22:0dd9c1b5664a 31 public:
AndyA 22:0dd9c1b5664a 32 /** TCP socket connection
AndyA 22:0dd9c1b5664a 33 */
AndyA 22:0dd9c1b5664a 34 TCPSocketConnection();
AndyA 22:0dd9c1b5664a 35
AndyA 22:0dd9c1b5664a 36 /** Connects this TCP socket to the server
AndyA 22:0dd9c1b5664a 37 \param host The host to connect to. It can either be an IP Address or a hostname that will be resolved with DNS.
AndyA 22:0dd9c1b5664a 38 \param port The host's port to connect to.
AndyA 22:0dd9c1b5664a 39 \return 0 on success, -1 on failure.
AndyA 22:0dd9c1b5664a 40 */
AndyA 22:0dd9c1b5664a 41 int connect(const char* host, const int port);
AndyA 22:0dd9c1b5664a 42
AndyA 22:0dd9c1b5664a 43 /** Check if the socket is connected
AndyA 22:0dd9c1b5664a 44 \return true if connected, false otherwise.
AndyA 22:0dd9c1b5664a 45 */
AndyA 22:0dd9c1b5664a 46 bool is_connected(void);
AndyA 22:0dd9c1b5664a 47
AndyA 22:0dd9c1b5664a 48 /** Send data to the remote host.
AndyA 22:0dd9c1b5664a 49 \param data The buffer to send to the host.
AndyA 22:0dd9c1b5664a 50 \param length The length of the buffer to send.
AndyA 22:0dd9c1b5664a 51 \return the number of written bytes on success (>=0) or -1 on failure
AndyA 22:0dd9c1b5664a 52 */
AndyA 22:0dd9c1b5664a 53 int send(char* data, int length);
AndyA 22:0dd9c1b5664a 54
AndyA 22:0dd9c1b5664a 55 /** Send all the data to the remote host.
AndyA 22:0dd9c1b5664a 56 \param data The buffer to send to the host.
AndyA 22:0dd9c1b5664a 57 \param length The length of the buffer to send.
AndyA 22:0dd9c1b5664a 58 \return the number of written bytes on success (>=0) or -1 on failure
AndyA 22:0dd9c1b5664a 59 */
AndyA 22:0dd9c1b5664a 60 int send_all(char* data, int length);
AndyA 22:0dd9c1b5664a 61
AndyA 22:0dd9c1b5664a 62 /** Receive data from the remote host.
AndyA 22:0dd9c1b5664a 63 \param data The buffer in which to store the data received from the host.
AndyA 22:0dd9c1b5664a 64 \param length The maximum length of the buffer.
AndyA 22:0dd9c1b5664a 65 \return the number of received bytes on success (>=0) or -1 on failure
AndyA 22:0dd9c1b5664a 66 */
AndyA 22:0dd9c1b5664a 67 int receive(char* data, int length);
AndyA 22:0dd9c1b5664a 68
AndyA 22:0dd9c1b5664a 69 /** Receive all the data from the remote host.
AndyA 22:0dd9c1b5664a 70 \param data The buffer in which to store the data received from the host.
AndyA 22:0dd9c1b5664a 71 \param length The maximum length of the buffer.
AndyA 22:0dd9c1b5664a 72 \return the number of received bytes on success (>=0) or -1 on failure
AndyA 22:0dd9c1b5664a 73 */
AndyA 22:0dd9c1b5664a 74 int receive_all(char* data, int length);
AndyA 22:0dd9c1b5664a 75
AndyA 22:0dd9c1b5664a 76 private:
AndyA 22:0dd9c1b5664a 77 bool _is_connected;
AndyA 22:0dd9c1b5664a 78
AndyA 22:0dd9c1b5664a 79 };
AndyA 22:0dd9c1b5664a 80
AndyA 22:0dd9c1b5664a 81 #endif