Update revision to use TI's mqtt and Freertos.

Dependencies:   mbed client server

Fork of cc3100_Test_mqtt_CM3 by David Fletcher

Committer:
dflet
Date:
Thu Sep 03 14:02:37 2015 +0000
Revision:
3:a8c249046181
SPI Mode change 1 to 0

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dflet 3:a8c249046181 1 /******************************************************************************
dflet 3:a8c249046181 2 *
dflet 3:a8c249046181 3 * Copyright (C) 2014 Texas Instruments Incorporated
dflet 3:a8c249046181 4 *
dflet 3:a8c249046181 5 * All rights reserved. Property of Texas Instruments Incorporated.
dflet 3:a8c249046181 6 * Restricted rights to use, duplicate or disclose this code are
dflet 3:a8c249046181 7 * granted through contract.
dflet 3:a8c249046181 8 *
dflet 3:a8c249046181 9 * The program may not be used without the written permission of
dflet 3:a8c249046181 10 * Texas Instruments Incorporated or against the terms and conditions
dflet 3:a8c249046181 11 * stipulated in the agreement under which this program has been supplied,
dflet 3:a8c249046181 12 * and under no circumstances can it be used with non-TI connectivity device.
dflet 3:a8c249046181 13 *
dflet 3:a8c249046181 14 ******************************************************************************/
dflet 3:a8c249046181 15
dflet 3:a8c249046181 16 /*
dflet 3:a8c249046181 17 Network Services for General Purpose Linux environment
dflet 3:a8c249046181 18 */
dflet 3:a8c249046181 19
dflet 3:a8c249046181 20 #ifndef __CC31XX_SL_NET_H__
dflet 3:a8c249046181 21 #define __CC31XX_SL_NET_H__
dflet 3:a8c249046181 22
dflet 3:a8c249046181 23 #include "cc3100_simplelink.h"
dflet 3:a8c249046181 24 #include "mqtt_client.h" /* conn options */
dflet 3:a8c249046181 25
dflet 3:a8c249046181 26 #ifdef __cplusplus
dflet 3:a8c249046181 27 extern "C"
dflet 3:a8c249046181 28 {
dflet 3:a8c249046181 29 #endif
dflet 3:a8c249046181 30
dflet 3:a8c249046181 31 namespace mbed_mqtt {
dflet 3:a8c249046181 32
dflet 3:a8c249046181 33 //*****************************************************************************
dflet 3:a8c249046181 34 // MACROS
dflet 3:a8c249046181 35 //*****************************************************************************
dflet 3:a8c249046181 36
dflet 3:a8c249046181 37 // MACRO to include receive time out feature
dflet 3:a8c249046181 38 #define SOC_RCV_TIMEOUT_OPT 1
dflet 3:a8c249046181 39
dflet 3:a8c249046181 40
dflet 3:a8c249046181 41 /*-----------------------------------------------------------------------------
dflet 3:a8c249046181 42 definitions needed for the functions in this file
dflet 3:a8c249046181 43 -----------------------------------------------------------------------------*/
dflet 3:a8c249046181 44
dflet 3:a8c249046181 45
dflet 3:a8c249046181 46 /*-----------------------------------------------------------------------------
dflet 3:a8c249046181 47 prototypes of functions
dflet 3:a8c249046181 48 -----------------------------------------------------------------------------*/
dflet 3:a8c249046181 49
dflet 3:a8c249046181 50 int32_t comm_open(uint32_t nwconn_opts, const char *server_addr, uint16_t port_number,
dflet 3:a8c249046181 51 const struct secure_conn *nw_security);
dflet 3:a8c249046181 52 int32_t tcp_send(int32_t comm, const uint8_t *buf, uint32_t len, void *ctx);
dflet 3:a8c249046181 53 int32_t tcp_recv(int32_t comm, uint8_t *buf, uint32_t len, uint32_t wait_secs, bool *timed_out,
dflet 3:a8c249046181 54 void *ctx);
dflet 3:a8c249046181 55 int32_t comm_close(int32_t comm);
dflet 3:a8c249046181 56 uint32_t rtc_secs(void);
dflet 3:a8c249046181 57
dflet 3:a8c249046181 58 /*-----------------functions added for server -----------------------------*/
dflet 3:a8c249046181 59
dflet 3:a8c249046181 60 int32_t tcp_listen(uint32_t nwconn_info, uint16_t port_number,
dflet 3:a8c249046181 61 const struct secure_conn *nw_security);
dflet 3:a8c249046181 62
dflet 3:a8c249046181 63 int32_t tcp_select(int32_t *recv_cvec, int32_t *send_cvec, int32_t *rsvd_cvec,
dflet 3:a8c249046181 64 uint32_t wait_secs);
dflet 3:a8c249046181 65
dflet 3:a8c249046181 66
dflet 3:a8c249046181 67 int32_t tcp_accept(int32_t listen_hnd, uint8_t *client_ip,
dflet 3:a8c249046181 68 uint32_t *ip_length);
dflet 3:a8c249046181 69
dflet 3:a8c249046181 70 /*----------------- adding functions for udp functionalities -------------------*/
dflet 3:a8c249046181 71
dflet 3:a8c249046181 72 /** Send a UDP packet
dflet 3:a8c249046181 73
dflet 3:a8c249046181 74 @param[in] comm communication entity handle; socket handle in this case
dflet 3:a8c249046181 75 @param[in] buf buf to be sent in the udp packet
dflet 3:a8c249046181 76 @param[in] len length of the buffer buf
dflet 3:a8c249046181 77 @param[in] dest_port destination port number
dflet 3:a8c249046181 78 @param[in] dest_ip ip address of the destination in dot notation, interpretted as a string;
dflet 3:a8c249046181 79 Only IPV4 is supported currently.
dflet 3:a8c249046181 80 @param[in] ip_len length of string dest_ip; currently not used
dflet 3:a8c249046181 81 @return number of bytes sent or error returned by sl_SendTo call
dflet 3:a8c249046181 82 */
dflet 3:a8c249046181 83 int32_t send_dest(int32_t, const uint8_t *buf, uint32_t len, uint16_t dest_port, const uint8_t *dest_ip, uint32_t ip_len);
dflet 3:a8c249046181 84
dflet 3:a8c249046181 85 /** Recieve a UDP packet
dflet 3:a8c249046181 86
dflet 3:a8c249046181 87 @param[in] comm communication entity handle; socket handle in this case
dflet 3:a8c249046181 88 @param[out] buf buf into which received UDP packet is written
dflet 3:a8c249046181 89 @param[in] maximum len length of the buffer buf
dflet 3:a8c249046181 90 @param[out] from_port port number of UDP packet source
dflet 3:a8c249046181 91 @param[out] from_ip ip address of the UDP packet source.
dflet 3:a8c249046181 92 The ip address is to be interpreted as a uint32_t number in network byte ordering
dflet 3:a8c249046181 93 Only IPV4 is supported currently.
dflet 3:a8c249046181 94 @param[out] ip_len length of string from_ip;
dflet 3:a8c249046181 95 currently always populated with 4 as the address is a IPV4 address
dflet 3:a8c249046181 96 @return number of bytes received or error returned by sl_RecvFrom call
dflet 3:a8c249046181 97 */
dflet 3:a8c249046181 98 int32_t recv_from(int32_t comm, uint8_t *buf, uint32_t len, uint16_t *from_port, uint8_t *from_ip, uint32_t *ip_len);
dflet 3:a8c249046181 99
dflet 3:a8c249046181 100 }//namespace mbed_mqtt
dflet 3:a8c249046181 101
dflet 3:a8c249046181 102 #ifdef __cplusplus
dflet 3:a8c249046181 103 }
dflet 3:a8c249046181 104 #endif
dflet 3:a8c249046181 105
dflet 3:a8c249046181 106 #endif
dflet 3:a8c249046181 107