Jack Hansdampf / mbed-mqtt-GSOE1

Dependents:   ESP8266MQTT

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MQTTCC3200.h Source File

MQTTCC3200.h

00001 /*******************************************************************************
00002  * Copyright (c) 2014 IBM Corp.
00003  *
00004  * All rights reserved. This program and the accompanying materials
00005  * are made available under the terms of the Eclipse Public License v1.0
00006  * and Eclipse Distribution License v1.0 which accompany this distribution.
00007  *
00008  * The Eclipse Public License is available at
00009  *    http://www.eclipse.org/legal/epl-v10.html
00010  * and the Eclipse Distribution License is available at
00011  *   http://www.eclipse.org/org/documents/edl-v10.php.
00012  *
00013  * Contributors:
00014  *    Allan Stockdill-Mander - initial API and implementation and/or initial documentation
00015  *******************************************************************************/
00016 
00017 #ifndef __MQTT_CC3200_
00018 #define __MQTT_CC3200_
00019 
00020 #include "simplelink.h"
00021 #include "netapp.h"
00022 #include "socket.h"
00023 #include "hw_types.h"
00024 #include "systick.h"
00025 
00026 typedef struct Timer Timer;
00027 
00028 struct Timer {
00029     unsigned long systick_period;
00030     unsigned long end_time;
00031 };
00032 
00033 typedef struct Network Network;
00034 
00035 struct Network
00036 {
00037     int my_socket;
00038     int (*mqttread) (Network*, unsigned char*, int, int);
00039     int (*mqttwrite) (Network*, unsigned char*, int, int);
00040     void (*disconnect) (Network*);
00041 };
00042 
00043 char expired(Timer*);
00044 void countdown_ms(Timer*, unsigned int);
00045 void countdown(Timer*, unsigned int);
00046 int left_ms(Timer*);
00047 
00048 void InitTimer(Timer*);
00049 
00050 int cc3200_read(Network*, unsigned char*, int, int);
00051 int cc3200_write(Network*, unsigned char*, int, int);
00052 void cc3200_disconnect(Network*);
00053 void NewNetwork(Network*);
00054 
00055 int ConnectNetwork(Network*, char*, int);
00056 int TLSConnectNetwork(Network*, char*, int, SlSockSecureFiles_t*, unsigned char, unsigned int, char);
00057 
00058 #endif