• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*******************************************************************************
2  * Copyright (c) 2014 IBM Corp.
3  *
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * and Eclipse Distribution License v1.0 which accompany this distribution.
7  *
8  * The Eclipse Public License is available at
9  *    http://www.eclipse.org/legal/epl-v10.html
10  * and the Eclipse Distribution License is available at
11  *   http://www.eclipse.org/org/documents/edl-v10.php.
12  *
13  * Contributors:
14  *    Allan Stockdill-Mander - initial API and implementation and/or initial documentation
15  *******************************************************************************/
16 
17 #ifndef __MQTT_CC3200_
18 #define __MQTT_CC3200_
19 
20 #include "simplelink.h"
21 #include "netapp.h"
22 #include "socket.h"
23 #include "hw_types.h"
24 #include "systick.h"
25 
26 typedef struct Timer Timer;
27 
28 struct Timer {
29 	unsigned long systick_period;
30 	unsigned long end_time;
31 };
32 
33 typedef struct Network Network;
34 
35 struct Network
36 {
37 	int my_socket;
38 	int (*mqttread) (Network*, unsigned char*, int, int);
39 	int (*mqttwrite) (Network*, unsigned char*, int, int);
40 	void (*disconnect) (Network*);
41 };
42 
43 char expired(Timer*);
44 void countdown_ms(Timer*, unsigned int);
45 void countdown(Timer*, unsigned int);
46 int left_ms(Timer*);
47 
48 void InitTimer(Timer*);
49 
50 int cc3200_read(Network*, unsigned char*, int, int);
51 int cc3200_write(Network*, unsigned char*, int, int);
52 void cc3200_disconnect(Network*);
53 void NewNetwork(Network*);
54 
55 int ConnectNetwork(Network*, char*, int);
56 int TLSConnectNetwork(Network*, char*, int, SlSockSecureFiles_t*, unsigned char, unsigned int, char);
57 
58 #endif
59