2 Replies Latest reply on Nov 16, 2014 1:12 PM by userc_11968 Branched to a new discussion.

    Application Button in WICED Sense Smart Tag

      Background

      So I'm doing the Hackathon and my application uses the accelerometer and the application button to make an Android tablet perform some tasks.  I have some experience with Android apps and was able to build the Android WICED Sense app and modify it to detect a given threshold on the accelerometer.  However, I have gone through the source code and found nothing on the Android side that interacts or reads the Application Button on the tag.  I have even tried dumping undocumented/unused bits in the sensor message sent by the tag to Android and do not see anything changing based ion the application button.

       

      It's looking more and more like I will need to use the SDK and make some firmware that will transmit the state of the application button to the Android app.  However, I really would like to avoid messing with the tag firmware if at all possible.

       

      I have three questions:

      1) Is there any way to read the default WICED tag firmware's messages in order to get the state of the application button?

      2) If not, is there an existing firmware I can upload (i.e. a hex file or binary file) that does this that I can upload so I don't have to create an entire application?

      3) If all that fails, what advice can you give for me for building the simplest app to do this?  Specifically, what template already in the SDK would be easiest to use as a base to begin with?

       

      Also, I would really like to be able to send a message from Android to the tag to turn on the buzzer, but that is something I will tackle next.

       

      Thanks,

       

      Kevin N. Haw

        • 1. Re: Application Button in WICED Sense Smart Tag

          Good questions, I was also thinking to enable a button, to get in on App.

          My understanding:

          • both buttons seem to be used by the FW. Not really sure, but both look like wakeup buttons.
            One is to power on and the other seems to have also a meaning to act as an event (not sure which, e.g. wake up from sleep)
          • So, you had to make one button free (changing the logic where the buttons are used). Right now they seem to be associated internally with an INT handler.
          • Assuming you can do, if you want to receive the button status on Android, what to do:
            Extend the existing Notification packet: put also in addition to the sensor data there an additional byte which caries the button status. - seems to me the fastest way.

            Or: add a new Notification (with Characteristic and CCCD) where just the button is notified. It needs to modify and extend the GATT, the service and descriptor definitions (should be possible).
            Then, your App can subscribe to this button notification.
            - the actual and "correct" way but more work to do.
          • Similar if you want to send something from App to device.
            You need a service where one of the characteristics and attributes is WRITE. There is one already in one service but for what it is used ...? (no idea, I have already asked, maybe I can figure out by digesting the FW code).
            If you have such one and you can hijack (maybe bits free there) or here again: if you add a service, characteristic etc. with WRITE attribute, the App can send a BLE WRITE command to it.

            Inside the FW it should get the new value. Question here is just: how is the FW internally notified that a WRITE via BLE was received and an internal variable is updated now?
            This one might need also deeper understanding how the FW works. It is RTOS based, it should have events. But if just the incoming WRITE generates a trigger and you have to do some work, e.g. checking which characteristic it is when you want to take the value, and you had to put into your internal variable ... Or, if you can tell the BLE stack in FW (and RTOS), "hey, if you get a WRITE for this Characteristic - store it here and keep me informed" ... (like a live data binding, an association between a database field and action handler ... might not be so fancy in FW)

          I think, all possible but I am quite sure it needs to put your hands on the FW code.

           

          BTW: an existing bin or hex file might not help really. As I understand, the only way to load a new FW is: compile and let it be launched by Eclipse SDK. Or: get it from an OTA server (where you have to put it on first). Then you could update via the air (and this "update" menu).
          Otherwise you would need a tool which is a firmware downloader, which can read such hex or bin file and send via UART to device. I am not aware of such a stand-alone tool, it looks to me just used behind the scenes in Eclipse.
          If you can modify a makefile in Eclipse and tell it: "do not compile, just load the resulting, here existing, bin file"? Eventually.

          1 of 1 people found this helpful
          • 2. Re: Application Button in WICED Sense Smart Tag

            Thanks!  I will proceed with this approach.  Most likely, there will be other issues to tackle along the way, but I'll post them separately.

             

            Again,  thank you for the help!

             

            - Kevin