Commit bef1e5ce authored by Ian Craggs's avatar Ian Craggs

Enclose references to OsWrapper in #if defines

parent 0601d9b4
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012, 2013 IBM Corp. * Copyright (c) 2012, 2018 IBM Corp.
* *
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
...@@ -25,9 +25,11 @@ ...@@ -25,9 +25,11 @@
#include <windows.h> #include <windows.h>
#endif #endif
#if defined(_WRS_KERNEL)
#include <OsWrapper.h> #include <OsWrapper.h>
#endif
#define ADDRESS "tcp://m2m.eclipse.org:1883" #define ADDRESS "tcp://iot.eclipse.org:1883"
#define CLIENTID "ExampleClientPub" #define CLIENTID "ExampleClientPub"
#define TOPIC "MQTT Examples" #define TOPIC "MQTT Examples"
#define PAYLOAD "Hello World!" #define PAYLOAD "Hello World!"
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012, 2017 IBM Corp. * Copyright (c) 2012, 2018 IBM Corp.
* *
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
...@@ -25,7 +25,9 @@ ...@@ -25,7 +25,9 @@
#include <windows.h> #include <windows.h>
#endif #endif
#if defined(_WRS_KERNEL)
#include <OsWrapper.h> #include <OsWrapper.h>
#endif
#define ADDRESS "tcp://localhost:1883" #define ADDRESS "tcp://localhost:1883"
#define CLIENTID "ExampleClientSub" #define CLIENTID "ExampleClientSub"
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012, 2016 IBM Corp. * Copyright (c) 2012, 2018 IBM Corp.
* *
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
...@@ -53,7 +53,9 @@ ...@@ -53,7 +53,9 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if defined(_WRS_KERNEL)
#include <OsWrapper.h> #include <OsWrapper.h>
#endif
volatile int toStop = 0; volatile int toStop = 0;
...@@ -153,7 +155,7 @@ void myconnect(MQTTAsync* client) ...@@ -153,7 +155,7 @@ void myconnect(MQTTAsync* client)
conn_opts.onFailure = onConnectFailure; conn_opts.onFailure = onConnectFailure;
conn_opts.context = client; conn_opts.context = client;
ssl_opts.enableServerCertAuth = 0; 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; conn_opts.automaticReconnect = 1;
connected = 0; connected = 0;
if ((rc = MQTTAsync_connect(*client, &conn_opts)) != MQTTASYNC_SUCCESS) if ((rc = MQTTAsync_connect(*client, &conn_opts)) != MQTTASYNC_SUCCESS)
...@@ -195,7 +197,7 @@ void connectionLost(void* context, char* cause) ...@@ -195,7 +197,7 @@ void connectionLost(void* context, char* cause)
conn_opts.onFailure = onConnectFailure; conn_opts.onFailure = onConnectFailure;
conn_opts.context = client; conn_opts.context = client;
ssl_opts.enableServerCertAuth = 0; 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; connected = 0;
if ((rc = MQTTAsync_connect(client, &conn_opts)) != MQTTASYNC_SUCCESS) if ((rc = MQTTAsync_connect(client, &conn_opts)) != MQTTASYNC_SUCCESS)
{ {
......
/******************************************************************************* /*******************************************************************************
* Copyright (c) 2012, 2013 IBM Corp. * Copyright (c) 2012, 2018 IBM Corp.
* *
* All rights reserved. This program and the accompanying materials * All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0 * are made available under the terms of the Eclipse Public License v1.0
...@@ -56,7 +56,9 @@ ...@@ -56,7 +56,9 @@
#include <unistd.h> #include <unistd.h>
#endif #endif
#if defined(_WRS_KERNEL)
#include <OsWrapper.h> #include <OsWrapper.h>
#endif
volatile int finished = 0; volatile int finished = 0;
char* topic = NULL; char* topic = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment