Enclose references to OsWrapper in #if defines

This commit is contained in:
Ian Craggs 2018-02-16 20:16:22 +00:00
parent 0601d9b4a1
commit bef1e5cea1
4 changed files with 15 additions and 7 deletions

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2013 IBM Corp.
* Copyright (c) 2012, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -25,9 +25,11 @@
#include <windows.h>
#endif
#if defined(_WRS_KERNEL)
#include <OsWrapper.h>
#endif
#define ADDRESS "tcp://m2m.eclipse.org:1883"
#define ADDRESS "tcp://iot.eclipse.org:1883"
#define CLIENTID "ExampleClientPub"
#define TOPIC "MQTT Examples"
#define PAYLOAD "Hello World!"

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2017 IBM Corp.
* Copyright (c) 2012, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -25,7 +25,9 @@
#include <windows.h>
#endif
#if defined(_WRS_KERNEL)
#include <OsWrapper.h>
#endif
#define ADDRESS "tcp://localhost:1883"
#define CLIENTID "ExampleClientSub"

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2016 IBM Corp.
* Copyright (c) 2012, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -53,7 +53,9 @@
#include <unistd.h>
#endif
#if defined(_WRS_KERNEL)
#include <OsWrapper.h>
#endif
volatile int toStop = 0;
@ -153,7 +155,7 @@ void myconnect(MQTTAsync* client)
conn_opts.onFailure = onConnectFailure;
conn_opts.context = client;
ssl_opts.enableServerCertAuth = 0;
conn_opts.ssl = &ssl_opts;
//conn_opts.ssl = &ssl_opts; need to link with SSL library for this to work
conn_opts.automaticReconnect = 1;
connected = 0;
if ((rc = MQTTAsync_connect(*client, &conn_opts)) != MQTTASYNC_SUCCESS)
@ -195,7 +197,7 @@ void connectionLost(void* context, char* cause)
conn_opts.onFailure = onConnectFailure;
conn_opts.context = client;
ssl_opts.enableServerCertAuth = 0;
conn_opts.ssl = &ssl_opts;
//conn_opts.ssl = &ssl_opts; need to link with SSL library for this to work
connected = 0;
if ((rc = MQTTAsync_connect(client, &conn_opts)) != MQTTASYNC_SUCCESS)
{

View File

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2012, 2013 IBM Corp.
* Copyright (c) 2012, 2018 IBM Corp.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@ -56,7 +56,9 @@
#include <unistd.h>
#endif
#if defined(_WRS_KERNEL)
#include <OsWrapper.h>
#endif
volatile int finished = 0;
char* topic = NULL;