cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Need help navigating or using the PTC Community? Contact the community team. X

My remote thing is not getting connected, why?

sv
1-Visitor
1-Visitor

My remote thing is not getting connected, why?

Hi,

I have added a remote thing, It was working til the previous day.BUt now its showing "isconnected" as "false" after connecting also.

What might be the reason behind this?

13 REPLIES 13
agprasad
1-Visitor
(To:sv)

Check the code

vmihai
12-Amethyst
(To:sv)

Hi Supriya V,

Can you please post a screenshot of your Command Line output after running the jar file for temperature-thing-jar-with-dependencies along with the command for running it? 

Thank you,

Veronica

agprasad
1-Visitor
(To:vmihai)

Hi veronica,

is it possible to connect to more than one thing using same C SDK?

vmihai
12-Amethyst
(To:agprasad)

Hi Anup G Prasad,

Yes, it is possible, you just need to bind more than one Thing using this method :

  /* Bind our thing */

  twApi_BindThing(thingName);

You also need to separately register the properties you need for the Thing :

  /* Regsiter our properties */

   twApi_RegisterProperty(TW_THING, thingName, "Temperature", TW_NUMBER, NULL, "ALWAYS", 0, propertyHandler,NULL);

   twApi_RegisterProperty(TW_THING, thingName, "Humidity", TW_NUMBER, NULL, "ALWAYS", 0, propertyHandler,NULL);

Best regards,

Veronica

agprasad
1-Visitor
(To:vmihai)

Hi Veronica,

Am using the csdk and sample code given in it.so am executing the twc_agent file.can you tell me in which file i should make the above changes to connect to a new thing?

thanks

Anup

vmihai
12-Amethyst
(To:agprasad)

Hi Anup G Prasad,

For which device are you running the twc_agent file ? I am not very familiar with the projects posted on the developer community, but for Intel Galileo with C SDK for example I saw that there is a file named twc_agent_akp.c at  this path in the archieve ..\TWC_Agent_Galileo-Gen2\install\src where you can bind your thing  (in the ThingWorxTask method at line  471)

/* Bind our thing */
twApi_BindThing(progSets.tw_name);

I believe you should be able to create additional Things and bind them here in the same way as the current bound Thing. 

I hope this helps.

Best regards,

Veronica

agprasad
1-Visitor
(To:vmihai)

Hi Veronica,

I have tried the mentioned steps but when i run the code it shows:

Message 1 timed out

Already connected

Message 2 timed out

Already connected

Message 3 timed out

Already connected

vmihai
12-Amethyst
(To:agprasad)

Hi Anup can you copy and paste the class that you modified to have more than on thing connected? I will test it on my Intel Galileo.

Thank you,

Veronica

agprasad
1-Visitor
(To:vmihai)

// Standard includes

#include <stdlib.h>

#include <string.h>

#include <stdio.h>

#include <unistd.h>

#include "AKPMessage.h"

#include "SerialConnector.h"

#include "Settings.h"

#include "pinspectre.h"

#include "pinspectre_hwbase.h"

#include "twLinux.h"

#include "twLogger.h"

#include "twApi.h"

//*****************************************************************************

//                          MACROS

//*****************************************************************************

#define APPLICATION_NAME        "Remote asset Monitoring"

#define APPLICATION_VERSION     "1.0.0"

#define PING_HOST_NAME      "www.thingworx.com"

#define SERIAL_COLLECTION_RATE_MSEC 20000

#define UART_PRINT printf

#define PIN_ENABLE_PULLUP   1

#define PIN_DISABLE_PULLUP  0

#define PIN_LBL_ANALOG     "A"

#define PIN_LBL_DIGITAL     "D"

#define PIN_LBL_INPUT     "I"

#define PIN_LBL_OUTPUT     "O"

int parse_reportPinConfig(char *pin_lbl, char *configStr);

//*****************************************************************************

//                 STRUCTS -- Start

//*****************************************************************************

typedef struct

{

    int direction;

    int type;

    int value;

}pinConfig;

/*****************

A simple structure to handle properties

******************/

struct

{

char * hostName;

    char * PalletId;

    char * Perimeter; //Perimeter flag

    char * Theft;

    char * Content;

    struct twLocation Location;

} properties;

//*****************************************************************************

//                 GLOBAL VARIABLES -- Start

//*****************************************************************************

unsigned long g_ulStatus=0;

tw_settings progSets;

tw_settings progSets1;

propertyList *g_pinConf=NULL;

#if defined(gcc)

extern void (* const g_pfnVectors[])(void);

#endif

#if defined(ewarm)

extern uVectorEntry __vector_table;

#endif

//*****************************************************************************

//                 GLOBAL VARIABLES -- End

//*****************************************************************************

/*****************

Helper Functions

*****************/

/*****************************************************************************/

/*Function: writeProperty()                                                  */

/*                                                                           */

/*This function is called automatically whenever a value is set for a proper-*/

/*ty by the thingWorx Platform. It consists of a section of if else statement*/

/*s that further direct what happens, if anything, when a property is written*/

/*****************************************************************************/

enum msgCodeEnum writeProperty(const char * propertyName, twInfoTable * value) {

if (!propertyName || !value) return TWX_BAD_REQUEST;

   printf("Got VALUE FROM DI: %s\n", propertyName);

   if(strstr(propertyName, "Config")!=NULL) {

    char *pinCmd;   

    twInfoTable_GetString(value, propertyName,0, &pinCmd);

   

  //  Store pinConfig text in the JSON and set the pin

    printf("SETTING VALUE FROM DI: %s\n", propertyName);

    setPinFromConfStr((char *)propertyName, pinCmd);

     }

   else if(strstr(propertyName, "GPIO")!=NULL)  {

     double int_val=-1;

     twInfoTable_GetNumber(value, propertyName, 0, &int_val);

     setValueFromPinName((char *)propertyName, (int)int_val);

   }

return TWX_SUCCESS;

}

/*****************************************************************************/

/*Function: sendPropertyUpdate()                                             */

/*                                                                           */

/*This function reads the values from the local struct "properties" and adds */

/*them to a list of properties that it will send up to the ThingWorx platform*/

/*When it is done adding the values it will send the data.                   */

/*****************************************************************************/

void sendPropertyUpdate(propertyList *inputProplist) {

    propertyList *proplist=NULL;

printf("creating property list....%p", inputProplist);

    if (!inputProplist) {

proplist = twApi_CreatePropertyList("Hostname",twPrimitive_CreateFromString(properties.hostName, 1), 0);

}

else {

     proplist=inputProplist;

     twApi_AddPropertyToList(proplist, "HostName", twPrimitive_CreateFromString(properties.hostName, 1), 0);

     }

printf("Added Hostname...%p\n", properties.hostName);

go_data(proplist, progSets.sim_mode);

twApi_AddPropertyToList(proplist,"PalletId",twPrimitive_CreateFromString(properties.PalletId, 1), 0);

twApi_AddPropertyToList(proplist,"Perimeter",twPrimitive_CreateFromString(properties.Perimeter, 1), 0);

twApi_AddPropertyToList(proplist,"Theft",twPrimitive_CreateFromString(properties.Theft, 1), 0);

twApi_AddPropertyToList(proplist,"Content",twPrimitive_CreateFromString(properties.Content, 1), 0);

twApi_AddPropertyToList(proplist,"Location",twPrimitive_CreateFromLocation(&properties.Location), 0);

//printf("Added Pallet ID ..%p\n", properties.PalletId);

//printf("Added Flag ..%p\n", properties.Flag);

//printf("Staring Board Specific properties...%p\n", proplist);

//getTWPropertyUpdates(proplist); //send up board specific properties with current readings@

//getTWPinConfigs(proplist);

twApi_PushProperties(TW_THING, progSets.tw_name, proplist, -1, FALSE);

twApi_DeletePropertyList(proplist);

}

void sendPropertyUpdate1(propertyList *inputProplist1) {

    propertyList *proplist1=NULL;

printf("creating property list....%p", inputProplist1);

    if (!inputProplist1) {

proplist1 = twApi_CreatePropertyList("Hostname",twPrimitive_CreateFromString(properties.hostName, 1), 0);

}

else {

     proplist1=inputProplist1;

     twApi_AddPropertyToList(proplist1, "HostName", twPrimitive_CreateFromString(properties.hostName, 1), 0);

     }

printf("Added Hostname...%p\n", properties.hostName);

go_data(proplist1, progSets1.sim_mode);

twApi_AddPropertyToList(proplist1,"PalletId",twPrimitive_CreateFromString(properties.PalletId, 1), 0);

//printf("Added Pallet ID ..%p\n", properties.PalletId);

//printf("Added Flag ..%p\n", properties.Flag);

//printf("Staring Board Specific properties...%p\n", proplist);

//getTWPropertyUpdates(proplist); //send up board specific properties with current readings

//getTWPinConfigs(proplist);

twApi_PushProperties(TW_THING, progSets1.tw_name, proplist1, -1, FALSE);

twApi_DeletePropertyList(proplist1);

}

void resetTask(DATETIME now, void * params) {

TW_LOG(TW_FORCE,"shutdownTask - Shutdown service called.  SYSTEM IS SHUTTING DOWN");

twApi_UnbindThing(progSets.tw_name);

twApi_UnbindThing(progSets1.tw_name);

twSleepMsec(100);

twApi_Delete();

twLogger_Delete();

}

/*****************************************************************************/

/*Function: dispatch_AKP_Message()                                           */

/*                                                                           */

/*This function takes AKP messages that have been recieved from the serial   */

/*bus and routes them accordingly. AKP is a short haul serial protocol for   */

/*connecting two devices together and exchanging data items.                 */

/*****************************************************************************/

//Handles translating AKP messages and storing values into the global data struct.

void dispatch_AKPMessage(AKPMessage *msg){

switch(msg->msgType){

case DATA_ANALOG:

/* if(strcmp(msg->name, "LA")==0){

properties.LevelA=atoi(msg->value);

} */

break;

case DATA_STRING:

/*if(strcmp(msg->name, "S1")==0){

properties.Situation1LED=msg->value[0];

}

else if(strcmp(msg->name, "S2")==0){

properties.Situation2LED=msg->value[0];

}*/

break;

case DATA_BOOLEAN:

//For future expansion....

break;

case ALARM:

//For future expansion....

break;

case EVENT:

//For future expansion....

break;

case ERRORS:

break;

case COMMANDS:

break;

case SYSREGS:

break;

}

}

/***************

Serial Read Task

****************/

/*

This function gets called at the rate defined in the task creation

This task takes care of parsed messages and takes action on them.

*/

void SerialReadTask( DATETIME now, void * params )

{

/* get next AKP message*/

}

/*****************

Property Handler Callbacks

******************/

enum msgCodeEnum propertyHandler(const char * entityName, const char * propertyName,  twInfoTable ** value, char isWrite, void * userdata) {

char * asterisk = "*";

if (!propertyName) propertyName = asterisk;

printf("propertyHandler - Function called for Entity %s, Property %s\r\n", entityName, propertyName);

TW_LOG(TW_TRACE,"propertyHandler - Function called for Entity %s, Property %s", entityName, propertyName);

if (value) {

if (isWrite && *value) {

/* Property Writes */

/* All are writable */

return writeProperty(propertyName, *value);

} else {

/* Property Reads */

if (strcmp(propertyName, "Name") == 0) *value = twInfoTable_CreateFromString(propertyName, properties.hostName, TRUE);

            else if (strcmp(propertyName, "PalletId") == 0) *value = twInfoTable_CreateFromString(propertyName, properties.PalletId, TRUE);

else if (strcmp(propertyName, "Perimeter") == 0) *value = twInfoTable_CreateFromString(propertyName, properties.Perimeter, TRUE);

else if (strcmp(propertyName, "Theft") == 0) *value = twInfoTable_CreateFromString(propertyName, properties.Theft, TRUE);

else if (strcmp(propertyName, "Content") == 0) *value = twInfoTable_CreateFromString(propertyName, properties.Content, TRUE);

else if (strcmp(propertyName, "Location") == 0) *value = twInfoTable_CreateFromLocation(propertyName, &properties.Location);

else return TWX_NOT_FOUND;

}

return TWX_SUCCESS;

} else {

TW_LOG(TW_ERROR,"propertyHandler - NULL pointer for value");

return TWX_BAD_REQUEST;

}

}

/*****************

Service Callbacks

******************/

/* Example of handling a single service in a callback */

enum msgCodeEnum addNumbersService(const char * entityName, const char * serviceName, twInfoTable * params, twInfoTable ** content, void * userdata) {

double a, b, res;

UART_PRINT("addNumbersService - Function called\r\n");

TW_LOG(TW_TRACE,"addNumbersService - Function called");

if (!params || !content) {

TW_LOG(TW_ERROR,"addNumbersService - NULL params or content pointer");

return TWX_BAD_REQUEST;

}

twInfoTable_GetNumber(params, "a", 0, &a);

twInfoTable_GetNumber(params, "b", 0, &b);

res = a + b;

*content = twInfoTable_CreateFromNumber("result", res);

if (*content) return TWX_SUCCESS;

else return TWX_INTERNAL_SERVER_ERROR;

}

/* Example of handling multiple services in a callback */

enum msgCodeEnum multiServiceHandler(const char * entityName, const char * serviceName, twInfoTable * params, twInfoTable ** content, void * userdata) {

TW_LOG(TW_TRACE,"multiServiceHandler - Function called");

if (!content) {

TW_LOG(TW_ERROR,"multiServiceHandler - NULL content pointer");

return TWX_BAD_REQUEST;

}

if (strcmp(entityName, progSets.tw_name) == 0) {

if (strcmp(serviceName, "Reset") == 0) {

/* Create a task to handle the shutdown so we can respond gracefully */

twApi_CreateTask(1, resetTask);

}

return TWX_NOT_FOUND;

}

return TWX_NOT_FOUND;

}

enum msgCodeEnum blinkPin(const char * entityName, const char * serviceName, twInfoTable * params, twInfoTable ** content, void * userdata) {

char *pinName=NULL;

//double pinNumber;

double blinkct=0;

int pin_id=-1;

pid_t child_pid=0;

         TW_LOG(TW_TRACE,"BlinkPinService - Function called");

         if (!params || !content) {

                 TW_LOG(TW_ERROR,"BlinkPinService - NULL params or content pointer");

                 return TWX_BAD_REQUEST;

         }

         twInfoTable_GetString(params, "pinName", 0, &pinName);

         twInfoTable_GetNumber(params, "numberOfBlinks", 0, &blinkct);

pin_id=name2Pin_Id(pinName);

if(pin_id>0) {

child_pid=fork();

if(child_pid!=0) {

printf("Spawned new process for blinks: %d\n", child_pid);

*content = twInfoTable_CreateFromNumber("result", blinkct);

return TWX_SUCCESS;

}

else {

 

for(blinkct=blinkct; blinkct>0; blinkct--){

pin_writeValue(pin_id, PIN_HIGH);

sleep(1);

pin_writeValue(pin_id, PIN_LOW);

sleep(1);

printf("blink ct: %f\n", blinkct);

}

printf("Quitting Child process\n");

exit(0);

  }

}

else {

TW_LOG(TW_ERROR,"BlinkPinService - %s is not a known pin", pinName);

}

         *content = twInfoTable_CreateFromNumber("result", blinkct);

        return TWX_SUCCESS;

       

}

/***************

Data Collection Task

****************/

/*

This function gets called at the rate defined in the task creation.  The SDK has

a simple cooperative multitasker, so the function cannot infinitely loop.

Use of a task like this is optional and not required in a multithreaded

environment where this functonality could be provided in a separate thread.

*/

#define DATA_COLLECTION_RATE_MSEC 2000

void dataCollectionTask(DATETIME now, void * params) {

   

sendPropertyUpdate(NULL);

sendPropertyUpdate1(NULL);

    if(AKPMessagesWaiting()>0){

        AKPMessage *temp=getNextAKPMessage();

        while( temp!=NULL) {

            //Map AKP Type to TW types

            int tw_type=0;

            if(temp->msgType==DATA_STRING) { tw_type = TW_STRING; }

            else if(temp->msgType==DATA_ANALOG) { tw_type = TW_NUMBER; }

            else if(temp->msgType==DATA_BOOLEAN) { tw_type = TW_BOOLEAN; }

            //Register the property we recieved

            twApi_RegisterProperty(TW_THING, progSets.tw_name, temp->name, tw_type, NULL, "ALWAYS", 0, propertyHandler, NULL);

            propertyList * proplist;

           

            twApi_RegisterProperty(TW_THING, progSets1.tw_name, temp->name, tw_type, NULL, "ALWAYS", 0, propertyHandler, NULL);

            propertyList * proplist1;

           

            //Send the data we just got

            switch(tw_type){

                case TW_STRING:

                    proplist= twApi_CreatePropertyList(temp->name,twPrimitive_CreateFromString(temp->value, 1), 0);

                    proplist1= twApi_CreatePropertyList(temp->name,twPrimitive_CreateFromString(temp->value, 1), 0);

                    break;

                case TW_NUMBER:

                    proplist= twApi_CreatePropertyList(temp->name,twPrimitive_CreateFromNumber(atoi(temp->value)), 0);

proplist1= twApi_CreatePropertyList(temp->name,twPrimitive_CreateFromNumber(atoi(temp->value)), 0);

                    break;

                case TW_BOOLEAN:

                    proplist= twApi_CreatePropertyList(temp->name,twPrimitive_CreateFromBoolean(atoi(temp->value)), 0);

proplist1= twApi_CreatePropertyList(temp->name,twPrimitive_CreateFromBoolean(atoi(temp->value)), 0);

                    break;

                }

               

            /*For now we only send data that's been put into our properties structure*/

            sendPropertyUpdate(proplist);

            sendPropertyUpdate1(proplist1);

            //Grab the next waiting message

            temp=getNextAKPMessage();

        }       

    }

   

   

}

/***************

Slow Data Collection Task

****************/

/*

This function is used to collect data that won't change as often.

This function gets called at the rate defined in the task creation.  The SDK has

a simple cooperative multitasker, so the function cannot infinitely loop.

Use of a task like this is optional and not required in a multithreaded

environment where this functonality could be provided in a separate thread.

*/

/*#define SLOW_DATA_COLLECTION_RATE_MSEC 20000000 //~every 5 hours or so

void slowDataCollectionTask(DATETIME now, void * params) {

   

    //TODO: update with system calls to get info.

    properties.hostName="test";

    properties.Device_id="0.0.0.0";

    }

*/

void ThingWorxTask() {

/************************************/

/************************************/

/*

*  ThingWorx Example Application

*  Copyright (C) 2014 ThingWorx Inc.

*

*  Test application

*/

// int16_t port = progSets.tw_port;

int prog_err=0;

int prog_err1=0;

twDataShape * ds = 0;

if(progSets.debug_log==1)

{

twLogger_SetLevel(TW_TRACE);

twLogger_SetIsVerbose(1);

}

TW_LOG(TW_FORCE, "Starting up");

    /* Wait until we have an Internet connection */

    twSleepMsec(5);

/* Initialize the API */

//prog_err = twApi_Initialize(TW_HOST_NAME, port, TW_URI, APP_KEY, NULL, MESSAGE_CHUNK_SIZE, MESSAGE_CHUNK_SIZE, TRUE);

prog_err = twApi_Initialize(progSets.tw_host, (int16_t)progSets.tw_port, TW_URI, progSets.tw_appKey, NULL, MESSAGE_CHUNK_SIZE, MESSAGE_CHUNK_SIZE, TRUE);

prog_err1 = twApi_Initialize(progSets1.tw_host, (int16_t)progSets1.tw_port, TW_URI, progSets1.tw_appKey, NULL, MESSAGE_CHUNK_SIZE, MESSAGE_CHUNK_SIZE, TRUE);

if (prog_err!=0) {

TW_LOG(TW_ERROR, "Error initializing the API");

exit(prog_err);

}

/* Allow self signed certs */

twApi_SetSelfSignedOk();

/* Register Connection Events */

    /* These events are not necessary when running in a full OS*/

//twApi_RegisterConnectCallback(OnConnectEvent);

//twApi_RegisterCloseCallback(OnDisconnectEvent);

/* Register our sample services */

//ds = twDataShape_Create(twDataShapeEntry_Create("a",NULL,TW_NUMBER));

//twDataShape_AddEntry(ds, twDataShapeEntry_Create("b",NULL,TW_NUMBER));

//twApi_RegisterService(TW_THING, progSets.tw_name, "AddNumbers", NULL, ds, TW_NUMBER, NULL, addNumbersService, NULL);

//twApi_RegisterService(TW_THING, progSets.tw_name, "Reset", NULL, NULL, TW_NOTHING, NULL, multiServiceHandler, NULL);

//twDataShape *blink_pin_ds=twDataShape_Create(twDataShapeEntry_Create("pinName","The Pin to Blink",TW_NUMBER));

//twDataShape_AddEntry(blink_pin_ds, twDataShapeEntry_Create("numberOfBlinks","The number of times to Blink",TW_NUMBER));

//twApi_RegisterService(TW_THING, progSets.tw_name, "BlinkPin", "Blinks pin(pinNumber) a number of times(blinks)", blink_pin_ds, TW_NOTHING, NULL, blinkPin, NULL);

/* Regsiter our properties */

twApi_RegisterProperty(TW_THING, progSets.tw_name, "PalletId", TW_STRING, NULL, "ALWAYS", 0, propertyHandler, NULL);

twApi_RegisterProperty(TW_THING, progSets.tw_name, "Perimeter", TW_STRING, NULL, "ALWAYS", 0, propertyHandler, NULL);

twApi_RegisterProperty(TW_THING, progSets.tw_name, "Theft", TW_STRING, NULL, "ALWAYS", 0, propertyHandler, NULL);

twApi_RegisterProperty(TW_THING, progSets.tw_name, "Content", TW_STRING, NULL, "ALWAYS", 0, propertyHandler, NULL);

//twApi_RegisterProperty(TW_THING, progSets.tw_name, "Name", TW_STRING, NULL, "ALWAYS", 0, propertyHandler, NULL);

twApi_RegisterProperty(TW_THING, progSets.tw_name, "Location", TW_LOCATION, NULL, "ALWAYS", 0, propertyHandler, NULL);

//GPIO properties

//twApi_RegisterProperty(TW_THING, progSets.tw_name, "Error", TW_STRING, NULL, "ALWAYS", 0, propertyHandler, NULL);

twApi_RegisterProperty(TW_THING, progSets.tw_name, "Temperature", TW_NUMBER, NULL, "ALWAYS", 0, propertyHandler, NULL);

twApi_RegisterProperty(TW_THING, progSets.tw_name, "Humidity", TW_NUMBER, NULL, "ALWAYS", 0, propertyHandler, NULL);

//twApi_RegisterProperty(TW_THING, progSets.tw_name, "In_use", TW_BOOLEAN, NULL, "ALWAYS", 0, propertyHandler, NULL);

//twApi_RegisterProperty(TW_THING, progSets.tw_name, "flag", TW_BOOLEAN, NULL, "ALWAYS", 0, propertyHandler, NULL);

twApi_RegisterProperty(TW_THING, progSets.tw_name, "Power_consumption", TW_NUMBER, NULL, "ALWAYS", 0, propertyHandler, NULL);

//registerLocalPinProperties(progSets.tw_name, propertyHandler);

twApi_RegisterProperty(TW_THING, progSets1.tw_name, "PalletId", TW_STRING, NULL, "ALWAYS", 0, propertyHandler, NULL);

/* Bind our thing */

twApi_BindThing(progSets.tw_name);

twApi_BindThing(progSets1.tw_name);

//twApi_CreateTask(SERIAL_COLLECTION_RATE_MSEC, SerialReadTask);

/* Connect to server */

if (!twApi_Connect(CONNECT_TIMEOUT, -1)) {

/* Register our "Data collection Task" with the tasker */

printf("Starting data Collection Task...\n");

twApi_CreateTask(DATA_COLLECTION_RATE_MSEC, dataCollectionTask);

/* Register our "Serial Task" with the tasker */

//twApi_CreateTask(DATA_COLLECTION_RATE_MSEC, serialParseTask);

       

} else {

printf("ERROR Establishing websocket to %s:%d\r\n", progSets.tw_host, progSets.tw_port);

}

while(1) {

twSleepMsec(5);

}

printf("Tearing Down Process....\n");

twApi_UnbindThing(progSets.tw_name);

twApi_UnbindThing(progSets1.tw_name);

twSleepMsec(100);

twApi_Delete();

twLogger_Delete();

exit(0);

}

//*****************************************************************************

//                            MAIN FUNCTION

//*****************************************************************************

int main()

{

    //initBoardPins();

    loadSettingsFile("agent.properties", &progSets);

    loadSettingsFile("agent.properties1", &progSets1);

//readPinConf(progSets.pin_config);

//printf("Thing Name: %s\n", progSets.tw_name);

//printf("Thing Server: %s:%d\n", progSets.tw_host, progSets.tw_port);

//printf("Thing AppKey: %s\n", progSets.tw_appKey);

//printf("Scan Rate: %d\n", progSets.scanRate);

   //Start the serial port for the serial data injector

   //printf("Opening serial port %s...", progSets.serialPort);

   //int ser_res=startSerial(progSets.serialPort, 115200, 8, 0, 1);

   //if(ser_res>0) { printf("Success!\n"); }

   //else { printf("Error :-(\n"); perror("Serial Error:"); }

/* Initialize Properties */

properties.hostName="RaspberryPi";

    properties.PalletId="IN0001W0001P0001";

    properties.Perimeter="FALSE";

    properties.Theft="No";

properties.Content="HDD";

properties.Location.longitude = 76.948623;

properties.Location.latitude = 8.4874949;

  //start the Thingworx task that will send the data

   ThingWorxTask();

  return 0;

  }

Aanjan
12-Amethyst
(To:sv)

Are you connecting via an EMS or SDK?

agprasad
1-Visitor
(To:Aanjan)

@Ravi am connecting via c sdk

ciprianote
1-Visitor
(To:sv)

Hello Anup,

Can you please share with me the structures of progSets and progSets1?

Thank you,

Ciprian

Hi Ciprian,

progSet

tw_host=ge2-3611.cloud.thingworx.com

tw_port=80

AppKey=118e56a5-a714-432f-a4d2-5fb770d04824

ScanRate=2000

Name=RaspberryPi_C_11364156447720966

ComPortId=/dev/ttyAMA0

SimMode=true

PinConfig=pinConfig_rPi.json

Debug=false

progset1

tw_host=ge2-3611.cloud.thingworx.com

tw_port=80

AppKey=118e56a5-a714-432f-a4d2-5fb770d04824

ScanRate=2000

Name=Am2302

ComPortId=/dev/ttyAMA0

SimMode=true

PinConfig=pinConfig_rPi.json

Debug=false

Announcements


Top Tags