Author Topic: Simulating IOS screen touch to fire off ui_event() from within the app  (Read 884 times)

TrevorPierce

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Hi,

I'm able to update the state of a switch from within the main loop and can easily toggle the state. 

My question is how or can you even once changing the value of the switch and seeing it change on the screen force the ui_event to fire and do whatever is normally done by having the screen touched on a button or whatever it might be?

Perhaps this isn't possible and I'm just wasting my time trying to figure out how to do this.

Thanks

Trevor

bsiever

  • RFduino Full Member
  • ***
  • Posts: 89
  • Karma: +4/-0
    • View Profile

Do you mean you're using SimbleeForMobile.updateValue() to set the value of a switch, but also want it to react as it would if the switch were being toggled from the mobile and ui_event() was called?

If so, you could also include code to manually call your ui_event()  right after the updateValue() like:
Code: [Select]
  SimbleeForMobile.updateValue(switchId, value);
  event_t event = {0};
  event.id = switchId;
  event.value = value;
  ui_event(event);

Or you can just create a stand alone function to respond to the button state and call if from both ui_event() and where ever you do an updateValue().


  Bill

TrevorPierce

  • RFduino Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
    • View Profile
Thanks Bill,

When I first saw this I thought okay easy.  Then got confused and not after looking again I think I've got a feel for what to do.   I'll give it a shot.

I thought about just firing off a standalone function which might make more sense actually.

Thanks again.

T

 

anything