Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
Content
NOTE : For sake of brevity I'll divide this blog in sub blogs and will link them where ever needed.
Configuring ThingWorx C SDK
Pre-requisite
Note : Above mentioned blog is done using ThingWorx Edge Microserver, however we are only interested in installation and configuration related to the VNC server. You don't need to configure the edge device for tunneling from the above mentioned blog as we will do this later in this blog for C SDK.
Installing, configuring and launching the C SDK based client on Linux platform
To begin with ensure that you have downloaded the ThingWorx C SDK from PTC Marketplace or PTC Software Download page. Let's configure the CSDK
1. Navigate to the C SDK root directory and create a directory e.g. /csdk/cmake
2. Change directory into cmake/
3. Check for the available compilers on the platform, with command cmake -G list
4. Choose as per your requirement, for our example here 'll pick "Unix Makefiles"
Note : I'm compiling on Ubuntu 16 OS
5. Execute following command from csdk/cmake/ , eg.
cmake -G "Unix Makefiles" ..
This will result in following compilation details :
6. Cmake folder now have some build files created
7. Configure the example SteamSensor for tunneling and for accepting self-signed certificate, as my ThingWorx is currently configured with HTTPS
8. Navigate to root directory and edit the main.c for SteamSensor, e.g.
sudo gedit main.c
Note: Feel free to use any editor of your choice, I'm using gedit
Add following to enable tunneling and accepting self-signed certificates
#define ENABLE_TUNNELING 1 void twApi_SetSelfSignedOK();
9. Save the file and close
10. Make the solution to create executable out of the example SteamSensor we edited
11. Navigate to the SteamSensor example under the cmake e.g.
12. Key in command make and press enter, e.g.
~/csdk/cmake/examples/SteamSensor$ make
This will build the solution and once finished it will put some new files and an executable file in the /csdk/cmake/examples/SteamSensor
Once the build is finished,
Great! now then, let's crack on with the SteamSensor executable.
13. To launch the executable it requires following syntax
./SteamSensor <hostname> <port> <appKey> <thingname> , e.g.
./SteamSensor tw802neo 443 11c784ab-dde7-400f-b244-fd7c4b217869 SteamSensor2
14. Once launched & if its successfully connected you can check the remote entity created in ThingWorx Composer, as we can see below entity as connected.
Notice that in below screenshot there are some sample properties that are being pushed from the C SDK based client. You may not have them at first
15. In case you see isConnected as true but no property listed for your Thing, edit the Thing and click on Manage Bindings
Click on Remote tab to see which properties are pushed, then you have the option to either click on Add All Above Properties on the right side, which will automatically create properties under the Thing, or you can drag and drop properties on the right to bind with if you are using properties with different name. Ensure that the data type matches with the remote properties.
Done and Save.
So far
Up Next