Local copy

Dependencies:   C12832_lcd ConfigFile EthernetInterface LM75B MMA7660 MQTTPacket mbed-rtos mbed

Fork of IBMIoTClientExampleForLPC1768 by Sam Danbury

src/QuickstartClient.h

Committer:
samdanbury
Date:
2014-06-24
Revision:
3:ca5b84eb8f3b
Parent:
2:25ddff75a8c7
Child:
6:a022f983f94b

File content as of revision 3:ca5b84eb8f3b:

/*******************************************************************************
* Copyright (c) 2014 IBM Corporation and other Contributors.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors: Sam Danbury
* IBM - Initial Contribution
*******************************************************************************/

#include "MQTTPacket.h"
#include "rtos.h"
#include "mbed.h"
#include "EthernetInterface.h"
#include "C12832_lcd.h"
#include "ConfigFile.h"

#include <string>
#include <vector>
#include <map>
#include <sstream>
#include <algorithm>

#define IBM_IOT_BROKER "37.58.109.238"
#define IBM_IOT_PORT 1883

using namespace std;

class QuickstartClient {
    public:
        bool connected;
        C12832_LCD lcd;
        TCPSocketConnection mysock;
        string macAddress;
        char topic[30];
        bool quickstartMode;
        
        string org;
        string type;
        string id;
        string token;
                
        QuickstartClient(string mac);
        void loadConfig();
        void tryMqttConnect();
        void connect();
        void publish(string payload);
        bool getConnection();
        int reconnectDelay(int attempt);
};