12 Replies Latest reply on Dec 14, 2015 10:35 AM by mr RSS
    mr Explorer

    Error with Raspberry Pi

    I am getting the upgrade error with the twc_agent executable when I try to run in Raspberry Pi. Has some one fixed it and be able to run it, any suggestions/help?

      • Re: Error with Raspberry Pi
        pcheah Explorer

        Hi Maniappan,

        It is good if you can show us the error messages in your Rasp Pi.

          • Re: Error with Raspberry Pi
            mr Explorer

            Here is the log I get on running twc_agent :

             

            [ERROR] 2015-11-29 17:48:09,813: ws_on_header_value: Invalid 'connection' header: Upgrade

            [ERROR] 2015-11-29 17:48:09,814: ws_on_headers_complete: Websocket connection failed

            [ERROR] 2015-11-29 17:48:09,815: twWs_Connect: Error trying to connect

             

            This is coming periodically when it tries to connect.

            • Re: Error with Raspberry Pi
              mr Explorer

              Some additional details apart from the log that I have posted previously, Pi is connected via Wifi to the modem that connects to my fiber provider via a router.

            • Re: Error with Raspberry Pi
              pcheah Explorer

              It seems like the Thingworx server is not connected. Have you modified the main.c file to change the Host name and Appkey? The file is located at home/pi/tw-c-sdk/examples/SteamSensor/src.

                • Re: Error with Raspberry Pi
                  mr Explorer

                  Hi Peng,

                  Thanks for the reply. The documentation here at Raspberry Pi with ThingWorx C SDK | ThingWorx didn't ask me to change anything, so ran as is. If these steps are not proper do let me know proper one.

                    • Re: Error with Raspberry Pi
                      pcheah Explorer

                      Hi Maniappan,

                      There is only one additional step to be made before Building the SDK, that is to modify the Main.c.

                        • Re: Error with Raspberry Pi
                          mr Explorer

                          Hi,

                          There is no configuration that I am able to do in main.c. The configuration was found in agent.properties file that is loaded when twc_agent is run. I have changed the Appkey and started it, host is pointing to the the device.cloud.thingworx.com site. I enabled DEBUG and I am getting this after the GPIO are registered. Please let know if there is some other issue here!

                           

                          Maniappan.

                           

                          [DEBUG] 2015-12-06 14:01:35,608: twTlsClient_Reconnect: Re-establishing SSL context

                          [DEBUG] 2015-12-06 14:01:35,829: twTlsClient_Connect: Connecting to server

                          [DEBUG] 2015-12-06 14:01:35,833: twTlsClient_Connect: TLS connection established

                          [TRACE] 2015-12-06 14:01:35,834: twWs_Connect: Connected to device.cloud.thingworx.com:80

                          [TRACE] 2015-12-06 14:01:35,834: twWs_Connect: Sent request:

                          GET /Thingworx/WS HTTP/1.1

                          User-Agent: ThingWorx C SDK

                          Upgrade: websocket

                          Connection: Upgrade

                          Host: device.cloud.thingworx.com

                          Sec-WebSocket-Version: 13

                          Sec-WebSocket-Key: YDbFo5YONb2bWzgAXk0+gA==

                          Max-Frame-Size: 8192

                          applicationKey: a7fdd7ab-d3ce-4313-ab93-6226ed9b7ef4

                           

                          [DEBUG] 2015-12-06 14:01:36,392: HTTP Response begun

                          [TRACE] 2015-12-06 14:01:36,392: Header->server : Apache-Coyote/1.1

                          [TRACE] 2015-12-06 14:01:36,393: Header->sec-websocket-accept : j0V2dHwjmWVeJCikwBpXtBLXG4U=

                          [TRACE] 2015-12-06 14:01:36,393: Header->date : Sun, 06 Dec 2015 08:31:36 GMT

                          [TRACE] 2015-12-06 14:01:36,393: Header->connection : Upgrade

                          [ERROR] 2015-12-06 14:01:36,393: ws_on_header_value: Invalid 'connection' header: Upgrade

                          [TRACE] 2015-12-06 14:01:36,393: Header->upgrade : websocket

                          [ERROR] 2015-12-06 14:01:36,393: ws_on_headers_complete: Websocket connection failed

                          [TRACE] 2015-12-06 14:01:36,393: twWs_Connect: Parsed 193 bytes out of 193

                          [ERROR] 2015-12-06 14:01:36,393: twWs_Connect: Error trying to connect

                          [DEBUG] 2015-12-06 14:01:36,393: twTlsClient_Reconnect: Re-establishing SSL context

                          [DEBUG] 2015-12-06 14:01:36,610: twTlsClient_Connect: Connecting to server

                          [DEBUG] 2015-12-06 14:01:36,613: twTlsClient_Connect: TLS connection established

                          [DEBUG] 2015-12-06 14:01:41,614: twTlsClient_Reconnect: Re-establishing SSL context

                          [DEBUG] 2015-12-06 14:01:41,835: twTlsClient_Connect: Connecting to server

                          [DEBUG] 2015-12-06 14:01:41,840: twTlsClient_Connect: TLS connection established

                          [TRACE] 2015-12-06 14:01:41,841: twWs_Connect: Connected to device.cloud.thingworx.com:80

                          [TRACE] 2015-12-06 14:01:41,841: twWs_Connect: Sent request:

                          GET /Thingworx/WS HTTP/1.1

                          User-Agent: ThingWorx C SDK

                          Upgrade: websocket

                          Connection: Upgrade

                          Host: device.cloud.thingworx.com

                          Sec-WebSocket-Version: 13

                          Sec-WebSocket-Key: S7iOiIovHM0yx7USJvAm1w==

                          Max-Frame-Size: 8192

                          applicationKey: a7fdd7ab-d3ce-4313-ab93-6226ed9b7ef4

                           

                          [DEBUG] 2015-12-06 14:01:42,367: HTTP Response begun

                          [TRACE] 2015-12-06 14:01:42,367: Header->server : Apache-Coyote/1.1

                          [TRACE] 2015-12-06 14:01:42,367: Header->sec-websocket-accept : 6QHmcIelri4vVUUMWNlv0fLhgB0=

                          [TRACE] 2015-12-06 14:01:42,367: Header->date : Sun, 06 Dec 2015 08:31:42 GMT

                          [TRACE] 2015-12-06 14:01:42,367: Header->connection : Upgrade

                          [ERROR] 2015-12-06 14:01:42,367: ws_on_header_value: Invalid 'connection' header: Upgrade

                          [TRACE] 2015-12-06 14:01:42,368: Header->upgrade : websocket

                          [ERROR] 2015-12-06 14:01:42,368: ws_on_headers_complete: Websocket connection failed

                          [TRACE] 2015-12-06 14:01:42,368: twWs_Connect: Parsed 193 bytes out of 193

                          [ERROR] 2015-12-06 14:01:42,368: twWs_Connect: Error trying to connect

                          [DEBUG] 2015-12-06 14:01:42,368: twTlsClient_Reconnect: Re-establishing SSL context

                          [DEBUG] 2015-12-06 14:01:42,592: twTlsClient_Connect: Connecting to server

                          [DEBUG] 2015-12-06 14:01:42,602: twTlsClient_Connect: TLS connection established

                          [DEBUG] 2015-12-06 14:01:47,603: twTlsClient_Reconnect: Re-establishing SSL context

                          [DEBUG] 2015-12-06 14:01:47,834: twTlsClient_Connect: Connecting to server

                          [DEBUG] 2015-12-06 14:01:47,837: twTlsClient_Connect: TLS connection established

                    • Re: Error with Raspberry Pi
                      meghan Communicator

                      Maniappan, Alternatively, if you are not trying to connect over SSL you are going to want to include the following function call before the connection is made in the main function in main.c: twApi_DisableEncryption();

                        • Re: Error with Raspberry Pi
                          mr Explorer

                          Thanks to all who replied, I got it up and running yesterday. There were couple of issues, my provider is having reverse proxy, had to try with someone else. While playing around with configuration I had modified the original key and resetting back it worked.

                          Now to get to do some actual data generation..