Want to add device in Exosite portal


#1

Hi Friends,

Currently I am using TI Exosite for IOT application.Now I want to add device in Exosite only not in TI Exosite for cc3200 launchpad. I was trying to connect my device in exosite, I added mac address also but it was showing device already registred .

My question is may I connect same device which is already connected in TI Exosite in Exosite only.

regards,
Arvind


#2

Hi Arvind,

Thanks for posting; This happens to be a question that we get periodically and are happy to help you get started in the right direction.

I am assuming that you are trying to connect your CC3200 to portals.exosite.com, and I suspect that you still have the device registered in the Ti solution. As we shared the CC3200 client model to our generic evaluation application, it is using the same provisioning system whitelist. This means that you will have to de-register(delete) the device from your account on ti.exosite.com before you can add it to any other eligible solution.

Let us know if you have success in adding your device once you’ve cleared it for registration again.

Best,
-Martin


#3

Hi Martin,

Thank you for your reply, I will add different device to exosite portlal .I want to know, Is it possible to upload any file like image or video to this portal from cc3200 launchpad using Exosite API.

regards,
Arvind


#4

You sure could base64 encode your image and store this in a dataport. You could then use a custom widget to display your image inside your dashboard on Portals.

For video, we recommend making use of a dedicated video streaming service.

You can find a few more details, and a link to some reference code in displaying a base64 encoded image in Portals, in this article within our help-center: https://support.exosite.com/hc/en-us/articles/201882754-Can-Exosite-handle-images-videos-streams-


#5

Thank you Martin I will work on it, Thank you for reply…


#6

Hi Martin,

Currently I am trying to upload image file from CC3200-launchpad to https://ti.exosite.com/ portal.The image file size is 34KB and I am sending content of file in chunks of 1KB , but I could not be able to upload image file to my portal.

Here is my Exosite_task code:

      //****************************************************************************
      //
      //!    \brief Exosite Application Main Task - Initializes SimpleLink Driver
      //!                                           and Handles HTTP Requests
      //! \param[in]                  pvParameters is the data passed to the Task
      //!
      //! \return                        None
      //
      //****************************************************************************
    static void ExositeTask(void *pvParameters)
    {
       long   ret = -1;
       unsigned long long retry_delay = 100;
       unsigned long long counter = 0;
       char buf[] = "img=123";
       //    uint16_t retLen;
       long lRetVal = 0;
       //    unsigned char *buffer;
       long lFileHandle;
       size_t output_length;
       SlFsFileInfo_t FsFileInfo;
       unsigned long ulToken;
       unsigned char filebuffer[1024];
       long iLoopCnt;
       char *lobi;

       EXO_STATE state = EXO_STATE_NOT_COMPLETE;

       //Read Device Mode Configuration
       ReadDeviceConfiguration();

       //Connect to Network
       ret = ConnectToNetwork();
       if(ret < 0)
       {
           ERR_PRINT(ret);
           LOOP_FOREVER();
       }

       // Wait here if we're in AP Mode
       while(g_uiDeviceModeConfig != ROLE_STA)
       {
          osi_Sleep(1000);
       }

       //Handle Async Events
      //    while(1)
      //    {
	  //TODO: Wrap all Exosite calls in a check to see if we're connected.
      while(state != EXO_STATE_INIT_COMPLETE)
        {
		UART_PRINT("[EXO] Exosite Init\r\n");
		state = exosite_init("texasinstruments","cc3200lp_v1");
		if(state == EXO_STATE_INIT_COMPLETE){
			UART_PRINT("[EXO] Activated, Ready to Go\r\n");
		}else if(state == EXO_STATE_INIT_ERROR){
		UART_PRINT("[EXO] Error Activating on Exosite (Add to Account or Re-enable for                                Activation)\r\n");
		retry_delay *= 2;
	        osi_Sleep(retry_delay);
		}else if(state == EXO_STATE_CONNECTION_ERROR){
			UART_PRINT("[EXO] Error Connecting to Exosite, Check Your Connection\r\n");
			//retry_delay *= 2;
	        osi_Sleep(retry_delay);
		}else if(state == EXO_STATE_NO_RESPONSE){
			UART_PRINT("[EXO] We connected, but timed-out waiting for a response. Try again.\r\n");
			retry_delay *= 2;
	        osi_Sleep(retry_delay);
		}else if(state == EXO_STATE_DEVICE_NOT_ENABLED){
			UART_PRINT("[EXO] Couldn't Activate on Exosite (Add to Account or Re-enable for Activation)\r\n");
			retry_delay *= 2;
	        osi_Sleep(retry_delay);
		}else if(state == EXO_STATE_R_W_ERROR){
			UART_PRINT("[EXO] Read/Write Error\r\n");
			retry_delay *= 2;
	        osi_Sleep(retry_delay);
		}else{
			UART_PRINT("[EXO] Unknown State in Init");
			return;
		}
    }


    UART_PRINT("[EXO] Writing Values...");

    /**********************************************************************************************
    * Read Image file data present in serial flash and send this
    * data to Exosite cloud
    **********************************************************************************************/

    //get the file information
    lRetVal = sl_FsGetInfo("www/images/img.jpg",0,&FsFileInfo);

    //open file
    lRetVal = sl_FsOpen("www/images/img.jpg",FS_MODE_OPEN_READ,&ulToken,&lFileHandle);
    if(lRetVal<0)
    {
	  UART_PRINT("unable to open file\n\r");
    }

    //Allocate memory
    //        buffer = malloc(FsFileInfo.FileLen+1);

    ret = exosite_write(buf,strlen(buf));
	if(ret == 0){
		UART_PRINT("OK\r\n");
		retry_delay = 1000;
	}else{
		UART_PRINT("ERROR\r\n");
		retry_delay *= 2;
		state = EXO_STATE_NOT_COMPLETE;
		ERR_PRINT(ret);
	}

 /////////////////////////////// Temp

    /*
     *   Sending containt of file in packet
     */
	 for(iLoopCnt=0;iLoopCnt<(FsFileInfo.FileLen/sizeof(filebuffer));iLoopCnt++)
	  {
		 lRetVal=sl_FsRead(lFileHandle,(unsigned int)(iLoopCnt*sizeof(filebuffer)),filebuffer,sizeof(filebuffer));
		 if(lRetVal<0)
		  {
			UART_PRINT("unable to read file\n\r");
		  }

		 lobi = base64_encode(filebuffer, sizeof(filebuffer), &output_length);

		ret = exosite_write(lobi,output_length);
		if(ret == 0){
			UART_PRINT("OK\r\n");
			retry_delay = 1000;
		}else{
			UART_PRINT("ERROR\r\n");
			retry_delay *= 2;
			state = EXO_STATE_NOT_COMPLETE;
			ERR_PRINT(ret);
		}

	 }

	 lRetVal=sl_FsRead(lFileHandle,(unsigned int)(iLoopCnt*sizeof(filebuffer)),filebuffer,sizeof(filebuffer));
	 if(lRetVal<0)
	  {
		 UART_PRINT("unable to read file\n\r");
	  }

	 lobi = base64_encode(filebuffer, sizeof(filebuffer), &output_length);

	ret = exosite_write(lobi,output_length);
	if(ret == 0){
		UART_PRINT("OK\r\n");
		retry_delay = 1000;
	}else{
		UART_PRINT("ERROR\r\n");
		retry_delay *= 2;
		state = EXO_STATE_NOT_COMPLETE;
		ERR_PRINT(ret);
	}

///////////////////////////////////////Temp End

  /*        lRetVal=sl_FsRead(lFileHandle,(unsigned int)0,buffer,FsFileInfo.FileLen);
	if(lRetVal<0)
	{
	  UART_PRINT("unable to read file\n\r");
	}

	lobi = base64_encode(buffer, FsFileInfo.FileLen, &output_length);

	ret = exosite_write(buf,strlen(buf));
	if(ret == 0){
		UART_PRINT("OK\r\n");
		retry_delay = 1000;
	}else{
		UART_PRINT("ERROR\r\n");
		retry_delay *= 2;
		state = EXO_STATE_NOT_COMPLETE;
		ERR_PRINT(ret);
	}

	ret = exosite_write(lobi,strlen(lobi));
	if(ret == 0){
		UART_PRINT("OK\r\n");
		retry_delay = 1000;
	}else{
		UART_PRINT("ERROR\r\n");
		retry_delay *= 2;
		state = EXO_STATE_NOT_COMPLETE;
		ERR_PRINT(ret);
	}

   */
	UART_PRINT("image data = %s\n\r",lobi);


    // Limit Retry Delay to 10 Seconds During Development
    if(retry_delay > 10000)
    	retry_delay = 10000;

    osi_Sleep(retry_delay);

    counter++;
 //    }
}

And I am using Custom Widgets available at https://github.com/exosite-garage/custom_widget_scripts/blob/master/Custom/display_image_from_data/image_from_data_widget.js

Regards,
Arvind


#7

Arvind,

Thanks for posting the main part of your embedded app.

Does your embedded application receive an error? Can you describe where in the process that there is an issue? Have you setup your dashboard to display this information?

Additionally, Is something preventing you from sending the entire image in a single request? I know that if you send the file in 1KB chunks using the write endpoint, you will effectively create 34 separate entries into a dataport. If you are using the example Widget code that we provided, you will need to teach the widget how to read additional dataports, along with teaching it the correct amount of dataports to read.


#9

Hi Martin,

Thank you. Currently I am using a file whose size is less than 1KB after successfully upload , I will work for larger file.

Regards,
Arvind