PDA

View Full Version : Native Android control client



Pages : [1] 2 3

HTLuke
February 18th, 2011, 08:56 PM
I'm starting a new thread instead of continuing to hijack the iPhone/Android NetRemote discussion (http://www.promixis.com/forums/showthread.php?t=20551). :)

Several years ago I put a Girder web interface together for a Nokia n800 tablet which worked nicely for simple home control. I became a fan of Android devices when I bought Hero and Evo phones, but my web interface didn't port as well as I would like. The experience was slow, the browser's own features get in the way, and I was frustrated that cool stuff like physical buttons, gestures, voice recognition, etc. would be hard if not impossible to leverage.

So I started writing a native Android app called "Andre". It's a server-agnostic client control interface that works with anything addressable through a web service (my focus being on Girder). I'd like to share what I've got so far and get some feedback from other Girder/Android users.

Here's some highlights:
- Totally customizable interface with advanced layout capabilities
- Works over WiFi or Cell network (with appropriate port forwarding)
- Fast, responsive control
- Physical button support
- Gestures
- Page & Button animation (transparency, scale & movement)
- Flexible screen size support
- Embeddable browser windows & Android widgets
- Haptic & audio/visual feedback
- Server-hosted, device-cached config and image files

Coming soon:
- Voice recognition
- HTTPS/secure communication
- Sprite animations
- State variables & tokens
- Two-way data communication
- Expanded control options (sliders, toggles, multi-choice)
- PC-assisted layout tools


A few things to know:

For the time being, layout is done by editing an XML file. There are some good examples packaged with the app and a fairly comprehensive reference manual. There's also a feature called Layout Mode that uses the device itself to display changes in real-time (edit the XML on your server and it instantly appears on the device screen). Mac/Win based config/layout editing tools are in progress. The XML format is pretty easy to understand, and there's a DTD included so if you use a decent XML editor (XML Spy is nice), it'll warn you if the syntax is wrong.

Also there are no media management capabilities built-in. There are two-way data capabilities coming but probably not to the extent of full media catalog browsing (a la MediaBridge). Instead, Andre can embed browser windows into any of its pages. This way, any of the really cool media interfaces people (Tim in particular) have been writing can be seamlessly included right in a layout.



This is a beta, so there will be bugs and rough edges. I've run it on four different types of Android devices and none of them have started smoking or anything, nevertheless use at your own risk, etc.

Check the included manual for quick-start instructions and a guide to some good example/tutorial layouts that are also included. Also check for tips in the original thread above (though please post any new questions there, I don't want to further pollute that thread) or ask questions in this thread.

The file can be downloaded here: Andre 1.0.3b (http://www.buriedaliveinteractive.com/andre/Andre1.0.3b.zip)

Thanks for giving Andre a try! I welcome any comments and suggestions. I'm adding features and fixing bugs pretty fast, and will update this post as they're available.

Luke

woniol
February 20th, 2011, 10:51 AM
Hi,
after a short play with Andre 1.03b on my Xperia X8 i would like to report some problems with:

1. Layout refresh has some problems refreshing LocaleDefs defined in the config.xml.
When i edit this file (add new <LocaleDef id) and then hit Menu->Refresh on my device, no new locations are available under Change Room menu option.
2. 'Back' button on my device doesn't close Andre - nothing happens when i press it.
3. New 'Layout Refresh Delay' setting doesn't seem to work. Every time i change my config.xml, i need to refresh layout manualy by 'Refresh' menu button.

HTLuke
February 20th, 2011, 03:15 PM
Thanks for the report. I'll take a look at the LocalDef issue.

The back and search buttons are intentionally not mapped to any default function so they can be used as hard-buttons for remote functionality. You can however define a behavior (either on a button on the screen or assigned to the hard-buttons) that does trigger the system home/back/menu functionality using the 'keyTrigger' Parameter. By default the Home button is still mapped to return to the Android home screen as a way to exit the app (though you can override the home hard-button too if you wish).

The Layout Refresh Delay is only in effect when you click Menu->More->Layout Mode, are you enabling this? I know it's not labelled well and it isn't in the manual; that was the last big feature I started adding before I cut the 1.0.3 release and need to polish it a bit and document it. :)


Hi,
after a short play with Andre 1.03b on my Xperia X8 i would like to report some problems with:

1. Layout refresh has some problems refreshing LocaleDefs defined in the config.xml.
When i edit this file (add new <LocaleDef id) and then hit Menu->Refresh on my device, no new locations are available under Change Room menu option.
2. 'Back' button on my device doesn't close Andre - nothing happens when i press it.
3. New 'Layout Refresh Delay' setting doesn't seem to work. Every time i change my config.xml, i need to refresh layout manualy by 'Refresh' menu button.

woniol
February 20th, 2011, 05:45 PM
Thanks for the report. I'll take a look at the LocalDef issue.

The back and search buttons are intentionally not mapped to any default function so they can be used as hard-buttons for remote functionality. You can however define a behavior (either on a button on the screen or assigned to the hard-buttons) that does trigger the system home/back/menu functionality using the 'keyTrigger' Parameter. By default the Home button is still mapped to return to the Android home screen as a way to exit the app (though you can override the home hard-button too if you wish).

The Layout Refresh Delay is only in effect when you click Menu->More->Layout Mode, are you enabling this? I know it's not labelled well and it isn't in the manual; that was the last big feature I started adding before I cut the 1.0.3 release and need to polish it a bit and document it. :)

Thanks for Your reply.
I tried 'keyTrigger' Parameter - 'home' and 'menu' values work well for me, but 'back' value causes Andre to close with en error. I defined it like this:
<Button id="hard_back" hardButton="back">
<Locale id="default">
<Parameter name="keyTrigger">back</Parameter>
</Locale>
</Button>

Layout Mode works well i can see config.xml request in Girder every 500ms or so.

HTLuke
February 20th, 2011, 06:13 PM
Thanks for Your reply.
I tried 'keyTrigger' Parameter - 'home' and 'menu' values work well for me, but 'back' value causes Andre to close with en error. I defined it like this:
<Button id="hard_back" hardButton="back">
<Locale id="default">
<Parameter name="keyTrigger">back</Parameter>
</Locale>
</Button>

Layout Mode works well i can see config.xml request in Girder every 500ms or so.

It may be that 'back' isn't defined by default for the app type Andre is (a singular task), but perhaps I can enable it. I assume you'd want it to return to the app/launcher from which you launched Andre?

Glad to hear Layout mode is working for you. I was really surprised how useful it was for tweaking designs. My intention is to create a simple tree-style editor for the PC/Mac to edit the config.xml in (so all the Parameters, attributes and syntax are are handled for you), and I think that plus Layout Mode will make for a pretty capable editing solution.

I'm thinking of exporting screenshots from the device up to this PC/Mac app so you don't have to stare at the device while editing. This way you get close to PC-based WYSIWYG editing that is guaranteed to look *exactly* like it will on your particular device without me having to basically re-implement all of Android's layout functionality on the PC and deal with different screen sizes, densities, OS anomalies, etc.

rgouyet
February 21st, 2011, 04:12 PM
Great project ! I used Netremote on my winmo phone since several years, but since a few weeks, I played with Android and I prefer it to Winmo.
As no port of Netremote on Android was expected, I start created HTML with Girder webserver but as you notice it, it was not as good as netremote.

I just discover your project. I will start to use it but I need to know If it will be possible in the future to display values from Girder variables ?

Thanks for this answer

Edit : I read your last posts and I saw that it will be possible in the near future ... Sorry for this bad question.

HTLuke
February 21st, 2011, 04:43 PM
Great project ! I used Netremote on my winmo phone since several years, but since a few weeks, I played with Android and I prefer it to Winmo.
As no port of Netremote on Android was expected, I start created HTML with Girder webserver but as you notice it, it was not as good as netremote.

I just discover your project. I will start to use it but I need to know If it will be possible in the future to display values from Girder variables ?

Thanks for this answer

Edit : I read your last posts and I saw that it will be possible in the near future ... Sorry for this bad question.


No Worries, there's a lot of scattered info around. :) To be thorough anyway, yes you will absolutely be able to interpret, evaluate and display any values from the web service results.

This feature is the next big chunk I'm working on, and integrating it tightly and effectively is taking time, and I keep getting distracted by other shiny features (just enabled Live Wallpapers (Thanks Quixote for the suggestion!) as a background and am almost finished with a really flexible sprite-animation implementation for Button images). Hopefully within the next couple of weeks pieces of the variable/data display component will start trickling out.

rgouyet
February 24th, 2011, 04:12 PM
Hi,

I'm using Girder as backend for Andre.
I will love to be able to mix several API behind my buttons.

I'm using the Device Manager functionality.
For example, sometimes I want to use the ajax_set_control.lhtml file instead of the ajax_sendevent.lhtml.

Could it be possible to add a "ServiceAPI" parameter to be able to set an other API file (like the serviceUrl )?

Thanks,

Romain

HTLuke
February 24th, 2011, 04:51 PM
Hi,

I'm using Girder as backend for Andre.
I will love to be able to mix several API behind my buttons.

I'm using the Device Manager functionality.
For example, sometimes I want to use the ajax_set_control.lhtml file instead of the ajax_sendevent.lhtml.

Could it be possible to add a "ServiceAPI" parameter to be able to set an other API file (like the serviceUrl )?

Thanks,

Romain

Excellent suggestion, I'll add that immediately and roll it into the next beta release, which I should have by the end of the weekend provided I don't get sidetracked.

Funny, I've had serviceUrl as an optional parameter from the start; how useless is that without an accompanying serviceApi parameter! I guess you could be calling more than one Girder server with the same API entry point... :D

Luke

jumbodogs
March 5th, 2011, 09:33 AM
I was editing an example config file today. When I went to load it I kept getting forced closed when I run the app. I tried putting the original back but still kept getting forced closed. I uninstall app and then put back in but I am still getting force closed when I try to start up. I get the splash screen now and I can get to the settings screen but I don't have enough time to change anything before I get a force closed message.

rkirmeier
March 6th, 2011, 10:11 AM
I'm starting a new thread instead of continuing to hijack the iPhone/Android NetRemote discussion (http://www.promixis.com/forums/showthread.php?t=20551). :)

Several years ago I put a Girder web interface together for a Nokia n800 tablet which worked nicely for simple home control. I became a fan of Android devices when I bought Hero and Evo phones, but my web interface didn't port as well as I would like. The experience was slow, the browser's own features get in the way, and I was frustrated that cool stuff like physical buttons, gestures, voice recognition, etc. would be hard if not impossible to leverage.

So I started writing a native Android app called "Andre". It's a server-agnostic client control interface that works with anything addressable through a web service (my focus being on Girder). I'd like to share what I've got so far and get some feedback from other Girder/Android users.

Here's some highlights:
- Totally customizable interface with advanced layout capabilities
- Works over WiFi or Cell network (with appropriate port forwarding)
- Fast, responsive control
- Physical button support
- Gestures
- Page & Button animation (transparency, scale & movement)
- Flexible screen size support
- Embeddable browser windows & Android widgets
- Haptic & audio/visual feedback
- Server-hosted, device-cached config and image files

Coming soon:
- Voice recognition
- HTTPS/secure communication
- Sprite animations
- State variables & tokens
- Two-way data communication
- Expanded control options (sliders, toggles, multi-choice)
- PC-assisted layout tools


A few things to know:

For the time being, layout is done by editing an XML file. There are some good examples packaged with the app and a fairly comprehensive reference manual. There's also a feature called Layout Mode that uses the device itself to display changes in real-time (edit the XML on your server and it instantly appears on the device screen). Mac/Win based config/layout editing tools are in progress. The XML format is pretty easy to understand, and there's a DTD included so if you use a decent XML editor (XML Spy is nice), it'll warn you if the syntax is wrong.

Also there are no media management capabilities built-in. There are two-way data capabilities coming but probably not to the extent of full media catalog browsing (a la MediaBridge). Instead, Andre can embed browser windows into any of its pages. This way, any of the really cool media interfaces people (Tim in particular) have been writing can be seamlessly included right in a layout.



This is a beta, so there will be bugs and rough edges. I've run it on four different types of Android devices and none of them have started smoking or anything, nevertheless use at your own risk, etc.

Check the included manual for quick-start instructions and a guide to some good example/tutorial layouts that are also included. Also check for tips in the original thread above (though please post any new questions there, I don't want to further pollute that thread) or ask questions in this thread.

The file can be downloaded here: Andre 1.0.3b (http://www.buriedaliveinteractive.com/andre/Andre1.0.3b.zip)

Thanks for giving Andre a try! I welcome any comments and suggestions. I'm adding features and fixing bugs pretty fast, and will update this post as they're available.

Luke


First of all let me say awesom app and bravo on stepping up to put this kind of time and effort into a native Android solution. I've been using RDP for a while now and it's working but as I look to recreate a tablet sized interface I certialy would like a native Android app. I really love the idea that I can include widgets and use hard keys, those are 2 major reasons I don't want to stick with the RDP solution. I would love to switch over to Andre but there are a few things holding me back... Ever since I got my EVO the PDAs seem so outdated (small screens, resistive screens, battery). I'm thinking soon my EVO is going to get lost (become wifi only ;) ) and I'll pay Sprint the $150 deducible for a new one so I have a dedicated EVO at home for this setup plus the one I use as a phone.

Your Locale setup is interesting but offers limited scalability. In a modern app we need to be able to define Zone (locale/room), Input device, and Output device while minimizing the work to setup the screens. I came up with a solution in NR that I have used for years and it works great...

In my current Netremote/Girder setup I use variables on the netremote side to pick zones and devices. I'll explain...

My remote is setup with zones (rooms), IN devices (Sat, Music, DVD, etc), OUT devices (TV, PJ, AMP). At the top of my device I have a drop-down type of menu to select a zone, then I have a out device botton that toggles between 1, 2 or 3 OUT devices (amp, tv, pj) depending on the room although with a larger screen I might have a button for each instead of a toggle. Then there is a line of icons for IN devices (Sat, DVD, Music, etc). When I select a zone (room), a OUT device, and IN device the values behind the NR buttons are dynamic in that what gets sent to girder is based on the values of the variables for zones and devices.

So let's say I have selected a ZONE of Livingroom, a INDEVICE of DVD, OUTDEVICE of TV.
An INDEVICE button (i.e. play button) would have the following code (variables) for the girder send event ({ZONE}.{INDEVICE}.PLAY) which would really equal (LIVINGROOM.DVD.PLAY).

An OUTDEVICE button (i.e. vol- button) would have the following code (variables) for the girder send event ({ZONE}.{OUTDEVICE}.VOL-) which would really equal (LIVINGROOM.TV.VOL-).

You can see that with this setup you really only need to create most of your buttons once and you simply let NR handle assigning the variables to send the correct girder send events for each key. It's very dynamic and scalable for more in or out devices and zones. If I move any device to a different room I just need to move the events in girder for the commands and nothing needs to change on the client.

In theory Andre can achive the same end result with the locale setup although it would be a lot of additional work because every button that has a different value needs to be recreated over and over for all the combinations. In my case I have 5 zones, up to 3 out device in some zones, and up to 5 in devices in some zones.

Ok, this a this where this setup gets cool. Let's say I in Living room watching a DVD on the TV so I have these things selected in NR. Now if I select Music it will send an event to girder telling it I selected Music then girder will quick lookup what device I last used for music in the living room (AMP) and will set the OUTDEVICE variable on this NR client to AMP. So as I switch from DVD and Music the variable for OUTDEVICE gets automatically gets updated and all my buttons automiatically switch to control the AMP. I can also hide buttons based on the value of variables. Might seems pointless for Music and AMP but sometimes I might want to have Music up on my TV even if it is just music. I originally came up with this because in my theater room I have a AMP, PJ, and TV. I often my have Sat on the TV while having the PS3 on the PJ and maybe my Music on my AMP so with this setup I can push 1 button (Sat, PS3, or Music) and it's smart enough to know that last OUTDEVICE I used on all my INDEVICES.

This all works the same for zones too. If I select my living room I looks up and sees that I last watched Sat on the TV so I as I click the zone (room) it automatically selects Sat and TV or whatever the last IN and OUT devices were. Makes switching between zones a lot less work. The goal with this whole setup was to minimize the botton pushes and it really works well!

So with all this being said it would be really great if Andre had the following capabilites.

*Variables - Set locally with a button push or by girder. Girder send events can contain these variables. Must be able to target a specific Andre as there may be many running at one time.

*Ability to jump to a Andre page from girder. Also must be able to targer a specific Andre from Girder.

*Button states - So I can change the graphic based on a value of a variable. Or I might set certain buttons to hide if a variable is a certian value. (i.e. Maybe I hide display type buttons on the page if I have AMP selected.

Because of these capabilties in NR I only basically need 1 page for each INDEVICE and all ZONES and OUTDEVICES are simply controlled by variables.

jumbodogs
March 6th, 2011, 10:38 AM
I got it going. I was able to hit refresh before it crashed and not it is working again. I guessed I screwed up the config file pretty bad :)


I am going to try and recreate as much as I can of my netremote skin with this. Here are a few of the pages I want to create and was wondering if some of this will be possible.

Home Screen
http://img8.imageshack.us/img8/5352/circlecenterhome1.th.png (http://img8.imageshack.us/i/circlecenterhome1.png/)

Seems pretty basic. Button group on top to launch other pages and bottom button group just triggers events in Girder.


Remote Screen:
http://img834.imageshack.us/img834/3586/circlecenter4.th.png (http://img834.imageshack.us/i/circlecenter4.png/)

This seems like it shouldn't be to hard basically what you had with just some different graphics.

Security Screen:
http://img813.imageshack.us/img813/7992/securitylayout.th.png (http://img813.imageshack.us/i/securitylayout.png/)
This is one where I am not sure how to do. The arming buttons are easy. I just send events to Girder but I'm not sure how I would do the keypad part.

Lights Screen:
http://img145.imageshack.us/img145/6356/lightslayout.png (had to link to this picture ... only 4 pics in one post allowed)
The top part again doesn't seem that hard with just the buttons but wondering how I would go about the sliders?

I was just wondering if you had some thoughts about going about creating that or if there are things that might not be possible to do.

Thanks for app so far looks great.

rkirmeier
March 6th, 2011, 08:06 PM
Thought of one other feature that would be really helpful. Overlay pages.

honnt
March 15th, 2011, 09:30 PM
Is Andre still in development? I installed the apk linked in the first post but it reports that that version has expired...

rkirmeier
March 16th, 2011, 03:52 PM
Sure would like to see that new version with the variable support! :)

rgouyet
March 28th, 2011, 04:11 PM
Any new version to come ? The first beta is no more usable since many days...
thanks

HTLuke
March 28th, 2011, 08:11 PM
Sorry for being MIA for awhile guys, I forgot the message board by default doesn't send more than one notification email unless I visit, and I thought this thread was quiet! I'm glad people are finding Andre potentially useful.

I've been cranking away at Andre and got pretty deep into an architectural refactoring in order to start supporting states and variables, and the app was pretty unstable for awhile. My intention was to continue to clean things up until I reached a higher level of day-to-day useability but I know the old version has timed out and I don't want to leave people with nothing to experiment with, so I'm releasing a rough cut of the current state.

Here it is:

http://www.buriedaliveinteractive.com/andre/Andre1.2.1a.zip

Because this isn't what I'd normally release for public consumption, please keep in mind that while it is pretty stable, some of the newest features (Actions, States and advanced animations) have a few quirks and a few capabilities that I've not completed. I also have not had the time to completely update the manual. Here is a list of most of what's new:

Bug fixes:
+ BUG: Changes to options menu & locales menu only takes affect when the app launches.
+ BUG: Parameters on inherited buttons that come from Page Parameters set don’t exist
+ BUG: Pre-load the animation images
+ BUG: Image hash should not dependent on full URL, only filename
+ BUG: Our rest client object should derive host from the URL
+ BUG: Sprite animations show the sprite’s first frame as full-screen before shrinking to sprite dimensions
+ BUG: Delay when starting sprite animations
+ BUG: Fix a bunch of force-close issues and bad exception handling

New/changed features:
+ Added custom, programmable button in the system Menu (MenuLink)
+ Added search-launcher Parameter (openSearch)
+ Added page history Parameter (linkPreviousPage)
+ Enabled Wallpaper (live and non) as background
+ Enable full TTF font downloading and referencing
+ Change Settings that use text fields to use hints instead of pre-filled values
+ Add serviceApi Parameter type, rename Settings option as 'default service api'
+ Add serviceUsername/servicePassword Parameters for service calls (not just global username/password)
+ Moved button hilite color to a Parameter (buttonTintColor), remove from global Settings
+ Restructure code in preparation for state-based visual/control elements
+ Added Parameter ‘action’ attribute for determining behavior at each stage of a press (display, touch, heldstart, heldrepeat, release)
+ Added Layout mode indicators by adding check-mark in menu, ‘Layout Mode’ message at the bottom of the screen
+ Added check-mark in 'choose location' to identify which locale is currently selected
+ Add sprite animation handling, display and XML parsing
+ Change Settings to identify the Authentication items for just config and resources
+ Don't allow another refresh to start if a refresh is happening.
+ Change where Repeat Frequency is set
+ Add customizable Alpha, Scale, Rotate and Move animations for Buttons and Pages
+ Removed pre-defined animations in lieu of new animation system
+ Removed displayAnim Parameter as redundant (animation Parameter with action="display" is equivelent)

Of most interest are the following:

- Separate out serviceApi, serviceUsername and servicePassword as Parameters so you can call multiple web service APIs.

- Custom TrueType font support: Load .ttf files from your server and use them for text labels.

- 'action' attribute on Parameters: this lets you specify what part(s) of a Button press the action pertains to, initial display, very first touch, long press, repeat (when repeatFrequency defined) and release.

- 'state' attribute on Parameters: this represents user-defined alternate states for Buttons. States currently can be changed by a Button using the 'changeState' Parameter but eventually will also be changeable by web service calls, timers, etc.

- SpriteAnimations and translational animations (scale, alpha, rotate, position): Buttons can now play cell-based sprite animations as their image. Buttons and Pages benefit from a completely configurable animation engine, replacing the pre-fabricated animations from before


Most new features are at least minimally documented in the latest manual, but there are definitely gaps and probably some outdated information (the config tutorial/examples at the end of the manual are now totally deprecated for example). The only config included with this version is my real-world testing platform, but it has most new features represented, so it's a good thing to scan through for usage examples.

If you run into any issues or have any questions on how stuff works, please let me know. I'll visit the thread more often, I promise. :)

Luke

HTLuke
March 28th, 2011, 08:37 PM
*Variables - Set locally with a button push or by girder. Girder send events can contain these variables. Must be able to target a specific Andre as there may be many running at one time.

*Ability to jump to a Andre page from girder. Also must be able to targer a specific Andre from Girder.

*Button states - So I can change the graphic based on a value of a variable. Or I might set certain buttons to hide if a variable is a certian value. (i.e. Maybe I hide display type buttons on the page if I have AMP selected.

Because of these capabilties in NR I only basically need 1 page for each INDEVICE and all ZONES and OUTDEVICES are simply controlled by variables.

Thanks for the kind words and great suggestions. As it happens the version I've been working on supports some of the functionality you're looking for. The new 'state' attribute for Parameters would let you re-assign a (set of) Button(s) Parameter values by clicking other Buttons (and eventually by reading a web service or other push/pull data update).

These states can alter all Parameters; the serviceParams so you can alter the web service call variables, and they can change the button graphic/label/etc so you can literally make one button into as many fully distinct states as you need.

This is still not exactly what you're looking for, since you still need to create the alternative Parameters for each, but you can use logical ButtonGroups and Parameter inheritance to minimize actual config code. Beyond that, I will be implementing bonafide tokenized variables in the configuration too at some point, which will let you push new values into the Parameters from any action/data source, which is more of what I think you'd really like for this application.

I hadn't actually given thought to the addressable nature of each Andre version running, that's a good point. Having not put a lot of effort into it yet, I had assumed I'd do it just by IP, but explicitly naming each and have a subscribe/listen pattern for two-way data comms is definitely a smarter approach.

HTLuke
March 30th, 2011, 01:09 AM
Hey Jumbodogs, looking at the security screen, the keypad is very similar to the one I have in the demo config.xml. If you press the # button you'll get to another screen that has the keypad, which you could tighten up the spacing on and use almost verbatim. For your extra two buttons on the left, just align the keypad to the right and then align the two buttons against the left edge of the keypad.

If you'd like me to take a stab at such a layout, I'd be more than happy to.

The sliders are something I'm looking at how best to implement. There are some trickery you could do to get some semblence of slider behavior but I think they're all less than ideal. My intention is to add bonafide slider support however.

jumbodogs
March 30th, 2011, 08:29 AM
For the keypad what I was wondering is how would I send the code to Girder to disarm my alarm? I can create an event in Girder to disarm it by just triggering an event but I would think it would be safer to send the code. I was also thinking maybe just use the keypad buttons to make the disarm button usable. I would still have to use a macro in Girder that turns alarm off but at least if someone did get my phone then would still need code to disarm alarm.

harleydude
March 30th, 2011, 10:07 PM
Jumbodogs,

In order to disarm/arm the system you will need to collect the digits on the phone then send them to Girder in one event. Once there you can run some Lua to disarm/arm the Elk.

HTLuke
March 31st, 2011, 12:45 AM
I was just giving the variable/tokens architecture some thought, about being able to 'build' a compound parameter by stringing multiple presses together. You'd probably need to type in the number and then hit a 'send' button however...

rkirmeier
March 31st, 2011, 05:44 PM
Glad to see you back! I'm really excited about this application!

rkirmeier
April 1st, 2011, 03:11 PM
Any chance we might get local variable support soon?

jumbodogs
April 1st, 2011, 03:52 PM
I was just giving the variable/tokens architecture some thought, about being able to 'build' a compound parameter by stringing multiple presses together. You'd probably need to type in the number and then hit a 'send' button however...

That would work unless you could tell it before hand how long it should be. That way it just sends after 4 digits or 6 digits ... but adding send key would work if that is easier.

HTLuke
April 1st, 2011, 10:09 PM
I'm coding variable support right now actually, I'd like to have something ready to play with by the end of the weekend. I'm sorta blowing off fixing a few bugs in the newer stuff but I'm too excited about the variables (and something additional, see below) and want to get it out of my head while it's fresh.

Great idea Jumbodogs, and I think I know a few ways you could implement such a thing without too much customization.

Speaking of which, variables have some uses in and of themselves for conditional control, but they're far more powerful coupled with some form of parsing/logic functionality (conditionals, evaluations, etc.) which I had planned on, but hadn't really designed yet. I started to poke around for existing scripting interpreters and found something potentially amazing. Basically an open-source android multi-language script interpreter including lua, javascript, rhino, perl, python and others.

Assuming I can integrate it, it means simple deterministic logic will be trivial, and in your favorite language to boot. Further, this project (SL4A) actually has a robust wrapper around Android APIs inside these languages. That means that Android functionality not wrapped natively as part of Andre would still be accessible through scripting. Everything from SMS send/listen, camera functionality, GPS, etc. is available (see the API reference here: http://code.google.com/p/android-scripting/wiki/ApiReference).

It's a lot to bite off for a weekend, but I'm game to give it a shot! :)

quixote
April 2nd, 2011, 04:57 AM
http://www.promixis.com/forums/showthread.php?21019-Calling-all-quot-Girder-Masters-quot&highlight=sl4a

Way ahead of ya! ;) lol jk!
:D

HTLuke
April 2nd, 2011, 10:26 AM
Haha I should have known it was too good not to have been discovered before. :) It is the perfect cross-over interface to Tasker too, saves me time from having to do all the intent-oriented stuff we talked about.

quixote
April 2nd, 2011, 01:13 PM
I think it's great that you discovered that stuff. I'd say you qualify as a "Girder master". :)
I'm a little caught up again in trying to get this aquarium project set up, but I will be dedicating some time to Andre just as soon as I have a little more time. I should be able to tie the two together since the aquarium is being monitored/controlled by an Elk system, which is also being monitored/controlled by Girder.
It'll be fun to build an interface for aquarium control and stats!

HTLuke
April 4th, 2011, 04:13 AM
Just an update, since I had hoped to have a new version with variables done tonight. I discovered that my recent re-factoring to improve performance and pave the way for a fully stateful design caused a few big bugs that I uncovered yesterday. The good news is the bugs go away when I make the next/final step toward the fully stateful design, but the bad news is variables/tokens would have to have been coded in such a way as to need to be re-written once that step was taken.

So I decided to freeze the new fun stuff and just finish the re-write. I'm about half-way through already, but I don't know how much time I'll have to work on it this week. I'm targeting Friday or Saturday, and then another two or three days to get variables in place.

The really good news though is that variables/tokens become infinitely more useful when the entire design is fully stateful. :)

rkirmeier
April 4th, 2011, 08:48 AM
Thanks for the update! Really looking forward to the starting an Andre project... Just need that variable support. :)

You should put an email address for donations in your signature... :)

HTLuke
April 12th, 2011, 10:09 PM
Another interim status update; I really stepped off a cliff with this refactoring, basically ended up rewriting about 70% of the code, which meant breaking lots of stuff, running into new performance hurdles, etc. I've managed to restore almost all functionality and overcome all the performance issues so now I'm knocking out remaining bugs and will be turning finally to variables.

After a few more hours of clean-up work (within a day or two) I may throw out a fairly untested and unstable build to get general feedback on performance, since I'm now persisting absolutely everything either to a sqlite db or the file system and different device types will vary widely on file system performance, etc.

I'm going to wait until I have what I consider a 'complete' app before making any decisions on donations or free/premium versions. I don't like collecting money for something unfinished especially when I can't predict when it'll be done. My original thinking was to have a simplified version for free with a fully loaded version in the market for some price comparable to similar products, but I've not really thought about it in awhile. This was supposed to be a one or two month side project and I'm now going on almost a year of weekends and late nights. :D

rkirmeier
April 15th, 2011, 12:47 PM
Thanks for the update! Your nights and weekends will pay off once you release it to the market. The key to a successful release will be having a basic sample config for both Andre and Girder.

rgouyet
May 5th, 2011, 12:26 PM
Hi,

The beta expired again... Is it possible to extend the old version to be able to use it until the new version arrives ?

Thanks,

Romain

woniol
May 11th, 2011, 12:01 PM
Any news about Andre developement?

HTLuke
May 29th, 2011, 05:36 AM
Sorry for the extended absence again, day job and ill family members both took big bites out of the last several weeks. Also that cliff I mentioned before? Grand Canyon scale. I basically ended up re-writing 95% of the code, and then nearly doubling the line count adding the statefulness stuff.

The good news is I finally restored performance back to the level I'm content with for now, and it's stable enough that I can once again use it as my daily remote.

The better news is I've finally added full variable/token support, a full Rhino JavaScript integration (giving Andre the power of scripting with the added benefit of a full JS-to-Java (including Android classes) bridge), and the first steps of web service response capture.

The best news is I'm doing some major scrubbing and prepping of it today. Whatever I get done by the end of the evening I'll post for you guys to play with. This will not include an updated manual because that will add a serious delay I'm sure you'd rather not endure. However I'll create a few example configs and I'll post a quick primer of all the new functionality with the apk link, and I'll gladly be more active in the next several days to answer questions and help tinker with it.

Thanks for the patience, hopefully we're now approaching something that can really address the majority of use cases out there!

Luke

ewingr
May 29th, 2011, 04:15 PM
I"m looking for somethign to do Girder control from my ASUS tablet. Sounds like this may be a possiblity. Haven't read the whole thread yet. I downloaded and installed the link in the OP, and as noted above, it is expired.

I'll be watching here, and may participate in your beta.

HTLuke
May 30th, 2011, 08:06 PM
A few hours later than expected, but here is the latest. I've not had time to update the manual since the last release (1.2.1) but it is still applicable, especially for core config file syntax and behaviors.

I also haven't had time to make a good demo config so the included config.xml is my own test setup. It mostly talks to Girder (one page communicates to an obscure Z-Wave server). Almost every capability is represented somewhere in this config though, if you dig around. The DTD is also out of date.


Big Changes

- Almost everything under the hood. Andre loads from config.xml the first time (or when told to refresh) only; otherwise it is persisted in various ways on the device. This touched absolutely everything in the code and I've tested the core features but there may be some fringe stuff that doesn't work as it used to. Please let me know if you find something broken.

- User-definable variables and tokens
- (Optionally) capture web service response into a variable
- Added Rhino JavaScript (with Java bridge support) scripting
- Refresh now allows for partial/selective refresh
- Sound effect support
- Broke inactivity timers
- Possibly broke gesture support
- Added force-close error reporting



Installing & Configuring for the first time

Uninstall previous versions of Andre first.

Copy the contents of the http directory in the zip into your web server root (for Girder it's something like Girder5/httpd). You should then have Girder5/httpd/config.xml and Girder5/httpd/buttons/*.png and be able to hit these with your regular browser.

If you have auth enabled on Girder's web service, open config.xml and search for serviceUsername and servicePassword. Add your username and password as the value for these. If you don't have auth enabled, just leave them empty.

When Andre first runs it will need to be configured. Press Menu and tap 'Settings'. Fill in all the applicable items in the top section ("Server Settings"). See the manual for details, or ask here for help if you need it.

Finally, once out of the Settings dialog, press Menu and tap 'Refresh'. Leave everything checked and click the 'Refresh' button. If all goes well Andre will fetch the config.xml and all the images, fonts and sounds and eventually display the first screen.




Details of new features:

Please make sure to look through the included config.xml as most of the new functionality is demoed there.

Variables

config.xml can have variables defined, manipulated and used as Parameter values. First, optionally set the variable ID and default value in a section called <Variables>, as such:


<Variables>
<Variable id="myfirstvariable">Variable default!</Variable>
</Variables>

To use a variable in a Parameter, use a token of the variable ID surrounded by _% and %_, for example:


<Parameter name="buttonLabel">_%myfirstvariable%_</Parameter>

It can be embedded in text:


<Parameter name="buttonLabel">Light is: _%myfirstvariable%_</Parameter>

There are several ways to manipulate variables. When variable values change, the changes will be instant if possible (if a button label uses a variable and that variable gets updated, so will the visible label on screen).

There are three new Parameters: setVariable (replaces contents of variable), appendVariable (adds text to end of variable), prependVariable (adds text to beginning of variable). The format is <varname>=<newvalue> as such:


<Parameter name="setVariable">myfirstvariable=New Value</Parameter>

You can also direct a web service call to dump the result (page contents, not response code) into a variable by defining a Parameter called serviceResultVar like this:


<Parameter name="serviceResultVar">myfirstvariable</Parameter>

This needs to be defined in tandem with a "serviceParams" Parameter (e.g. any action where your calling a web service). Be aware that defining this makes the web service call synchronous. If you set it globally your remote will be less responsive (web service calls are async by default).

Once the web service call is made, the variable will contain the response. Be careful with response size; I've not yet put any limitations on it and you could really strain memory if you started capturing the source for a huge website.

Finally you can access and set variables within the new scripting capabilities, which I'll talk about next.


Scripting

I've incorporated the mozilla Rhino JavaScript interpreter (http://www.mozilla.org/rhino/) so Andre can run scripts. These scripts have access to Andre data and variables, and can directly invoke Java (including Android-specific stuff). It's very cool and insanely powerful. You could write an entire mini-app with UI and everything inside this script.

Scripts are defined in a section in config.xml called <Scripts>:


<Scripts>
<Script id="demoScript">
... script here ...
</Script>
</Scripts>

It is likely that you'll use characters in JavaScript that the xml parser will choke on, so it is recommended you surround your script with <![CDATA[ and ]]> which will tell the interpreter to treat the contents verbatim.

Andre exposes some of its values as pre-defined global variables:
- andrePage = currently visible Page ID
- andreLocale = currently selected Locale ID
- andreButton = the Button ID which was responsible for calling the script
- andreArgs = the (optional) string that was passed into the script by the Parameter
- andreResult = the variable that you dump data into to return it to Andre
- andreVars = an object with .getVariable(<varname>) and .setVariable(<varname>, <newvalue>) functions used to access and change Andre variables.
- Andre = Android context reference to Andre itself, required when using the Java code bridge to execute some native Android Java functionality like UI control

Once a script is defined, it can be called in two ways. First it can be called explicitly with the 'executeScript' Parameter, like this:


<Parameter name="executeScript">demoScript</Parameter>

Second, you can call it in-line as part of a Parameter payload by using a token of the script ID surrounded by _$ and _$ like this:


<Parameter name="buttonLabel">The Time is: _$demoScript$_</Parameter>

When calling the script this way, the value set in the script for variable andreResult will get substituted for the token when evaluated.

Right now scripts can't directly trigger other Andre functionality like calling web services, changing Button values, etc. but the very next thing I'm working on is a full bridge to all of that; changing Parameter values, triggering all control functionality, etc.


Sound effects

Instead of one embedded sound file for 'keyclick', there is now the ability to load sounds from your asset server and play them. The syntax is almost identical to the Font support. You pre-define sounds in a <Sounds> section in config.xml like this:


<Sounds>
<Sound id="pop" url="/pop.ogg" />
</Sounds>

Then elsewhere in config.xml simply define a Parameter 'playSound' with the sound ID:


<Parameter name="playSound">pop</Parameter>

Be aware that these sounds get cached in memory, so they shouldn't be huge (no music playlists :) ). Ogg format is recommend, but varying builds of Android support different types of sound files including wav, raw, and mp3. Try it and see what works for your device.


Force close error reporting

I added the ACRA library (http://code.google.com/p/acra/) which will catch any force-closes (Java exceptions) from Andre and send the exception info with basic device data (screen sizes, memory, device type, etc.) to a Google docs spreadsheet that I use to see what happened.

There is zero personal data sent. You can see the list of values that get sent here: http://code.google.com/p/acra/wiki/ReportContent. This is invaluable for understanding odd crashes. I intend to eventually integrate this into preferences as an option (and show a dialog to allow the user to add a comment to the report), but I've not gotten around to it yet. For now, if you do not wish to have that specific set of data sent to me when Andre crashes, please do not use this version of Andre.


What's Next

I also have about 150 specific TODO items left that I'll hopefully be iterating on and releasing new builds a lot more frequently now that the rewrite is behind me. The biggest items off that list:

- Complex timers: trigger scripts or any other functionality on a schedule, including full calendar-like reoccurance, etc.
- New UI types (sliders, thermometers, data lists)
- Dialogs (display modal text popups or ask for user input)
- App integrity (behave better with Android app lifecycle)
- Instant push notification support (for Android 2.2+ devices)
- Voice control
- Text-to-speech
- 'Overlay' pages (pop-up Andre pages)
- Secure communication (HTTPS)
- Localization



I'm excited to see if the new features address the needs people have. Looking forward to helping craft configs/scripts when I can. I'll monitor this thread as much as possible over the next few weeks and will gladly answer questions here or in PM.

This version will function until July 15th, 2011. I expect several new versions before then so people won't be without a functioning remote.

Andre 1.6.1b Download: http://www.buriedaliveinteractive.com/andre/Andre1.6.1b.zip

Enjoy!

KRO74
May 31st, 2011, 07:59 AM
Hi,

I have just started to fool around with Andre and it looks promising.
I have one question though,
How can I show a girder variable ? Would be nice with an example.

Regards

HTLuke
May 31st, 2011, 09:30 AM
I will cook up some good examples of fetching and using Girder variables in the next day or two. Essentially you'd call the Girder web service to retrieve the variable value using serviceResultVar to stuff the returned value into an Andre variable, then you'd use a small Javascript script to parse out the part of the variable you'd want into another Andre variable which would be set as the label of the button you want to show on the UI.


Hi,

I have just started to fool around with Andre and it looks promising.
I have one question though,
How can I show a girder variable ? Would be nice with an example.

Regards

HTLuke
May 31st, 2011, 02:09 PM
A minor update:

I've been getting a few force-close reports and trying to fix the bugs they represent. Here is 1.6.2b with the following fixes:

- Will not force-close if you press 'Change Location' when there is no remote loaded
- Partially fixed a rare occurance of a button getting 'stuck' pressed and repeating its commands forever


A few notes regarding device support. Officially Andre is written for devices with at least Android 2.1 or higher (2.2 for some optional future features) and have at least a memory heap available of 16MB. Other device versions and/or devices with constrained memory may work, but consider the demo config.xml is rather complex.

If Andre crashes because of low memory, you may wish to try cutting down the size of the config.xml (remove a few of my pages), creating a new simpler config.xml from scratch, and/or using different button graphics (less diversity or compress them further).

Here's the new version: http://www.buriedaliveinteractive.com/andre/Andre1.6.2b.zip

rkirmeier
June 1st, 2011, 03:36 PM
Do you anticipate the ability to send variables to Andre from Girder or will it always have to be fetch? Let's say I push a button and send some info to Girder but will need a response from Girder with updated variable data how would that be done? My NR interface heavily relies on pushing and receiving variables from girder as all my logic is done on that end. The server also stores states of devices in zones, etc so I can't see moving it to the device.

Also, why the short expirations? I have to admit that if I had moved everything over to Andre then it expired and had to wait a week+ I would be very upset. I am sure everyone here would be happy to pay for the final version when you release it. Even if the expiration is out 3+ months users are not forced to always update but they will eventually have to buy it. I just don't understand this especially seeing how a few users have already been effected and there was nothing they could do...

Thanks for all the hard work on what looks to be a VERY promising solution!!!

HTLuke
June 1st, 2011, 04:42 PM
Do you anticipate the ability to send variables to Andre from Girder or will it always have to be fetch? Let's say I push a button and send some info to Girder but will need a response from Girder with updated variable data how would that be done? My NR interface heavily relies on pushing and receiving variables from girder as all my logic is done on that end. The server also stores states of devices in zones, etc so I can't see moving it to the device.

Absolutely. There will be several ways to do this.

First and foremost for Android 2.2+ devices (Google introduced this for 2.2) I'm implementing cloud-2-device, which is true instant-push notifications, even if the app isn't awake or running.

Second, while not push, I'm in the midst of adding customizable service timers that can trigger button behavior so you can set up polling to obtain all the state you need to keep in sync. There are battery concerns with this approach and even if your polling is reasonably fast, there's still a chance to have stale data for some period of time.

Third, I will likely be adding SMS scraping at some point so you can send state to phones via text. This is lower priority than the first two though so it'll be awhile.

Regarding your example, if you press a button which sends a command to Girder via service call which in turn updates some girder variable(s), you just need to get Girder to put those variables of interest into the web response. Then you can make the service call and capture the response in one shot. This may require a tiny bit of new lhtml on the Girder side but it should be trivial (basically a combination of ajax_sendevent and ajaxreq).

There are also some creative just-in-time approaches that may also work depending on the use case. You can set Buttons (using action="display") to trigger the web service call when they get displayed on-screen so they basically refresh themselves just as the page their on is rendered. Note: I just this morning flipped some of this display logic around to greatly speed up page transitions, so if you want it to repeatedly call the "display" Parameters every time the button comes on-screen (and not just the first time the page is instantiated) you also set redisplay="true" in the Button attribute list. I'll be putting this version up later tonight with a more detailed explanation.


Also, why the short expirations? I have to admit that if I had moved everything over to Andre then it expired and had to wait a week+ I would be very upset. I am sure everyone here would be happy to pay for the final version when you release it. Even if the expiration is out 3+ months users are not forced to always update but they will eventually have to buy it. I just don't understand this especially seeing how a few users have already been effected and there was nothing they could do...

Thanks for all the hard work on what looks to be a VERY promising solution!!!

The reasons for beta expirations don't include protecting paid customer conversion; I don't consider these versions anywhere near complete and the final version in the market will be worth paying for by comparison in my opinion. ;)

I consider these as early betas with lots of bugs and a very big likelyhood of changing significantly (and breaking all the hard work someone might put in porting their configs over) and I would not endorse using them as your full remote. I'm looking for experimentation and tire-kicking feedback on whether the feature set meets people's needs, and to get some help testing on different devices/screen sizes/environments.

I time the expirations short to roughly match my release cycle (well, when things are going as planned...) because I don't want multiple major versions out in the wild at the same time as it makes debugging more difficult. For example, someone downloads version 1.2.1 and creates a complex config for it; I release 1.5.0 that breaks their config so they choose to stay on 1.2.1 and they discover a bug. The usefulness of their input as a beta tester is severely diminished if I have to go back and see if the problem they're having still exists, and/or try to support them with problems that may or may not be caused by the stale version.

When I reach a point where I consider the app stable enough in design (and function) to be supportable and useable as a full-time remote, I'll most likely relax the expiration considerably in anticipation of an RC release.

Thanks for the support, I look forward to hearing more feedback with the new functionality!

rkirmeier
June 1st, 2011, 06:10 PM
Ok, great response! How about using something like Eventghost for passing variables? There are PC and Android clients... There is a post this forum about 2-way communication between girder and android using Eventghost.

http://www.promixis.com/forums/showthread.php?21005-Eventghost-to-Girder

HTLuke
June 1st, 2011, 08:10 PM
Ok, great response! How about using something like Eventghost for passing variables? There are PC and Android clients... There is a post this forum about 2-way communication between girder and android using Eventghost.

http://www.promixis.com/forums/showthread.php?21005-Eventghost-to-Girder

Interesting idea. I'm looking through the docs and forum and I don't see if/how EGfA is passing the event payload to apps that it launches. If EGfA does/would pass on the payload to the apps it launches as an extras parameter then it would be trivial to listen to it. Andre already has had some Android Intent functionality for listening to messages from other programs/services, but I switched it off because it wasn't done yet and I broke bits of it during the last several rounds of feature development (I want Tasker and Locale and all the other goodies out there to be able to trigger Andre behavior).

Also, just creating a native tcp listener/server exactly how EGfA does it wouldn't be too hard, but I'm worried about connection integrity and battery life issues. With Google cloud-2-device, they do store-and-forward, have decent security features, it's highly scalable and a whole lot of other cool things. It's just a shame that only 2.2+ has it enabled. I (and I'm sure others with a tech habit) are starting to collect 'aging' Android devices that are replaced by new shiny ones, and Andre is a fantastic alternative to throwing it into a drawer somewhere. :D

I'm still looking at options and I'll likely do multiple options to suit as wide a range of users as possible.

quixote
June 2nd, 2011, 12:07 AM
I'm noticing that my events are showing up in the logger as "/". When I hover over the event, I can see the proper event has been triggered (ie. play, pause, etc.).
Is this caused by Andre, or is it a behavior of Girder's latest alpha version?
Thanks.

woniol
June 2nd, 2011, 12:13 AM
Thanks for the update.
In the new versions I get a network error when i go to Menu-> Widgets -> LIGHT CONTROL and I press one of the ON/OFF buttons,
I get 'No No network detected, attempting to reconnect. Failed to reconect. Check network or Andre settings.'
This happens on both 1.6.1 and 1.6.2 versions.

HTLuke
June 2nd, 2011, 01:55 AM
I'm noticing that my events are showing up in the logger as "/". When I hover over the event, I can see the proper event has been triggered (ie. play, pause, etc.).
Is this caused by Andre, or is it a behavior of Girder's latest alpha version?
Thanks.

Have you tried to hit the Girder service from your browser or a command line to see if it still happens? I don't typically update Girder much so I can't say if it's an effect of the alpha version. You could also try installing the latest stable release version if it's still posted someplace.

HTLuke
June 2nd, 2011, 02:03 AM
Thanks for the update.
In the new versions I get a network error when i go to Menu-> Widgets -> LIGHT CONTROL and I press one of the ON/OFF buttons,
I get 'No No network detected, attempting to reconnect. Failed to reconect. Check network or Andre settings.'
This happens on both 1.6.1 and 1.6.2 versions.

The Light Control page is not pointed at the Girder server, it's hitting a ZWave protocol server. It's an example of being able to call different servers/services within the same configuration. If you look in the config.xml under the 'pg_zwave' Page you'll see a ButtonGroup (called 'btngrp_zwave_control') with serviceUsername, servicePassword, groupServiceParams, serviceUrl and serviceApi parameters defined. All the Buttons in that one ButtonGroup use this other IP address instead of the default (I think it's actually the same machine but on a different port).

The error messages for network errors needs refinement, as if it gets a connection refused (which is should unless you're running some kind of listener on port 8084) it should say that explicitly, and maybe dump the URL out to the error dialog so you know what it was trying to connect to when it failed. I'll add this to my to-do list, thanks.

woniol
June 2nd, 2011, 03:27 AM
I'm noticing that my events are showing up in the logger as "/". When I hover over the event, I can see the proper event has been triggered (ie. play, pause, etc.).
Is this caused by Andre, or is it a behavior of Girder's latest alpha version?
Thanks.

I had the same 'problem'. All You need to do is go to Menu -> Settings -> Default Service API and write '/ajax_sendevent.lhtml'.
The default value is grayed and it's not being saved.

woniol
June 2nd, 2011, 03:30 AM
The Light Control page is not pointed at the Girder server, it's hitting a ZWave protocol server. It's an example of being able to call different servers/services within the same configuration. If you look in the config.xml under the 'pg_zwave' Page you'll see a ButtonGroup (called 'btngrp_zwave_control') with serviceUsername, servicePassword, groupServiceParams, serviceUrl and serviceApi parameters defined. All the Buttons in that one ButtonGroup use this other IP address instead of the default (I think it's actually the same machine but on a different port).

The error messages for network errors needs refinement, as if it gets a connection refused (which is should unless you're running some kind of listener on port 8084) it should say that explicitly, and maybe dump the URL out to the error dialog so you know what it was trying to connect to when it failed. I'll add this to my to-do list, thanks.

Ok, You mentioned that ZWave in your config before. I haven't looked in the config.xml so far.

HTLuke
June 2nd, 2011, 03:50 AM
I had the same 'problem'. All You need to do is go to Menu -> Settings -> Default Service API and write '/ajax_sendevent.lhtml'.
The default value is grayed and it's not being saved.

Good catch, thanks. That grayed text is Android's way of making it a 'hint' to show what format the field expects, but I always thought it was confusing. I'm going to change the actual text of all the hints to say something like "Example:" in front of them so it is a bit more clear.

quixote
June 2nd, 2011, 04:31 PM
Thanks! That works. I now get two events for webserver showing "/ajax_sendevent.lhtml" and one following those with the name of the event. (ie.- PLAY, PAUSE, etc.)

Luke, is that a bug?

HTLuke
June 2nd, 2011, 07:00 PM
Thanks! That works. I now get two events for webserver showing "/ajax_sendevent.lhtml" and one following those with the name of the event. (ie.- PLAY, PAUSE, etc.)

Luke, is that a bug?

No actually that's how the auth works, it hits the page, gets the http response saying that the page is restricted and the client re-attempts the fetch (with the same connection) with the auth values. This is a normal pattern for basic auth.

There's a (more current) way to pre-emptively send credentials with Java on the first call but it's more complicated and I wasn't sure if it's supported by all http servers so I went with the easier approach. SHouldn't see any ill side effect from this method though.

quixote
June 2nd, 2011, 07:21 PM
Good catch, thanks. That grayed text is Android's way of making it a 'hint' to show what format the field expects, but I always thought it was confusing. I'm going to change the actual text of all the hints to say something like "Example:" in front of them so it is a bit more clear.

Actually, I wasn't clear enough, but what I meant was pertaining to the greyed out text. Maybe it would be better to have that as the default, but mention somewhere that it should be changed for other services? Perhaps the app would be more intuitive/easier to use if there was a small help paragraph above each field when you open it to set it.

HTLuke
June 2nd, 2011, 09:26 PM
Actually, I wasn't clear enough, but what I meant was pertaining to the greyed out text. Maybe it would be better to have that as the default, but mention somewhere that it should be changed for other services? Perhaps the app would be more intuitive/easier to use if there was a small help paragraph above each field when you open it to set it.

I'm probably going to work on a configuration wizard that would offer more substantial information about each field. Further, I'm going to likely have a preset selector that fills in the values automatically for known services. This way I can ship Andre with configs built in so people don't necessarily need a web server just to get a config running. A good example of this is the new IP control for DirecTV receivers. I'd like people to be able to download Andre and start controlling their DirecTV DVR without having a web server set up to host the config.xml.

woniol
June 3rd, 2011, 07:22 AM
After some todays tests I get force-close after pressing 'Animated sprite' button in Widgets menu. I'm testing on standard config.xml.

HTLuke
June 3rd, 2011, 10:55 AM
After some todays tests I get force-close after pressing 'Animated sprite' button in Widgets menu. I'm testing on standard config.xml.

Did pressing the animated sprite button work for you at any point before then? I don't see a crash report within the last 24 hours, it must be getting blocked by something, so I don't know the nature of the crash, but since the button works for me with that version and config on the emulator and my two device types, I'm either going to guess it's an OS version issue or a memory problem. What device and OS are you using it on? Can you attempt to trim down a version of the config to just that one button and see if it still crashes? I can supply that config if you'd like.

woniol
June 3rd, 2011, 11:41 AM
Did pressing the animated sprite button work for you at any point before then? I don't see a crash report within the last 24 hours, it must be getting blocked by something, so I don't know the nature of the crash, but since the button works for me with that version and config on the emulator and my two device types, I'm either going to guess it's an OS version issue or a memory problem. What device and OS are you using it on? Can you attempt to trim down a version of the config to just that one button and see if it still crashes? I can supply that config if you'd like.

I test it on HTC Desire HD with Android 2.3.3.
I trimed config to just one button and still get force-close.
I can test Your trimed config to see the results.

HTLuke
June 3rd, 2011, 01:48 PM
I test it on HTC Desire HD with Android 2.3.3.
I trimed config to just one button and still get force-close.
I can test Your trimed config to see the results.

As it happens I'm updating to 2.3 today (until now I didn't have a 2.3 test device), let me run things there and see if it might be an issue with the OS. Otherwise, I'll probably create a special Andre version and config for you to try to better catch what's going on, thanks.

woniol
June 3rd, 2011, 02:18 PM
Ok nice,
I will test it on my wife's SE Xperia X8 later on. I think there is 2.1 version of Android on it.
I will let you know.

woniol
June 3rd, 2011, 03:16 PM
Ok nice,
I will test it on my wife's SE Xperia X8 later on. I think there is 2.1 version of Android on it.
I will let you know.
Unfortunately the same happens on SE Xperia X8 with Android 2.1.

HTLuke
June 3rd, 2011, 03:38 PM
Unfortunately the same happens on SE Xperia X8 with Android 2.1.

I think I received the crash notification for this attempt, and the actual crash-bug is already fixed in the version I'll have posted soon. The code that is trying to execute is where it tries to fetch the sprite image from the server. However the crash bug is just a typo in code that is already handling an error case (instead of bailing out when the error happens, I was re-trying the file fetch in a loop and the stack eventually overflows), so there's still something going wrong. Hopefully fixing this typo and adding a bit of messaging to this error will help.

Are you turning off WiFi/the cell network after loading the config, or have some kind of data guard or malware protection installed on the device that polices access to the net? Considering you're fetching the config.xml file and other button images fine, I don't know why this one would fail.

woniol
June 3rd, 2011, 03:50 PM
I think I received the crash notification for this attempt, and the actual crash-bug is already fixed in the version I'll have posted soon. The code that is trying to execute is where it tries to fetch the sprite image from the server. However the crash bug is just a typo in code that is already handling an error case (instead of bailing out when the error happens, I was re-trying the file fetch in a loop and the stack eventually overflows), so there's still something going wrong. Hopefully fixing this typo and adding a bit of messaging to this error will help.

Are you turning off WiFi/the cell network after loading the config, or have some kind of data guard or malware protection installed on the device that polices access to the net? Considering you're fetching the config.xml file and other button images fine, I don't know why this one would fail.

No, WiFi is on all the time.
I think the problem is with layergfx_spaceSolarEarth.png which is used in the config and is not included in the buttons folder.
I changed it do the png that is in that folder and it works now.

HTLuke
June 3rd, 2011, 04:03 PM
No, WiFi is on all the time.
I think the problem is with layergfx_spaceSolarEarth.png which is used in the config and is not included in the buttons folder.
I changed it do the png that is in that folder and it works now.

Ah, great debugging job. Now that I fixed the infinite-retry bug the pre-existing File Not Found error handling should work properly and will catch that in the future. I must have deleted the wrong version of the sprite file when packaging up the distribution (I have two copies of that same png in my folder for some no-longer-relevent reason).

Oddly, this would have impacted everyone who's tried it and clicked that button, yet yours was the only crash report with that issue. I wonder if some testers don't realize there's a hidden page accessed by the Widgets button. :)

woniol
June 3rd, 2011, 04:27 PM
Thanks for your help. It realy is a new feature and not everyone knows about it.

Are you working on getting girder variable to Andre? Some time ago a found an interesting post: http://www.promixis.com/forums/showthread.php?21165-web-server-sending-events-and-polling-lua-variables
with some examples: http://www.promixis.com/forums/attachment.php?attachmentid=6240&d=1305868872
Maybe you should consider getting variables in JSON format.

HTLuke
June 3rd, 2011, 05:08 PM
Thanks for your help. It realy is a new feature and not everyone knows about it.

Are you working on getting girder variable to Andre? Some time ago a found an interesting post: http://www.promixis.com/forums/showthread.php?21165-web-server-sending-events-and-polling-lua-variables
with some examples: http://www.promixis.com/forums/attachment.php?attachmentid=6240&d=1305868872
Maybe you should consider getting variables in JSON format.

This works to some degree in the version you have now, actually. You call a web service like you already do, and simply add a new Parameter to the Button like this:

<Parameter name="serviceResultVar">myVarName</Parameter>

If the web service returns something it'll get stored in a variable with the name supplied above (myVarName in the example). At its simplest you can easily get Girder to spit out a raw value of a Girder variable as the response (this is basically what ajaxreq.lhtml does that comes with Girder 5). I'm using this right now to get dynamic button labels from Girder based on Girder state. If you want to use something like the above JSON approach, then you'd still do the serviceResultVar step, but then after that you'd run a JavaScript script on it to load the JSON into a JavaScript JSON object and do what you want with the variables in it (inlcuding set other Andre variables that are being used as labels, for example).

I'm cleaning up the last of the big bugs from my latest build and I intend on releasing that sometime tonight. With it, I'm going to do some simple demo configs that demonstrate how to easily get variable values from Girder and use them within Andre. Over the weekend my next two big tasks are to finish Timers and push notification integration. The former will allow you to create any kind of scheduled timer you need which will be perfect for use as a polling mechanism to fetch Girder variables every so often. If you have a 2.2+ device, the latter (Google's cloud-2-device instant notification service) will let you push variables from Girder to the remote pretty much instantly without polling.

Stay tuned!

HTLuke
June 3rd, 2011, 09:51 PM
Version 1.6.3b is here!

The major changes:

- Added more error handling to control Parameter execution path
- Exposed new object in JavaScript: andreCommands for executing Andre functionality from JavaScript
- Fixed several bugs with changing room/location functionality
- Speed up page changes once they've been loaded
- Removed 'Do not purge images' in Settings (replaced with Refresh dialog)
- New control Parameter: triggerButton allows a Button (or script) to trigger another
- Fixed bug with Parameter refresh where boolean Parameters wouldn't default properly
- Changed Parameter execution to happen in the order they are defined (previously their order was not guaranteed)
- Fixed bug in file fetching where receiving errors would re-try indefinitely until a stack overflow force-close happens
- Re-enabled fetching/caching of images for sprite animations immediately so there's no pause when they're triggered
- Prevent Layout mode from being enabled when a config is not yet loaded
- Fixed bug where held Buttons would lose display attributes for a split second (e.g. label would blink away)

Of note are the following:

andreCommands is a new object in JavaScript which exposes the following functions:

playSound(soundId)
vibrate(lengthInMillis)
callWebService(domain, api, username, password, parameters, resultVar)
simulateKeyStroke(keyname)
openLocationPicker()
startSearch()
browserBack(pageId, browserId)
browserForward(pageId, browserId)
browserReload(pageId, browserId)
changeLocation(locationId)
changeState(pageId, buttonId, newState)
setVariable(variableId, newValue) (Same functionality as andreVars.setVariable)
prependVariable(variableId, prependValue)
appendVariable(variableId, appendValue)
launchBrowser(url)
startVoiceSearch()
broadcastToast(message)
executeScript(scriptId, args, associatedButtonId)
loadPreviousPage()
displayPage(pageId, animationId, forceReload)
triggerButton(pageId, buttonId, action, suppressAnims, blendState, suppressControlParams, suppressDisplayParams)

Almost all of the arguements in the above functions are strings, except for vibrate which takes an int, displayPage's forceReload which is a boolean, and triggerButton's last four params which are also booleans. I will be documenting all the JavaScript commands in detail in the documentation, but this should be enough to get started. Here's an example of using a couple of these in a script:


andreCommands.buttonTrigger( 'pg_widgets', 'btn_webLabelDemo', 'touch', false, true, false, false );

andreCommands.launchBrowser( 'http://www.google.com' );



triggerButton is a new Parameter (& an andreCommands function): Using the following convention, one Button can trigger the actions of another, essentially emulating a user initiated action:


<Parameter name="triggerButton">pageId|buttonId[action|suppressAnimations|blendState|suppressContr olParams|suppressDisplayParams]</Parameter>

Required values:
pageId = ID assigned to the page on which the desired Button lives (e.g. pg_directv)
buttonId = ID of the desired Button (e.g. btn_volumeup)

Optional values:
action = one of: DISPLAY, TOUCH, HELDSTART, HELDREPEAT, RELEASE (default TOUCH)
suppressAnimations = true/false whether to play animations if the Button has them defined (default false)
blendState = true/false whether, if the Button is not in default state, to blend the current state with the default state (default true)
suppressControlParams = true/false whether to prevent any Control Parameters to be applied (default false)
suppressDisplayParams = true/false whether to prevent any Display Parameters to be applied (default false)


Fetching variables

Now that execution order of config.xml is done in the order it's defined in config.xml you can clearly plan the logic of Button execution. For example, you can call a web service which saves the result value in a variable, and then call a script to process those contents by doing something like this:



<Parameter name="serviceUrl" action="display">http://192.168.0.6</Parameter>
<Parameter name="serviceApi" action="display">/ajaxreq.lhtml</Parameter>
<Parameter name="serviceResultVar" action="display">girdervar</Parameter>
<Parameter name="serviceUsername" action="display">username</Parameter>
<Parameter name="servicePassword" action="display">password</Parameter>
<Parameter name="serviceParams" action="display">Data=_testvar</Parameter>
<Parameter name="executeScript" action="display">stripLinefeed</Parameter>
<Parameter name="buttonLabel">_%girdervar%_</Parameter>


The above Parameter list for a Button calls Girder's variable-retrieval function (ajaxreq.lhtml) and asks for the value of _testvar. It puts the result into the Andre variable called 'girdervar' and then runs a script defined as 'stripLinefeed' (because ajaxreq.lhtml sends a linefeed with the variable value, and printing that value directly results in an ugly square box at the end of the value). I've defined that script as follows:



<Script id="stripLinefeed">
<![CDATA[
// Note the explicit typing here as a JavaScript string.
// Without this, Rhino thinks the value is a Java string and attempts to
// execute .replace in Java instead.

var oldValue = new String(andreVars.getVariable ( 'girdervar' ));
var newValue = oldValue.replace( new RegExp( "\\n", "g" ), "...");

andreVars.setVariable ( 'girdervar', newValue );
]]>
</Script>


Finally the last Parameter uses the girderval variable as the Button's label. This simple set of Parameters together effectively reads the value from Girder, processes it to strip the linefeed at the end, and makes the variable value show up as the button's label.

Also notice that all Parameters trigger on the 'display' action. This means these Parameters are processed when the button is drawn, not when it's clicked. So when the user changes to the Page that this Button is on, it automatically goes and refreshes its own label value from the Girder variable every time.

That is the most basic way to fetch a variable from a server. You could also do the entire thing in JavaScript as well with the new andreCommands functions (callWebService mostly).

When I finish adding Timer capabilities hopefully over the next few days, you'll be able to set up reoccuring events to trigger these calls as often as you like, effectively polling for Girder state or anything else.

The above examples are pulled from a new set of mini-config.xml files I'm putting together to demonstrate some of the new functionality. I'll post those as soon as I have them cleaned up and ready to go.

If you haven't already, PLEASE take a look through the config.xml and see how things are put together. The format is pretty clean, and there's almost no limit to how you can arrange buttons or trigger functionality. My hope as this moves forward is to provide a large library of pre-configured pages that people can cut-and-paste together to build their remotes with little or no config.xml hand-editing but until then I'd like to encourage people to play with it as much as possible.

The new version can be downloaded here:http://www.buriedaliveinteractive.com/andre/Andre1.6.3b.zip

I'm hoping to get Timers in by the end of the weekend, but I'll be around to troubleshoot and answer questions as well.

woniol
June 4th, 2011, 12:08 AM
Lot's of new stuff in this version.
First two things i noticed:
1. Page changes are much faster on my device
2. Hardware 'Back' button is send twice on every press. It worked fine with 1.6.2.

HTLuke
June 4th, 2011, 12:25 AM
Lot's of new stuff in this version.
First two things i noticed:
1. Page changes are much faster on my device
2. Hardware 'Back' button is send twice on every press. It worked fine with 1.6.2.

I'm glad the page speed-up is noticeable. I'm still looking for places to improve performance. I'll take a look into the back button, though I'm pretty sure I know what's going on. I re-structured the code where hard-buttons call the button functions and I can guess where it's calling it twice. Volume buttons will probably do the same thing.

quixote
June 4th, 2011, 11:19 PM
I'm having major problems reconnecting every time I start Andre up. It's always telling me that there is no connection and that it failed to reconnect. My wireless settings show that I am connected to my network and that all my settings are correct.

HTLuke
June 5th, 2011, 01:33 AM
I'm having major problems reconnecting every time I start Andre up. It's always telling me that there is no connection and that it failed to reconnect. My wireless settings show that I am connected to my network and that all my settings are correct.

Does it ever work, either to download the config.xml or to send web service commands? If not, check the server settings for both the private and public entries and make sure the domain is correct. Have you upgraded to 1.6.3b yet?

quixote
June 5th, 2011, 01:48 AM
I've upgraded and it was only after the change that I was no longer able to trigger events. Server settings are correct. I do not use a public server and I am connected to my LAN. I can log on to the webserver page using my browser over my network and trigger events.
I can also log onto my secure (Insteon) ISY page using my phone's web browser.

HTLuke
June 5th, 2011, 01:51 AM
I've upgraded and it was only after the change that I was no longer able to trigger events. Server settings are correct. I do not use a public server and I am connected to my LAN. I can log on to the webserver page using my browser over my network and trigger events.
I can also log onto my secure (Insteon) ISY page using my phone's web browser.

Can you try uninstalling Andre completely and re-install 1.6.3b? There were a lot of changes in 1.6.3 and I'm afraid something stale is getting stuck in there somewhere.

quixote
June 5th, 2011, 02:22 AM
No difference.
The weird thing is, when I hit refresh I see this is Girder's log:


Time Date Source Details Payloads
03:20:57:251 6/5/2011 WebServer /config.xml
03:21:32:873 6/5/2011 WebServer /buttons/globespin.png
03:21:32:881 6/5/2011 WebServer /agencybd.ttf
03:21:33:115 6/5/2011 WebServer /gembats.ttf
03:21:33:524 6/5/2011 WebServer /pop.ogg
03:21:34:183 6/5/2011 WebServer /buttons/remote_bg_ht.jpg
03:21:34:666 6/5/2011 WebServer /buttons/remote_source_hd_s.png
03:21:34:867 6/5/2011 WebServer /buttons/remote_source_sd_u1.png
03:21:35:036 6/5/2011 WebServer /buttons/remote_source_xb_u2.png
03:21:35:227 6/5/2011 WebServer /buttons/remote_source_src_u2.png
03:21:35:396 6/5/2011 WebServer /buttons/remote_source_blnk_u2.png
03:21:35:575 6/5/2011 WebServer /buttons/remote_btn_orange_sm.png
03:21:35:924 6/5/2011 WebServer /buttons/remote_btn_gray_md.png
03:21:36:088 6/5/2011 WebServer /buttons/remote_btn_red_md.png
03:21:36:270 6/5/2011 WebServer /buttons/remote_btn_green_md.png
03:21:36:633 6/5/2011 WebServer /buttons/remote_btn_green_sm_v.png
03:21:37:181 6/5/2011 WebServer /buttons/remote_btn_blue_md.png
03:21:38:172 6/5/2011 WebServer /buttons/remote_btn_yellow_sm.png
03:21:39:254 6/5/2011 WebServer /buttons/remote_btn_purple_md.png
03:21:40:077 6/5/2011 WebServer /buttons/remote_btn_redcirc_sm.png
03:21:40:266 6/5/2011 WebServer /buttons/remote_btn_yellowcirc_sm.png
03:21:40:426 6/5/2011 WebServer /buttons/remote_btn_greencirc_sm.png
03:21:40:579 6/5/2011 WebServer /buttons/remote_btn_bluecirc_sm.png


Also, I see webserver events every time I switch pages in Andre. As soon as I hit a button it tells me that no connection is detected and it's attempting a reconnect, which supposedly fails.

HTLuke
June 5th, 2011, 02:26 AM
Ok, that certainly means the defaults are set correctly. Did you copy the new config.xml from 1.6.3b over to the Girder server, and if so did you re-edit it to change serviceUsername and servicePassword parameter to your Girder settings? I should really see if I can get more granular error messages for web service errors so they're more helpful for this kind of thing.

quixote
June 5th, 2011, 02:33 AM
I copied the new files over and changed the username and password for each instance of those terms in the config.xml.

HTLuke
June 5th, 2011, 02:39 AM
Do you still have the old config.xml file that was working with 1.6.2b and can you try that one? Or even step back to 1.6.2b and try that as well. I just re-tested the 1.6.3b release on two devices and both are connecting and working properly on my LAN, and I didn't change any connection stuff in 1.6.3b so I'm not sure where to look for the problem. I'm in the middle of a broken build right now but once I fix it up I can try adding some extra logging to help determine the cause.

Oh, when you press a button does Girder show anything at all?

quixote
June 5th, 2011, 03:00 AM
Girder shows nothing.
I will see if I can dig up an old build, but it's getting late, so I'm going to have to hit the sack soon.

quixote
June 5th, 2011, 03:38 AM
Ok, I tried the last config.xml and there was no difference. Then I reinstalled 1.6.2b and it was still giving me problems until I rebooted the phone. I think that it may be my piece of shit phone, but I need some sleep, so I'll have to try updating again tomorrow to see if it works. I seem to have a curse when it comes to gadgets and technology because even when I follow directions religiously, the god damn things seem to just want to mess with me.
I really should just go live in a cave in the woods somewhere, but I'm addicted to technology. It's a love-hate relationship.

I'll let you know how it goes tomorrow. Sorry.

HTLuke
June 6th, 2011, 01:23 AM
Hopefully things are working ok again for you Quixote, let me know if they're not and we can do some further troubleshooting.

I'm working on the next beta version release now. I got the backbone for background timers (one-shot and repeating) in place as well as opened some Intents to allow other apps to trigger functionality and set variables directly (Tasker should be fun to play with; I'm looking forward to configuring Tasker to watch my GPS location and as soon as I get within a mile of home send a command to turn on porch/entryway lights)..

I also fixed the double-press on hard-buttons bug and a bunch of other little things. I just need to do some QA on the timers and add a few more small features to it and I'll release it here. I'm shooting for Wednesday at the latest but weekdays are a bit crazy right now so we'll see. With this release automatic polling for Girder (or whatever) state will be 100% feasible.

By the way, for timers I made some design decisions that I want to get comments on. Considering the way Android applications work and particularly how Andre is architected, a timer's payload is simply a call to trigger any button's arbitrary functionality This does mean that the remote has to be loaded to know what functionality to trigger.

So I designed timers with a few modes. The most polite is to only actually execute the payload when the app is running foreground and the device is not sleeping. The next level, if the device is at another app or is sleeping, to queue up the action until you switch back to (or launch) Andre, when anything queued by timers will get triggered immediately. Finally you can be aggressive and tell the timer to actually wake up the device and switch to/launch Andre automatically to handle the action immediately, but of course if you're doing something else at the time you get ripped away.

I figure the majority of timers will be either to call web services to update state or to do periodic simple UI stuff like switch back to a Page after a period of inactivity. If state gets updated the second you turn on the device or switch back to Andre (assuming the timer has fired in the meantime), is that sufficient?

The alternative is to build a very small sub-set of features (most likely just web service calls that update Andre variables) which I can do totally in the background without even having to load Andre itself, so web service calls/results would be timely, but Andre still wouldn't process any result value until the actual App run the next time.

It'll hopefully make more sense once I get the beta out there for people to play with. Also I really think the best solution for state exchange is push notifications, which is also nearing completion, I just need to figure out how best to let people other than myself push notifications into the channel. I may need to whip up and run a proxy host server.

quixote
June 6th, 2011, 10:13 PM
I think I must have some sort of firewall issue. I'll give it another go when I have some spare time.
Thanks.

vitello
June 7th, 2011, 09:26 PM
HTLuke,

I just started looking at Andre and want you to tell you that you are doing a great job! I have a
Nook Color tablet that I replaced the kernel that I loaded Andre on and it look great. I need to spend
some time learning about web service calls.

Keep up the good work.

HTLuke
June 7th, 2011, 09:37 PM
HTLuke,

I just started looking at Andre and want you to tell you that you are doing a great job! I have a
Nook Color tablet that I replaced the kernel that I loaded Andre on and it look great. I need to spend
some time learning about web service calls.

Keep up the good work.

Hi Vitello, thanks for giving Andre a try! It so happens that my primary hardware target right now (aside from Evos which half my family has) is the Nook, I've got three of them. I have an icon set scaled for the Nook screen if you want it, not that the test icons are anything special to begin with. With Cyanogen 7 and an overclocked kernel the Nook is a great low-cost HT remote.

Hopefully since I test on the Nook you should have a pretty good experience with it. If you find anything that doesn't work or if you have questions/suggestions, please don't hesitate to let me know.

I'll be releasing a new version hopefully by EOD tomorrow (maybe even tonight if all goes well), I will just throw the larger icons in that as a separate directory, it's a good opportunity to demo the image prefix config option anyway (lets you have multiple image sets on your server for supporting multiple different form factor devices simultaneously).

vitello
June 8th, 2011, 09:23 PM
HTLuke,

I'm running Phiremod Nook and love it. I'd be happy to checkout out your scaled icon set for the Nook. I plan on moving my NetRemote setup to the Nook and Andre should save me a lot of time. I'm most of the way through your manual right now, and it is very clear. Great job. I'll probably get to the sample config's this weekend.

One question. What is the proper way to end Andre? I had one problem where Andre kept restarting after I killed it.

Thanks

HTLuke
June 8th, 2011, 10:59 PM
Be aware that the manual is a great foundation for the overall way things work, but it's now outdated by several revisions. 80% of that difference is new functionality where about 20% is stuff that has changed that is not reflected in the manual (mostly changes to specific Parameters). When in doubt check the config.xml in the latest version, it has correctly implemented demos of nearly all the functionality.

I'm likely to release the next version later tonight with full timers and preliminary push notification support. I want to clean up the manual and create a whole bunch of new tutorial scripts over the next couple of weeks.

I usually don't worry about ending Andre, I just switch away from it (it doesn't do any background stuff yet so it totally goes to sleep) and if Android needs more RAM it kills it itself. I'm not sure why it would automatically restart, that very odd. At least not in the version you have. The only thing I've got that auto-executes the Andre client are part of the timer services and I've not released that yet. How are you killing it?

HTLuke
June 9th, 2011, 06:38 AM
Time for a new build!

This release is rougher around the edges than most previous ones, partly because the new features are fairly complex, but mostly because I'm excited to get it into people's hands and I've not cleaned and tested as much as I normally would. I'll have another (more stable and polished) release soon. I'm also going to skimp on the documentation here a bit as well because it's late, but I will elaborate when the polished version is released.

One note: The push notifications require Android 2.2 or above. I still need to add some logic to elegantly disable the feature for 2.1 phones. This release may not work properly or at all for 2.1 phones.


Significant changes:

- Timers
- Push Notifications (alpha)
- Android Intents for variables and button triggering
- BUGFIX: Double trigger for hard-buttons


Timers
Timers can be one-shot or repeating. They can be started automatically when Andre launches or triggered by a Button press. When the time is up, they trigger some Button action. There are a whole bunch of additional capabilities:

- Set a time window to execute within (e.g. timer only works between 1pm and 6:30pm)
- Set a list of days to execute within
- Set a reference time for repeating Timers to align to (e.g. 2:00pm with a 1-hour repeat so it always fires at the top of the hour)
- Whether to wake the device if it's sleeping when the time is up
- Whether to launch/switch to Andre when the time is up
- Control detailed Button behavior, such as suppressing any display-type Parameters (so you don't have to see the Button animate but still get the functionality)

If the device is awake and Andre is the active app the Timer's button-trigger will have an immediate effect. By default, if the device is sleeping and/or Andre is not the active app (or isn't loaded at all) then the Timer action queues up and runs the next time Andre is activated/launched. By setting runIfSleeping and runIfUnloaded to true you can make the device wake up and launch/switch to Andre when the Timer triggers.

Note that the Button behavior triggered by the Timer will not execute in the background; Andre MUST be launched/brought to the foreground to execute the Timer's payload. Most times it is fine to let it queue up and the next time you switch to Andre it'll execute it right away.

If the Timer payload is time critical, then runIfUnloaded and runIfSleeping should be set to true, however if you're using the phone for something else when the Timer triggers, you'll get pulled into Andre so the event can fire.

Here's a partial config example, I'll do an official one with all the permutations with the next release. The included config.xml has demos of this functionality.


<Timers>
<Timer id="testTimer" [delay="30" or repeatFrequency="30"] page="pg_widgets" button="btn_timerDemo" action="touch" locale="default" state="default" runIfSleeping="true" runIfUnloaded="true" />
</Timers>

Adding systemTimer="true" would make this timer start when Andre launches/becomes active. Otherwise, trigger it with a Button using a Parameter like this:


<Parameter name="startTimer">testTimer</Parameter>

There's also a few new Settings options; one to globally enable/disable Timers, and a new Debug option to show verbose info messages when timers are first started and when they trigger.


Push Notifications

This allows messages (button triggers and variable changes) to be pushed to the device from a server without any polling from Andre. The notifications typically happen within three to five seconds (though occasionally I've seen it take up to a minute or two on rare occasions). The device in question must be running Android 2.2 or higher, and must have any Google account associated with the device (the Android Market, Google Talk, Gmail, Google Voice, etc. all count).

To activate and register the device with my server, go into Settings and check the box for 'Push Notifications'. When you exit the Settings dialog, Andre will attempt to associate your account with Google's cloud services on Andre's behalf.

Right now, I've got the framework in place to allow users to update variable values and trigger buttons but it's a hack/prototype. In order to play with this after enabling it, you must do the following:

Touch the Menu button and touch 'More...', and then touch 'Debug'.

In the box displayed should have a long alphanumeric string (something around five lines long). This is your deviceId. If there isn't a long string displayed, cancel the dialog box, go back into settings and un-check the Push Notifications box and press the back button to exit Settings for it to take effect. Then go back in Settings again and toggle it back on. Hopefully this refreshes your ID (click 'Debug' again to check).

Assuming you have the alphanumeric string, go to the Widgets page in Andre (press Menu and click Widgets), notice the Button near the bottom with an in-line variable demo. The variable driving that that text is called 'myfirstvariable' as defined in the config.xml.

Open a web browser on your PC/Mac and enter the following URL:

http://www.buriedaliveinteractive.com/c2dm/sendandrep2dm.php?deviceid=YOUR_DEVICE_ID&action=setvar&varName=myfirstvariable&varValue=Hello!

but replace YOUR_DEVICE_ID with that long alphanumeric string. I know, it's painful (especially since it's case-sensitive) but it was the quickest way to dump the value out to the user for demo purposes. Double-check the deviceId for typos. When you submit the URL it'll read back the deviceId and tell you if it was successful. If not, re-check the deviceId.

If all goes well, the button on the Widgets page should change to 'Hello!' within a few seconds. Of course it doesn't have to be used as a Button label, the variable could be anything (and then you could execute a script on it in Andre to do complex things with it).

You can also trigger a Button press this way:

http://www.buriedaliveinteractive.com/c2dm/sendandrep2dm.php?deviceid=YOUR_DEVICE_ID&action=triggerbutton&buttonPayload=pg_widgets,btn_scriptDemo1,touch,def ault,default,true,true,false,true,true (http://www.buriedaliveinteractive.com/c2dm/sendandrep2dm.php?deviceid=YOUR_DEVICE_ID&action=triggerbutton&buttonPayload=pg_directv,btn_volumeup,touch,defaul t,default,true,true,false,true,true)

The values in the Payload are pageId, buttonId, action, locale, state, suppressAnimations, blendStateWithDefault, suppressControlParams, suppressDisplayParams and triggerEvenIfUnloaded (launch Andre to execute the Button) though only pageId and buttonId are mandatory.


Intents

This one is for real power users. Intents are basically Andoid's way for applications to interact with one another, triggering other apps behaviors and launching viewers/players for various types of content. I've enabled two Intents, one to set variables and one to trigger buttons.

I'm not going to go into a ton of detail on this because it's a bit complicated and requires more documentation than I'm probably capable of right now, sinces it's after 4am :) However the gist of this is you can take an app like Tasker, which is a sort of event scripting engine that listens to all kinds of Android sensors and functions (GPS location, WiFi access point connection, SMS messages, battery level, you name it) and then performs actions based on their state. One of these possible actions is to trigger any Intent.

With Andre's new Intents, I successfully set it up to turn on lights when my phone receives an SMS with certain text in it, and to turn on the porch light when I'm within a mile of home and it's between 7pm and 8am. The possibilities are endless.



New Version Link: http://www.buriedaliveinteractive.com/andre/Andre1.6.6b.zip

This package has a few extra buttons folders in it partially to give people using this on tablets (like Barnes & Noble Nook) native-sized buttons that look a little better, but also to demonstrate a skinning feature that's been around awhile.

By default the http/buttons/* files will be used, but if you've copied the other folders into your Girder http directory, you can go into Settings in Andre and change the "Image Path/Name Prefix" to one of the following: /evo or /nook or /nookstone and then exit Settings, click Menu and Refresh, and select only 'Images', you can basically change the image theme for different sized devices and/or with different graphics.



Whew, sorry for the novel. Hopefully Timers and push notifications starts to bring Andre to a level that is useful for Girder owners. I'm looking forward to feedback! I'm going to spend quite a few hours now cleaning up the new code, finishing and polishing the push notifications, and creating a whole new set of demo configs and documentation.

HTLuke
June 9th, 2011, 04:42 PM
I should have noted that there were several data storage changes with this version (new database tables, etc.) If you are installing 1.6.6b over an older version, the first thing you should do is refresh everything (click Menu, click Refresh and leave everything checked). This forces the db to be recreated with new columns etc.

If you don't do this you will likely encounter force-close issues, and will need to uninstall and then reinstall Andre. I'll try to implement better and more graceful database upgrade paths in the future.

vitello
June 9th, 2011, 09:52 PM
HTLuke,

First of all, please feel free to write as long a post as you want as I'd rather have more info than less.

I installed Andre1.6.6b and I keep getting Force Closures. I uninstalled and re-installed but that hasn't helped. This is on my Nook Color.

When I was having trouble killing Andre I was using Open Advanced Task Killer to do the killing. No problem with leaving Andre running, but I've gotten into the habit of killing apps on my own.

No problem with the manual being out of date already. I'm going to finish it anyway and then read through the thread.

You are doing a great job.

HTLuke
June 10th, 2011, 12:33 AM
Here's a new version with a few changes to stop the crashing hopefully.

http://www.buriedaliveinteractive.com/andre/Andre1.6.7b.zip

This will intentionally delete and recreate all the DB tables Andre uses, as I believe they were getting out of sync for people upgrading. Also I added error handling to some stuff for new installs which appeared to be causing force-closes.

Let me know if your start-up problem goes away.

vitello
June 10th, 2011, 09:29 PM
HTLuke,

The new version works. I needed to reset twice, but now it's stable. The nook buttons look very nice. What do you use to generate your images?

HTLuke
June 10th, 2011, 09:41 PM
Excellent, glad to hear it! Let me know if you run into any other problems.

I'm just using Photoshop for all graphics right now, with a few plugins that I've had for years for texturing and visual effects. I actually created the original set (not 'stone') included with 1.6.6b as a usibility experiment a long time ago, hence the very vivid colors. Considering the drawbacks to an all-touchscreen remote (mostly the lack of tactile feedback) I was testing various ways to compensate by using unique layouts and color choices. This was way back before Andre, on a Nokia N800 and a simple HTML page that triggered Girder functionality.

I created the 'lava rock' buttons a couple of months ago to tone things down a bit for general Andre users because I got a lot of interesting comments on the color scheme. :)

Hopefully once functionality settles down a bit and I can spend more time working on the manual and tutorial/example scripts I'll also make a few starter themes for people to use with more wide range appeal. Andre of course will use whatever you tell it to and users can create/reuse whatever they want, but I'm sure new users just want to dive in and play with the remote and not have to worry about whipping up or going out and downloading button graphics.

vitello
June 10th, 2011, 11:59 PM
HTLuke,

Just to let you know, I'm finding 1.6.7b a bit unstable. It started reporting no network access and then showing errors about not recognizing image file types. Refreshing made things worse. I ended up re-installing, refreshing, killing a few times and then refreshing a lot. It appears to be stable again for now.

HTLuke
June 11th, 2011, 12:03 AM
That's very strange behavior, I've seen the occasional lack of network access before but never errors about not recognizing file types. When you trigger a refresh, do you see the files being requested in Girder's log window? My first guess is there was some brief connectivity issue and somehow it got a partial file downloaded which appears corrupt to Andre when it tries to load it.

Do you know what Andre was doing when the behavior started? Had it already successfully loaded config.xml and loaded/displayed a page of buttons?

vitello
June 11th, 2011, 01:16 AM
HTLuke

I'm trying to duplicate the problem. I see a pattern now to my problems and I think I was wrong with the error message and the stability issue. What the error message was saying was file not found.
I had seen an error about not recognizing file types on 1.6.6b, but this happened before Andre had loaded config.xml and buttons.

I was playing with the Widget Light Control page. When I pressed a button, say on, I got a No Connection error with Andre saying that it couldn't connect. On looking
closer at the messages I see that your Light Control is meant to connect to ZWave which I don't have. So this is a different type of connection issue.

I am having different problems with most of the Widget page buttons. The Animated Sprite button was giving me the file not found error. I again thought that
this was a network error. It wasn't. I am using the nook images and there is no globalspin image in the nook directory. I copied one in and Andre was happy to
animate it. This button now works, but the label went away. The Change Variable label and the Start Timer labels have also disappeared after I first pushed them.

The lable issues look like a couple of simple bugs. I finished the manual and have started going over config.xml. There is a lot of interesting coding in it.

HTLuke
June 11th, 2011, 04:46 AM
Wow, nice debugging work. I keep forgetting to propogate the globe sprite animation image, I had the same issue a few releases ago.

The disappearing labels is a known issue that I'm still trying to decide how to handle, and honestly I've been too excited to finish getting push notifications fully implemented, since I really think that's one of the killer-app features.

Speaking of which, I finally decided to support cloud messaging as a hosted service. I've created http://www.andreapp.com (the site itself is completely sample content right now) which will ultimately become the place for app support and news and ideally downloads from other users of configs, images, scripts, etc.

But for now, I've been writing the code to handle registration of devices from Andre and the call to send a message into the cloud and down to the device. Within the next day I'll be releasing version 1.6.8b which supports this.

When 1.6.8b is out, the steps to use this feature will be as follows:

1. Go to www.andreapp.com and register for an account, wait for me to activate it
2. Sign into www.andreapp.com and go to www.andreapp.com/get_new_token and generate a new auth token for your account
3. On your device, go into Andre Settings and select 'Push Notifications', check the box 'Enable'
4. Enter the email address used for the account on andreapp.com, a string that uniquely describes the device (e.g. 'Evo1'; just needs to be unique for your account for support of multiple devices per user) and the auth token from the site

Once this is done, you should be registered with Google to receive notifications with andreapp.com as the provider. You can use the following to send messages to your device:


http://www.andreapp.com/send_message?email=<your_registered_email>&token=<auth_token>&devicename=<name_entered_in_andre>&action=setvar&varname=<andre_var_name>&varvalue=<your_new_value>
E.g.:


http://www.andreapp.com/send_message?email=smith@gmail.com&token=124780901:sdg8fy0993hd034j2fed&devicename=Evo1&action=setvar&varname=myfirstvariable&varvalue=Awesome+Button

Just set up Girder to send variables/state which you want to use within Andre through this web service and the changes will hit Andre within a few seconds. Once it's all working I'll write a tutorial on the whole process end-to-end including the Girder scripts.

So keep an eye out for 1.6.8b hopefully no later than tomorrow night!

vitello
June 11th, 2011, 12:02 PM
HTLuke,

You are improving Andre faster than I am learning about it. So I am leaving off asking detailed questions until I can catch up. Some of my earlier questions have already been answered in the thread discussions.

HTLuke
June 11th, 2011, 05:58 PM
Haha fair enough. I tend to work in concentrated bursts, then other things take priority for awhile and I go silent for awhile. Right now though I'm getting closer to an actual market release candidate so I'm eschewing pretty much everything else to get there.

rkirmeier
June 13th, 2011, 09:50 PM
Any idea qhy Andre will not install on Honeycomb? Pops up the app installer but can't push the install button when the warning pops up regarding the services it uses.

HTLuke
June 13th, 2011, 09:55 PM
Andre 1.7.0b is now available:

http://www.andreapp.com/downloads/Andre-1.7.0b.zip

This release is almost entirely about push notification functionality and a few small bugs.

Push notifications are now nicely integrated into Andre's Settings menu, and tie automatically to www.andreapp.com. I have added several tools to the website to help demo and debug push notifications, such as an easy form to fill out to cause button triggers and variable changes.

The steps are pretty much the same from the last post I mentioned, but here they are again:

1. Create an account at www.andreapp.com and wait for activation
2. Click the 'Auth Token' link on the home page and generate a new token
3. Run Andre, go to the Settings page for Push Notifications.
4. Fill in the email address used to register on andreapp.com, a unique name string for the device, and the auth token value from the site.
5. Check the 'Enabled' box and exit the preferences.

If all goes well, the device will register with Google's push services and communicate the details to www.andreapp.com within a few seconds. You should be able to click 'Assign Variable Test' on the andreapp home page, select the device name you entered, give it a variable name/value and click 'Send to cloud' and see it update immediately (most of the time) on the device. If there are any errors, they will display on the form.

If you're using the demo config.xml, bring up the Menu and tap the 'Widgets' button to get the page of test Buttons. Go to the Assign Variable page on andreapp.com and enter 'myfirstvariable' for the variable name and some text for the variable value and click Send. The third button from the bottom should update with that text.

For actual Girder run-time use, see the previous post for the send_message web service formatting to call from Girder (or whatever else you're using to update Andre).


This will likely be the last big feature push for awhile as there are lots of little bugs and clean-up work I'd like to focus on. Also I will start releasing clean tutorial config.xml examples for all the latest features, especially timers, scripting and push notifications.

Let me know if you run into any problems, bugs or anything unclear.

HTLuke
June 13th, 2011, 09:58 PM
Any idea qhy Andre will not install on Honeycomb? Pops up the app installer but can't push the install button when the warning pops up regarding the services it uses.

No, but I've not played with Honeycomb much yet. I will try to get an sd card bootable version running for my Nook soon and see what's going on. As far as I know I've not set anything in the app's manifest that would cause that behavior.

rkirmeier
June 13th, 2011, 10:34 PM
Rebooted and it installed! :-)

rkirmeier
June 17th, 2011, 12:48 PM
I'm still struggling to dive into Andre because of the current challenges in passing variables back and forth with any delay but confident in figuring out a soultion. I thought of a really cool feature to request. WHow about a widget that would allow the use of Andre from the desktop? I'm thinking a person would have a special widget configuration with limited regularly used buttons (volume, mute, channel, etc)...

HTLuke
June 17th, 2011, 02:46 PM
I'm still struggling to dive into Andre because of the current challenges in passing variables back and forth with any delay but confident in figuring out a soultion. I thought of a really cool feature to request. WHow about a widget that would allow the use of Andre from the desktop? I'm thinking a person would have a special widget configuration with limited regularly used buttons (volume, mute, channel, etc)...

I'd like to hear more about what you're trying to do and what's not working for you so that I can improve things better. Between the timer support and most especially the cloud push notifications there should be more than adequate support for variable exchange with virtually no delay.

Can you give me some example scenarios where you're trying to pass variables to/from Andre? I'm in the middle of cooking up some clearn Girder-oriented examples of both timers and push notifications for people which should help kickstart people's experimentation, I'll likely have something to post by mid weekend. In the meantime I'd love to help someone wade through the process once to get a feel for where things are unclear or daunting.

That's definitely a great idea, I've dreamed about the widget idea a lot, especially for essential items like volume controls. Ultimately I've ended up deferring the design several times because I wanted to make sure the architecture for the main app was fairly solid and unchanging before layering a dependency on top of it.

rkirmeier
June 18th, 2011, 02:35 PM
HTLuke,
I don't want to use the clould support for variable passing as it's very important that there are no delays. I had explained my setup in earlier post but basically my NR remote has a single set of buttons for everything. I have drop down to select a zone, I have a output button that toggles through outputs (tv, pj, amp) and input buttons that set the input (dvd, music, sat, ps3, etc). Each button then sends the girder code based on the variables (i.e. {ZONE}.{INPUT}.{OUTPUT}.action) which would show up something like "Theater.PJ.DVD.play". Although I probably can do this part with Andre as it is I need to pass variables for things like toggling the INPUT button. If I send TV then some girder code send back the next device for that zone in a variable or the same device if there is only one device. With more real estate on the screen I could probably have discrete buttons for INPUT therefore I would not need to pass the variables back and forth however girder keeps track of last input/outputs in the zones so if I switch between zones girder sets the variables for that zone based on that input and output I used in that zone. Girder also keeps track of last OUTPUT for each INPUT so let's say I push Music (INPUT) it sets the OUTPUT variable to AMP but if I push Sat it would set the OUTPUT to TV. I may however have different combinations of INPUTs and OUTPUTs so I don't want this to be static. So basically I need a way that when I push a button I can send some variables to girder, process those variables and have girder set variables in Andre instantly. I've been thinking about who I could do this with an http response. Probably wouldn't be difficult for a single variable but in many cases girder will set at least 2 variables in NR after a button push. If I had a way to parse out a string I would be easy as that is already what I don't from NR to Girder.

So for an example. I select my Theater zone from a menu in NR. It sends the zone to Girder along with the device ID. Girder looks up the device ID and ZONE then sends back to NR (INPUT = DVD and OUTPUT = PJ). If I push the Sat button girder will look up and see that in the Theater room I last used the TV with Sat and set the variables. So on my remote I be in my theater, have a PJ and TV on and with a single push on the remote (Sat or DVD) it will automatically change the OUTPUT device based on what was last set with that INPUT device.

I hope this helps explain my setup a little. I came up with this after years and years of using NR. It's very dynamic, only requires minimal buttons (mostly 1 layer) and can be expanded or modified very easy. Also gives my a lot of control on the girder side which I like. I think if Andre could talk to EventGhost on Android I would probably use EventGhost to pass the variables and I might eventually switch everything over to EventGhost cause I can't see Girder ever coming out with a native Andriod client for Girder since they refuse to make anything native for NR. Very disappointed in the direction Promixis is taking...


Thanks and keep up the great work...

HTLuke
June 18th, 2011, 04:13 PM
Thank you for the detailed explanation, it gives me a lot to consider. Let me step through your situation and think out loud, and you can confirm that I'm getting the gist of your setup.

Absolutely no criticism is intended from the questions, btw, I think your solution with NR is pretty damn cool considering it makes things "just work" for the end user without a lot of nonsense and complications you normally get from universal remotes. :) I'm just trying to educate myself on the details of your implementation and the decisions behind them so I can accomodate those in Andre as best I can.



I don't want to use the clould support for variable passing as it's very important that there are no delays.

Ok, this makes sense, you need synchronous variable updates because you're not updating some Girder state (e.g. your porch light turns on at dusk via a timer and you want Andre to reflect that state change, or you changed something via another remote and want it to update on all others). The cloud stuff is fast (usually within a second) but there's no guarantee, and I've seen hiccups of 10-30 seconds happen often enough (once or twice a day while testing) that you certainly wouldn't want it for this application.


basically my NR remote has a single set of buttons for everything. I have drop down to select a zone, I have a output button that toggles through outputs (tv, pj, amp) and input buttons that set the input (dvd, music, sat, ps3, etc).

Ok just for my own clarity, in your current config the remote client isn't explicitly tracking input/output state itself; there's two buttons that just says 'advance to next input/output' and that command gets sent to Girder which manipulates the current input/output variable to step to the next one? And Girder sets a variable back in NR to tell it what input/output is currently used. Similarly if you select a zone from NR, it sends that to Girder which replies with the current (last used for that zone) variables for NR to use for the buttons.

One question; do you change something on the NR screen based on the variables to reflect the current input/output, like update a text field or graphic? I ask only because if you weren't, there would seem to be no reason to pass variables back and forth, you could keep all the variables on the server and figure out what button-press does what there instead of in the client.


With more real estate on the screen I could probably have discrete buttons for INPUT therefore I would not need to pass the variables back and forth

Why couldn't you flip to a screen that just lists inputs/outputs and then switches back to the screen when you've selected it, or use drop-downs for input/output like you do for zones?


however girder keeps track of last input/outputs in the zones so if I switch between zones girder sets the variables for that zone based on that input and output I used in that zone. Girder also keeps track of last OUTPUT for each INPUT so let's say I push Music (INPUT) it sets the OUTPUT variable to AMP but if I push Sat it would set the OUTPUT to TV. I may however have different combinations of INPUTs and OUTPUTs so I don't want this to be static.

I'm guessing the above is why you can't just have a drop-down/separate page for inputs/outputs, though you could do some very creative button manipulation triggered off the zone choice to hide/show the relevent inputs/outputs perhaps.


So basically I need a way that when I push a button I can send some variables to girder, process those variables and have girder set variables in Andre instantly. I've been thinking about who I could do this with an http response. Probably wouldn't be difficult for a single variable but in many cases girder will set at least 2 variables in NR after a button push. If I had a way to parse out a string I would be easy as that is already what I don't from NR to Girder.

Definitely would make sense to do as an http response; select the zone on the remote, which posts the web service call, Girder does its thing synchronously and then returns the updated variables as the response. Regarding parsing multiple variables, you have that capability now.

In the button that would change the zone for example, just have the serviceParams Parameter stuff the response into a variable, then below that Parameter on the same Button use a script parameter to run some javascript to parse out the reply as necessary and .setVariable() to all the Andre variables you need changed.



I hope this helps explain my setup a little. I came up with this after years and years of using NR. It's very dynamic, only requires minimal buttons (mostly 1 layer) and can be expanded or modified very easy. Also gives my a lot of control on the girder side which I like. I think if Andre could talk to EventGhost on Android I would probably use EventGhost to pass the variables

Technically Andre is already capable of listenening to EventGhost, but (the last time I looked into it) EventGhost for Android doesn't post a variable payload in it's Android Intent calls so you can't pass data from EventGhost to Andre.

The other direction should also already be feasible because EventGhost has an HTTP plugin so you'd just make your Buttons serviceUrl and related settings point to localhost. But that's worthless until EventGhost can pass data back to apps that it launches in a way that they can be intercepted and processed.

I recently began adding UI-based interaction Parameter calls to do stuff like get text input from the user. I've totally overlooked drop-downs or select lists, which I'll add to my backlog and get implemented very soon.

I'm still waffling on the idea of opening a dedicated listener http server on the device, and someday I may just jump in and do it and see what the impact is. But for almost any use case I've heard, the combo of synchronous http response and cloud push notifications should be quite sufficient, and are more in line with Android's functional design pattern overall (e.g. Android's "deep sleep" battery-saving mode would be rendered useless with a socket being left open all the time, and Android is aggressive at memory management even with services so guaranteeing you stay running is a chore in watchdog timer threads and other bad behavior).

Oh, just letting my mind ramble through the angles on this, if ever there's a situation where one service call sets some server-side computation running but you don't want to wait for the response right then but can reasonably guarantee the results would be ready in a particular time frame (lets say 2 seconds) then another thing you could do is trigger the web service call from a Button, then below that trigger an Andre timer set for 2000ms which goes and simply fetches variable values from Girder. That way you don't have to figure out how to get the input web service call operation to return everything you need synchronously but get an essentially synchronous behavior.

Ok, that's enough pondering for one post. I'm trying to polish up a new build with bug fixes and a few new capabilities but I want to get some clear, real-world examples of the scripting and variables and push/pull notifications in place first. Maybe I'll have something late tonight. :)

rkirmeier
June 18th, 2011, 06:14 PM
Thank you for the detailed explanation, it gives me a lot to consider. Let me step through your situation and think out loud, and you can confirm that I'm getting the gist of your setup.

Absolutely no criticism is intended from the questions, btw, I think your solution with NR is pretty damn cool considering it makes things "just work" for the end user without a lot of nonsense and complications you normally get from universal remotes. :) I'm just trying to educate myself on the details of your implementation and the decisions behind them so I can accomodate those in Andre as best I can.



Ok, this makes sense, you need synchronous variable updates because you're not updating some Girder state (e.g. your porch light turns on at dusk via a timer and you want Andre to reflect that state change, or you changed something via another remote and want it to update on all others). The cloud stuff is fast (usually within a second) but there's no guarantee, and I've seen hiccups of 10-30 seconds happen often enough (once or twice a day while testing) that you certainly wouldn't want it for this application.

I could see using the cloud support for certain things that may bot be triggered by a button but as you can see I need to be sure I get a response in an instant.




Ok just for my own clarity, in your current config the remote client isn't explicitly tracking input/output state itself; there's two buttons that just says 'advance to next input/output' and that command gets sent to Girder which manipulates the current input/output variable to step to the next one? And Girder sets a variable back in NR to tell it what input/output is currently used. Similarly if you select a zone from NR, it sends that to Girder which replies with the current (last used for that zone) variables for NR to use for the buttons.

One question; do you change something on the NR screen based on the variables to reflect the current input/output, like update a text field or graphic? I ask only because if you weren't, there would seem to be no reason to pass variables back and forth, you could keep all the variables on the server and figure out what button-press does what there instead of in the client.


I might have to post a picture. I think you mostly understand it but maybe a little cloudy on a few things.

So on my top of my remote I have a row a buttons. The first button is the OUTPUT button. When pushed it sends a girder request with it's current value and girder responds with the next OUTPUT device in this zone. The label on the button is the value of the variable so it may show "TV" and I push it then it shows "PJ" then I push it and it shows "AMP". The label is the OUTPUT variable which is also used on all other keys to send data to girder.

Next on the top row of buttons is the INPUT device buttons (4). These are SAT, DVD, MP3, PS3. When one of these are pushed it sets the value for the INPUT variable but also tells girder I am changing to that device. For example I push the SAT button and my INPUT variable = SAT and the button send code telling girder I am in the Theater ZONE and INPUT is SAT then girder looks up what OUTPUT device I last used in the Theater for SAT. Girder then sets the OUTPUT variable to, for exmaple, "PJ". Now the OUTPUT button shows "PJ" and the OUTPUT variable is "PJ".

This same type of history logic is used when selecting a zone. Girder will set the INPUT and OUTPUT variables to the last values they had the last time I used that ZONE. So if I am switching between zones it's a single click and I am right back to the same INPUT and OUTPUT I used last time.

Now the rest of my buttons are really very basic. The VOL+ button for example would make a call to girder using variables like for example. The code in the button would look like BUTTON({ZONE}.{OUTPUT}.{INPUT}.play) where I have a event trigger for a script on girder called "BUTTON" and the variables are sent as a payload. So on the girder side the BUTTON script would receive a payload in pld3 of, for example, "Theater.PJ.DVD.play". That one "play" button in the config that works for every zone and every device. 95% of my buttons are like this with just a couple device specific buttons. These are generally turned on my a state control via a variable.




Why couldn't you flip to a screen that just lists inputs/outputs and then switches back to the screen when you've selected it, or use drop-downs for input/output like you do for zones?


A lot of the ideas in my design are to minimize button pushes to control things. I hate it when you need to push 2 or 3 buttons to get something done. So that is why I would not like to use another screen.



I'm guessing the above is why you can't just have a drop-down/separate page for inputs/outputs, though you could do some very creative button manipulation triggered off the zone choice to hide/show the relevent inputs/outputs perhaps.


There are personal and technical reasons. Could my design be altered, yes. But I really don't want to and all logic is on the girder side. All I really need is a good way to pass variables back and forth which sounds like I probably already can do this based on info below.



Definitely would make sense to do as an http response; select the zone on the remote, which posts the web service call, Girder does its thing synchronously and then returns the updated variables as the response. Regarding parsing multiple variables, you have that capability now.

In the button that would change the zone for example, just have the serviceParams Parameter stuff the response into a variable, then below that Parameter on the same Button use a script parameter to run some javascript to parse out the reply as necessary and .setVariable() to all the Andre variables you need changed.


Interesting! I'll have to play around with this. I don't really know javascript so it might be interesting. Any chance you could build a sample button in your next config for passing a single variable back from a http response. At least that would be half the work then I could try to figure out parsing multiple variables with javascript.




Technically Andre is already capable of listenening to EventGhost, but (the last time I looked into it) EventGhost for Android doesn't post a variable payload in it's Android Intent calls so you can't pass data from EventGhost to Andre.

The other direction should also already be feasible because EventGhost has an HTTP plugin so you'd just make your Buttons serviceUrl and related settings point to localhost. But that's worthless until EventGhost can pass data back to apps that it launches in a way that they can be intercepted and processed.


I didn't realize these limitations. I do like the http response method better anyways and with your cloud based stuff I probably wouldn't need to deal with Eventghost at all then. Don't really want to rewrite any girder logic in event ghost anyways!



I recently began adding UI-based interaction Parameter calls to do stuff like get text input from the user. I've totally overlooked drop-downs or select lists, which I'll add to my backlog and get implemented very soon.



Yeah, drop down in very important on my cell phone because of the limited space but on the tab I could probably just layout the zone buttons although I think I have like 8 zones now! :)

Thinking of this and the widget idea I mentioned. Think how cool it would be if a person could take there entire "phone" interface and make it a widget on a tablet desktop! I don't know that I would actually even do a full tablet interface then cause that would be awesome!



I'm still waffling on the idea of opening a dedicated listener http server on the device, and someday I may just jump in and do it and see what the impact is. But for almost any use case I've heard, the combo of synchronous http response and cloud push notifications should be quite sufficient, and are more in line with Android's functional design pattern overall (e.g. Android's "deep sleep" battery-saving mode would be rendered useless with a socket being left open all the time, and Android is aggressive at memory management even with services so guaranteeing you stay running is a chore in watchdog timer threads and other bad behavior).


I can understand that and I think http response for button presses would work great. Other variable needs should fine using cloud services.




Oh, just letting my mind ramble through the angles on this, if ever there's a situation where one service call sets some server-side computation running but you don't want to wait for the response right then but can reasonably guarantee the results would be ready in a particular time frame (lets say 2 seconds) then another thing you could do is trigger the web service call from a Button, then below that trigger an Andre timer set for 2000ms which goes and simply fetches variable values from Girder. That way you don't have to figure out how to get the input web service call operation to return everything you need synchronously but get an essentially synchronous behavior.

Ok, that's enough pondering for one post. I'm trying to polish up a new build with bug fixes and a few new capabilities but I want to get some clear, real-world examples of the scripting and variables and push/pull notifications in place first. Maybe I'll have something late tonight. :)

[/QUOTE]


Thanks again!

HTLuke
June 18th, 2011, 07:32 PM
Ah, thanks for further clarification, I have a much better idea how things are working.

I'm fixing one bug right now related to the pop-up selection list (a piece of the drop-down solution I'm cooking up), and then I'll write up a clean and clear example of the service call to Girder with an http response attached and how to use it. I'll even make it return multiple variables and include a piece of javascript to parse it out into discrete Andre variables. Hopefully that won't take me too long, but I might not have it ready to post until tomorrow afternoon sometime.

rkirmeier
June 18th, 2011, 07:46 PM
That's so awesome! Thanks! My girlfriend is not going to be happy for the next week or so! Lol!

vitello
June 18th, 2011, 10:50 PM
HTLuke,

Very interesting discussion. I'm still working through the Andre config, but I though I would give you some input on one way I use data transfer between my NetRemote system and Girder.

My primary NetRemote page is the one where I control my Insteon switches. I have Insteon switches all over the house plus quite a few wall plugs. All together there are about 40 Insteon devices. To use them
I have a one page floor plan where every device is a separate button. The buttons for lights show up as light bulbs, which change color based on light level. My two fountains change images if they are switched on/off.
So I can tell at a glance what lights are on all over the house and what their levels are. I use lua variables is to keep track of status of each switch, either on/off, level, and if possible whether a device is plugged in. The status
variable for each switch is updated if I make changes directly from NetRemote or if I hear from girder that a switch value was changed directly. How fast the data is updated from girder is very important if I am trying to dim
a light and don't want to overshoot. Also if I change several lights using a Insteon scene command I want all changes to show up smoothly.

HTLuke
June 19th, 2011, 07:37 AM
Hi Vitello,

It's good to hear the details of your implementation, thanks. The more real-world examples I can get my head around, the more I can tailor the design to fit people's needs. Your usage as far as it applies to Andre seems to be about two main areas; how to set/update images based on variables, and how to get those variables set from Girder.

The former is doable in several ways, though there are two that I would consider most viable. Assume for a moment that we solve the second part and we have variables that get set in a timely fashion for each light or plug. With the version of Andre that's available right now, you could insert a variable token into the imageUrl Parameter for each button in order to change the name of the image file you want set, based on the variable name.

Say you have the variable 'light01' in Andre and it gets set with 'on' and 'off' as a value. If you created two images called 'light_on.jpg' and light_off.jpg' and defined the Parameter for the button image like so:

<Parameter name="imageUrl">lightbulb__%light01%_.jpg</Parameter>

You would automatically get the right image whenever the variable changes.

If the variable value isn't directly a value you can reasonably set this way (lets say you get the dim percentage as a value, from 0 to 100 and you certainly don't want to create 100 distinct images) you could first pass the variable through a very short javascript snippet in Andre and normalize it to whatever values you want, something like:

if ( light01 == 0 ) { light01 == 'off'; }
if ( light01 > 0 && light01 <= 25 ) { light01 == '25perc'; }
if ( light01 > 25 && light01 <= 50 ) { light01 == '50perc'; }
if ( light01 > 50 && light01 <= 75 ) { light01 == '75perc'; }
if ( light01 > 75 && light01 <= 99 ) { light01 == '99perc'; }
if ( light01 >= 100 ) { light01 == 'on'; }

The values are arbitrary, and demonstrates how you might have six discrete light level representations on the graphic, which would be named 'lightbulb_off.jpg', 'lightbulb_25perc.jpg' and so on.

This works pretty well, but I don't think it's quite as elegant as I want it to be for a few reasons. Tokenizing an image is hard to read and prone to errors. Also considering that you either have to pre-set the variable to the partial text for the filename or run it through a script to do that work, it could mean a lot of steps if you had a lot of different types of images.

So there's something I had been working on that I've nearly finished up tonight, which is conditional execution for parameters. You can basically now add an 'execIf' or 'execIfNot' attribute to Parameters which contains a true/false equation. When that Parameter is about to take effect, it'll evaluate that equation to determine if the Parameter should be bypassed or not. Also when the variable changes, the Button re-evaluate it immediately. So you can now do:

<Parameter name="imageUrl" execIf="_%light01%_ == 0">/buttons/lightbulb_off.jpg</Parameter>
<Parameter name="imageUrl" execIf="_%light01%_ > 0 && _%light01%_ <= 25">/buttons/lightbulb_25perc.jpg</Parameter>
<Parameter name="imageUrl" execIf="_%light01%_ > 25 && _%light01%_ <= 50">/buttons/lightbulb_50perc.jpg</Parameter>

Which is a lot cleaner. Doesn't have to be numbers either, you can compare strings and do other in-line processing if necessary, provided that the end result is more or less something you could stick into the parenthesis of a javascript 'if' statement, which incidentally is exactly what happens behind the scenes. :)


Anyway, the second half of the problem involves getting the right variables in the first place, which is pretty much exactly what I'll be whipping up a demo of later today using synchronous http responses (when you control a light directly from Andre) and cloud push notifications (for when it gets changed somewhere else and you want Andre to reflect the change), so that should help illustrate the ways to do this efficiently for your usage too.

vitello
June 19th, 2011, 08:52 PM
HTLuke,

It looks like you were reading my mind. I do in fact use six discrete light level images. Currently to get the level data from Girder to NetRemode I use the Girder device manager which automatically sets up
level variables for all of my lights on NetRemote. I then watch for changes for each variable and update the desired image. Putting the light data directly in its button is a clean way to keep track of things. Now
the other part of the problem is getting the variable data from Girder.

I am almost through with the sample config. I've been finding answers to most of my questions as I go along. I have a few unanswered questions I ask with I finish.

HTLuke
June 19th, 2011, 09:20 PM
I've been working on this most of the afternoon, and honestly the biggest hurdle for me has been to learn more of the intricate details of Girder (and refreshing my knowledge of Lua) so I can hobble together an effective demo for you guys. I'm almost finished, just working on the Andre config portion of it now, which should be easy.

My Girder example is going to be a rather boring lhtml file that doesn't do a lot of the intricacies of communicating to the device manager or object state, it deals with global Lua variables right now, but I figure it should be very easy to co-opt that for more Girder-centric actions.

Look for the resulting demo file in about an hour, maybe a bit more if I keep messing with these bulb icons I threw together... :)

HTLuke
June 19th, 2011, 10:45 PM
Wow, almost exactly an hour later! (well it was when I started writing the post...)

Here's the latest version: http://www.andreapp.com/downloads/Andre-1.7.3b.zip

Inside you will find a few new files for the 2-way communication demo. First, there's a file for the server called andre_vars_example.lhtml. This file simply creates a bunch of global Lua variables in the Girder environment representing lights in your config. Just drop this lhtml in your Girder httpd root directory. You can hit this page with your browser and see what it does, which is step through four lights in sequence, setting the selected light to 100%, then the one before it to 50%, the one before that to 25% and the last light to 0%. The result in a browser will be a comma-delimited list of the four values.

Next there are two new config.xml files: config_2way_ex1.xml and config_2way_ex2.xml. The only difference between these two is how the Andre variables are used to choose a light image. One example uses the variable token to directly change the name of the image file and the other uses the new execIf attribute to select between four discrete image Parameters.

The latter can be a bit slower than the former, considering all 16 (four lights by four light levels) logic conditions run when you get the new result from Girder, and I'm looking at ways to speed this up, but it is definitely cleaner from a code readability standpoint.

Put these two files into your httpd root folder as well. I used explicit server values for the IP of the Girder machine, so you'll need to change this. Edit config_2way_ex1.xml (or ex2.xml depending on which one you're trying) and search for 'serviceUrl' and change it to match your own Girder machine's IP.

While you're in there, if you use a username and password for Girder's web server, search for serviceUsername and servicePassword and enter a value instead of it being empty.

Finally, launch Andre with the 1.7.3b version, go into Settings->Server and change the 'Config.xml Path/Name' to one of those filenames instead of the default config.xml. Exit settings and click 'Refresh' from the Menu and leave everything checked.

If all goes well, you should load up a single page with four light bulbs and three buttons. I didn't bother to query the state on-load so the bulbs will all be dark, however if you press one of the three Buttons you will be sending a value to Girder (representing how many times you'd like the light rotation to advance) which calculates the new light level values for each light and returns the comma-delimited values of all four lights. Andre processes these into variables using a short Javascript snippet and the bulb icons should update appropriately.

There's no error checking or other extraneous code here that you'd want for real-world use, but it works fine as a demo.

Let me know if this doesn't work as intended and/or if you have any questions!

Incidentally this version also added pop-up text input windows, pop-up select list windows (for drop-down behavior emulation) and the aforementioned execIf Parameter attributes. I will outline the use of each of these the next time I post an update in the next couple of days; I wanted to get this demo out before the end of the night.

vitello
June 21st, 2011, 12:25 AM
HTLuke,

Thanks for the quick demo. I installed 1.73b and took a quick look at andre_vars_example.lhtml and the sample config files. Firefox didn't like andre_vars_example.lhtml, but it works in Explorer and Chrome. There is a minor
logic error in andre_vars_example.lhtml. If advanceCount is negative the value of _G['_currentLight'] appears to be going negative. I replaced the line
_G['_currentLight'] = math.mod((_G['_currentLight'] + advanceCount), 4)
with
_G['_currentLight'] = math.mod((_G['_currentLight'] + advanceCount + 4), 4)
and the lights are nicely cycling upwards and downwards. Very minor issue.

I noticed with config_2way_ex2.xml, that occasionally the lights wouldn't change after I pushed a button. Pushing the button a second time after waiting resulted to twice the shift. So it looks like the variables were updated after the first button push, but the lights weren't. (By the way I like your light images!)

So overall, this works as intended, but the response is a bit slow. You are doing a great job!

HTLuke
June 21st, 2011, 03:48 AM
Thanks for giving it a try. I did notice the logic issue with negative step values (I didn't even think of handling negative values until after I wrote the lhtml and was putting together the Andre config and thought what the heck, lets see what happens) but I figured it was pretty obvious what was happening and not too much of a hinderance for the demo. :)

I did manage to speed up the behavior quite a bit with some optimizations, and I'm making a second pass at it as well. I'll post a minor revision with those changes in a day or so.

rkirmeier
June 21st, 2011, 02:13 PM
I played around with the Andre a little at lunch and was able to pass some variables! Thanks so much for setting up an example. I would have spent a lot of time on this! I'm going to really dive in tonight! One question... Is there a way to identify a Andre instance/device? I want to be able to run many copies and with my history tracking code I need to be able to lookup by an Andre Instance/device. This could be something I set manually in the settings or just MAC address, etc...

HTLuke
June 21st, 2011, 02:32 PM
I realize the desparate need for more simple examples of functionality, I tend to forget that being so close to it for hours at a time makes it all pretty clear to me but it's quite complicated given all the different pieces, old/missing documentation, etc. Soon I swear I'll stop adding features and go back to documentation and writing examples! I just want to finish optimizing the two-way communication options and finish adding a few custom controls (slider/progress bars, data tables).

Speaking of adding features, I've been meaning to expose some system variables for awhile now, and one of them should be the new 'Device Name' that you set in Push Notifications. It's an arbitrary text field that you set to differentiate your device between others, originally meant specifically for cloud push notification support, but there's no reason it can't be the global Andre instance identifier.

It'll be easy to set a bunch of variable defaults in code for use within the config. I assume you want to be able to pass this information as part of web service calls, so a variable token (i.e. _%andre_DeviceName%_) would work for you?

rkirmeier
June 21st, 2011, 02:50 PM
Sounds good! Only other thing I think I really need is a sample or documentation for the pop-up list and the latest version but it certainly can wait a few days...

HTLuke
June 21st, 2011, 04:47 PM
Here's a quick summary of those new features:


User text input dialog:
This allows you to display a dialog box with a title and message and a text input field. The entered value gets assigned to an Andre variable.


<Parameter name="userTextInput">VARNAME|TITLE|MESSAGE</Parameter>

Example:


<Parameter name="userTextInput">myFirstVariable|Name This Button|Please enter a label to display for this button</Parameter>

which shows a window with the title "Name This Button" and a message in the box of "Please enter a label to display for this button" and when the user enters text and clicks ok, the value entered gets pushed into an Andre variable called 'myFirstVariable'


User select list dialog:
This allows you to display a dialog box with a title and a list of values for the user to choose from. You supply a list of display strings and a parallel list of values and one or two variable names (one for the value that gets selected, one for the display text that gets selected).


<Parameter name="userSelectInput">TITLE|OPT1,OPT2..OPTn|DISPTXT1,DISPTXT2..DISPTXTn| OPTVARNAME[|DISPTXTVARNAME]</Parameter>

example:


<Parameter name="userSelectInput">Choose Your Poison|drink01,drink02,drink03Coke,Pepsi,Vodka|dri nkChoiceVar|drinkChoiceNameVar</Parameter>

which displays a window with a title "Choose Your Poison" with a list of three items, "Coke", "Pepsi" and "Vodka" which are associated (by position in their lists) to three values, "drink01", "drink02", and "drink03". When one of them is clicked (lets say Pepsi), the display text "Pepsi" gets put into Andre variable drinkChoiceNameVar and the associated value "drink02" gets put into drinkChoiceVar.


New Parameter attribute 'execIf'
This optional attribute on any Parameter can be filled with any equation that would result in a true/false outcome including string or numeric comparisons. This field is interpreted by the Javascript engine, so anything valid in Javascript should work here. Consider this as being wrapped in "if (" and ")", which is exactly what is happening behind the scenes. You can use variable tokens here too like _%myFirstVariable%_ to evaluate current Andre variables. Remember if you're doing string comparisons on Andre variable tokens that you need to put quotes around it like so:


<Parameter name="buttonLabel" execIf="'yellow' == '_%myFirstVariable'">Yellow Button!</Parameter>

If there's an error with it, you'll get a dialog box with the error type when it evaluates it.

That should get you started, let me know if there's any questions.

rkirmeier
June 21st, 2011, 07:21 PM
I have a couple odd things going on... Maybe I am just tired and not seeing it... First, I put a print (myVar) in my lhtml file so I could log the incoming variable content in the lua console in Girder. Every time I push the button it prints it twice like I am pushing the button twice. Can't see any reason this would be happening based on the config file or lhtml file. Second strange thing is that I am defining the buttonLabel as variable but I am getting a little square after the text in the label. I don't see any other characters in the lua console on the girder side and I am simply sending text back (not sending a variable contents back yet).

rkirmeier
June 21st, 2011, 07:35 PM
Some more testing leads me to believe the strange character is a CR because I appended a period to the front and back of var when I print it in the lua console I get my last period on the second line. Also regarding the double press issue... I did some basic toggle code (if thens) in my lhtml page and can see that it is in fact triggering 2 calls as my variable changes. I push the button 1 (quick or slow, soft or hard) and it prints the default value then prints the new value that was assigned by my lua code like I simply pressed the button again.

HTLuke
June 21st, 2011, 10:35 PM
Yes the character you are seeing is a newline. If you take a look at the javascript in config_2way_ex1.xml you'll see a regular expression which strips off newline characters from the result. I only briefly searched for an output method from the lhtml which wouldn't add the newline. It was actually a good example of result post-processing in Andre so I just ran with that.

Not sure why you are seeing the double call. Can you post the config.xml and lhtml snippets so I can troubleshoot it?

rkirmeier
June 22nd, 2011, 08:31 AM
Ok, I found the regular expression and that fixed the newline. Sorry I about that!

I have to look into the double query thing some more I guess. The strange thing is that I have a single print statement in the .lhtml page that simply prints the incoming variable and for every single push it prints the original variable and the new variable. Just like if I pressed the button twice as the code is simply toggling the variable data. Yet on the Andre side it toggles the value as you would expect.

When I push the button with the following code I get the follow in the lua console in Girder.
{PUSH BUTTON ONCE}
1
test
2
test

{PUSH BUTTON AGAIN ONCE}
2
test
1
test


It's very simple code at this point.
<%
local myVar
local t = webserver:GetCGI()
myVar = t['zone']
if myVar == '1' then
webserver:print('2')
else
webserver:print('1')
end
print (myVar)
print ('test')
%>

-----------------------------------------------------------------------------------------------------


<?xml version="1.0" encoding="UTF-8"?>
<Remote>
<Locales>
<LocaleDef id="house" name="House"/>
</Locales>
<Settings>
<StartPage>AV Remote</StartPage>
<StartLocale>house</StartLocale>
</Settings>
<Variables>
<Variable id="myButtonLabel">1</Variable>
</Variables>
<Scripts>
<Script id="parseServiceResult">
<![CDATA[
var resultString = new String(andreVars.getVariable('myGirderResult'))
resultString = resultString.replace( new RegExp( "\\n", "g" ), "");
andreVars.setVariable('myButtonLabel', resultString);
]]>
</Script>
</Scripts>
<Pages>

<Page id="AV Remote">
<Parameters>
<Locale id="default">
<Parameter name="labelColor">ffffffff</Parameter>
<Parameter name="labelSize" action="display,release">23</Parameter>
<Parameter name="labelSize" action="touch">33</Parameter>
<Parameter name="labelXOffset">-6</Parameter>
<Parameter name="labelYOffset">-8</Parameter>
<Parameter name="labelShadowRadius">3</Parameter>
<Parameter name="labelShadowXOffset">3</Parameter>
<Parameter name="labelShadowYOffset">3</Parameter>
<Parameter name="labelShadowColor">ff000000</Parameter>
<Parameter name="buttonTintColor" action="touch">FFFF3737</Parameter>
<Parameter name="buttonTintColor" action="display,release">FFFFFFFF</Parameter>
<Parameter name="labelStyle">bold</Parameter>
<Parameter name="labelTypeface">agency</Parameter>
</Locale>
</Parameters>
<Buttons>

<ButtonGroup id="btngrp_background">
<Button id="btn_background" width="fill" height="fill">
<Locale id="default">
<Parameter name="imageUrl">/buttons/remote_bg_ht.jpg</Parameter>
<Parameter name="inactiveElement">true</Parameter>
<Parameter name="scaleType">fitxy</Parameter>
</Locale>
</Button>
</ButtonGroup>

<ButtonGroup id="btngrp_lights" alignParentCenter="true">
<Parameters>
<Locale id="default">
<Parameter name="serviceUsername"></Parameter>
<Parameter name="servicePassword"></Parameter>
<Parameter name="serviceUrl">http://10.0.0.10:82</Parameter>
<Parameter name="serviceResultVar">myGirderResult</Parameter>
<Parameter name="serviceApi">/andre/andre_vartest.lhtml</Parameter>
</Locale>
</Parameters>

<Button id="btn_advance_3" margins="0,50,0,0" alignBelow="btn_advance_2" alignParentHCenter="true" gesture="flightleft">
<Locale id="default">
<Parameter name="buttonLabel">_%myButtonLabel%_</Parameter>
<Parameter name="imageUrl">/buttons/remote_btn_yellow_lg.png</Parameter>
<Parameter name="serviceParams">zone=_%myButtonLabel%_</Parameter>
<Parameter name="executeScript">parseServiceResult</Parameter>
</Locale>
</Button>
</ButtonGroup>
</Buttons>
</Page>

</Pages>
</Remote>

rkirmeier
June 22nd, 2011, 12:13 PM
One more odd thing I just ran into. Using the userSelectInput when I select anything but the first choice I get a "|" (pipe) in the variable before the text. Here is the code.

<Button id="Zone_button" margins="0,25,0,0" width="200" height="50" >
<Locale id="default">
<Parameter name="userSelectInput">Choose a Zone|LR,Theater,Bedroom|Living Room,Theater,Bedroom|Zone|ZoneDisplayName</Parameter>
<Parameter name="buttonLabel">_%ZoneDisplayName%_</Parameter>
</Locale>
</Button>

HTLuke
June 22nd, 2011, 01:40 PM
Hah I think I know what's happening, insidious little bug/feature...

Whenever a variable changes, all Parameters it is referenced in get re-evaluated immediately. This is so you can just update a variable and have it properly display, trigger functionality, etc. with the new value. Since the parseServiceResult script sets myButtonLabel, which is used in the web service call Parameter (serviceParams), it thinks it needs to re-evaluate the Parameter and makes the service call a second time. Since it only updates that one Parameter and not the entire set (e.g. parseServiceResult never re-runs) it only happens once. Also since the label is defined above the web service call and script call, it is getting set before the value changes the second time, and therefore looks correct.

There are a few hacky workarounds for this but in truth I should probably find a way to make Parameter re-evaluation optional when a variable changes. It makes perfect sense for display-type Parameters (labels, font sizes, etc.) but rarely for execution/control-type Parameters.

Here's my thinking; adding a Parameter attribute called 'variableTriggerEval' or something which lets you explicitly state whether or not a Parameters gets flagged for re-evaluation if it contains a variable token that changes. I'd make it default to true for display parameters, and false for control parameters so the 'right' behavior to most users would happen transparently, but people with very specific needs could override it.

Additionally I'm seeing more and more need to expose all the values under the hood on the device for troubleshooting purposes, so another near-term feature I'm adding will be more tools to do things like bring up a list of all defined variables and their values, dump a Button's current state/locale/Parameter list, etc. Eventually this will lead to fully editable layouts on the device too, for those who hesitate to modify the xml.

Regarding the pipe in the variable name, it sounds like a simple string parsing bug, I'll take a look at it right now, thanks for bringing it to my attention.

HTLuke
June 22nd, 2011, 02:19 PM
I can't seem to replicate the pipe character problem, even using your direct code example. It is very possible that I have fixed this bug without even realizing it in the last couple of days. I will clean up my current build and post it for you to try, hopefully later today. If that doesn't work, we can troubleshoot a bit more.

rkirmeier
June 22nd, 2011, 03:48 PM
Excellent and as always thanks for you efforts!!

rkirmeier
June 22nd, 2011, 04:12 PM
Would it be possible to just exclude the 2nd web service call when a variable changes? Couldn't care less about the rest...

HTLuke
June 22nd, 2011, 04:32 PM
Effectively that's what will happen by default, without having to do anything or change the config. I just like leaving the configurability available so the flexibility is there for users that may need it.

rkirmeier
June 23rd, 2011, 12:13 PM
HTLuke - You would really make my day if you released the latest version today! :) I have an entire night to myself to on my Andre config...

HTLuke
June 23rd, 2011, 12:37 PM
Sure I can cut a release with what I've got now. I got side tracked by some optimization work I was doing and re-wrote a bunch of database code which touches a lot of stuff, so I need to run it through its paces a bit more to make sure it's stable again. I'll aim to have it packaged and available in the next four hours unless run into something ugly during testing.

rkirmeier
June 23rd, 2011, 01:58 PM
Thanks for the update!

HTLuke
June 23rd, 2011, 03:23 PM
Ok, here's the latest. This is pretty much just optimizations for scripts and variable handling, a pretty significant database rewrite that saves boot time and some disk space, and the one new Parameter attribute, 'evalOnVarChange'. By default it should behave the way you want it to without setting this (display parameters with variables in them apply immediately when the variable changes, control parameters don't, unless you set evalOnVarChange='true' or 'false':

<Parameter name="buttonLabel">_%myVariable%_</Parameter> -- Updates as soon as the variable changes
<Parameter name="serviceParams">data=_%myVariable%_</Parameter> -- Does not re-call web service when variable changes

<Parameter name="buttonLabel" evalOnVarChange="false">_%myVariable%_</Parameter> -- Does not refresh when variable changes
<Parameter name="serviceParams" evalOnVarChange="true">data=_%myVariable%_</Parameter> -- Does re-call web service when variable changes

I think almost usual situations will "just work" unless you've got a very specific reason to put evalOnVarChange.

Edit: Url is nice to have... http://www.andreapp.com/downloads/Andre-1.7.5b.zip

Let me know if there's any problems, I wanted to get this up before having to turn my attention to other work today so it is not as thoroughly tested as I usually like. I'll be available for a bit to troubleshoot or fix small bugs later this evening too.

rkirmeier
June 23rd, 2011, 09:21 PM
Everything is working great! Really like Andre alot!

Couple questions...
Does Andre support transparent graphics for buttons?
Can I align the text on a button to the left or right of the button?

How do I change the state of an button from a web service call? Or change the state of a button based on the value of a variable like in NR?


Thanks!!

vitello
June 23rd, 2011, 10:28 PM
HTLuke,

You're doing a great job. I'll be out of town and away from my computer so I won't be doing more than observing for a while. One quick question, what image file types does Andre support?

Thanks

vitello
June 24th, 2011, 02:20 AM
It's very simple code at this point.
<%
local myVar
local t = webserver:GetCGI()
myVar = t['zone']
if myVar == '1' then
webserverrint('2')
else
webserverrint('1')
end
print (myVar)
print ('test')
%>


rkirmeier,

I was looking over your example and was wondering about the command webserverint. I couldn't find a reference to it and was wondering exactly what it does.

Thanks for any info.

Peter

HTLuke
June 24th, 2011, 03:02 AM
Does Andre support transparent graphics for buttons?
Yes, use PNG format with an alpha channel for transparency.


Can I align the text on a button to the left or right of the button?
There aren't explicit alignment options (good idea though, I'll add it to the feature todo list), but you can use the x/y offsets to manually tweak it so it's aligned. Obviously a massive pain to do for each button since they'll all be different based on their string lengths, so I'll add horizontal and vertical alignment options soon.


How do I change the state of an button from a web service call? Or change the state of a button based on the value of a variable like in NR?
There are a couple of ways, assuming you mean the official 'state' attribute within Parameters (e.g. <Parameter name="buttonLabel" state="myNewState'.../>)

Changing the state of a button is done with the following format:


<Parameter name="setState">{pageId}!{buttonId}={newState}</Parameter>

You can omit the pageId (and the exclamation mark) if you're changing a button the same page as the button that is calling setState. If you're actually changing the button that is making the setState call you can omit everything and just put the new state.

Assuming the variable will contain the exact state you want when it returns from the web service call with something like this:


<Parameter name="serviceResultVar">myServiceResultVar</Parameter>
<Parameter name="serviceParams">device=4000,action=on</Parameter>

Then you could have a Parameter below these like so:


<Parameter name="setState">pg_tvcontrols!btn_power=_%myServiceResultVar%_</Parameter>

Since this Parameter comes below the web service call, it gets executed afterward and myServiceResultVar will be properly set to the web service response by the time setState gets called. Of course, you'll have to deal with the newline character assuming you're calling Girder (and haven't found a way to output a line without a newline at the end), so you'd really want something like this:


<Parameter name="setState">pg_tvcontrols!btn_power=_$stripLinefeedFromResult$ _</Parameter>

which calls a script in-line and returns the value that is stored in andreResult in Javascript. Therefore your script definition would be:


<Script id="stripLineFeedFromResult">
<![CDATA[
var resultString = new String(andreVars.getVariable('myServiceResultVar') )
resultString = resultString.replace( new RegExp( "\\n", "g" ), "");
andreResult = resultString;
]]>
</Script>
This reads the result variable, strips the newline and returns it in andreResult for in-line usage, which is what we get for calling the script with _$...$_.

That should give you what you're looking for, let me know if you have any difficulties.

HTLuke
June 24th, 2011, 03:05 AM
One quick question, what image file types does Andre support?

Any format that Android supports can be used, which officially are: png (recommended), jpg (acceptable) and gif (discouraged). The parenthetical comments are straight from Android's developer guide. The OS is optimized for and prefer png or jpg files.

rkirmeier
June 24th, 2011, 06:20 AM
For some reason the forum removed the : p (no space) from the code. It's really webserver: print('text') (with no space)

rkirmeier
June 24th, 2011, 06:26 AM
Wow, thanks so much for the samples and code!! I'll give it a try tonight.

rkirmeier
June 24th, 2011, 10:25 AM
Been playing around with some live Android backgrounds and transparent buttons in Andre. Absolutely awesome! I love this application!

HTLuke
June 24th, 2011, 07:48 PM
I noticed some crashes because of a variable token in attribute values (like Button width or height). Right now variable tokens are only evaluated for Parameter payloads. The problem with putting them in attribute values is those aren't really intended to change once they are read in from config.xml and in fact get stored in a more static data structure. I've been giving it more thought, and for the short term could at least allow for a 'constant' value variable substitution at load time, but that would just be a convenience, it wouldn't really offer any new behavior.

rkirmeier
June 27th, 2011, 09:20 AM
Funny you saw that... It would be nice to have some control over width and height at the buttongroup level or by variable for initial layout and re-layout on different hardware but not a big deal...

rkirmeier
June 27th, 2011, 09:33 AM
OK, I spent a lot of time with Andre this weekend and I would first like to say what an outstanding application it is! There are so many things I like about Andre, using Andre on my Evo is leaps and bounds better then anything NR on any hardware. I had been running my NR via RDP on my Evo which worked ok but no hard button support and you couldn't hold buttons down. It's really cool how you can use the Android wallpaper (including live wall papers). For my initial config I used very simple transparent outlined black box type buttons. Even with the very simple buttons it looks really cool cause I can have my live weather wall paper in the background so I know if it's raining, sunny, cloudy, etc without using any actual screen space for the weather. On the tab I'll have more space to work with so I might use the fireworks back ground and have a weather widget. Never the less I really like the feature.

The variable support works perfect and I was able to fully implement (and then some...) of my single layer remote config using variables for all serviceParams. I was also able to rework my smart code so when I push a activity it always goes back to the last output device for that activity. Still having a little trouble with the zone one but I'll get to that in a little bit (think it's a bug with the pop up list).

It can be a little intimidating at first working with the xml text file but once you get a good editor (I used notepad++ it has syntax highlighting) being able to search and/or replace text is priceless. Layout was a breeze this way and the layout mode on Andre works awesome. There is definitely no lack of features in Andre. Very thought out design and just love working with it! IMO so much better then dealing with NR Designer and having to copy configurations over to the PDAs for NR.

rkirmeier
June 27th, 2011, 10:01 AM
Ok, now that I have my little review out of the way I have a couple requests and/or bug fixes...

Bugs:
Found a bug with the userSelectInput option. It seems to call the serviceApi when you first click the button to open the pop menu. Not sure why anyone want the serviceApi call at this point. I would think we would want to set a variable based on the selection then make the serviceApi call with that new variable value. If there would be reason for the former then we really need an option for the latter.

Feature requests/Questions:
1. Control button size by variable or at buttonGroup level as discussed above. Your solution noted above should work great.

2. Would it be possible to set changeState actions at the ButtonGroup level? I have many buttons with the same code because I'm using variables. Seems like it would clean up the code a lot and eliminate a lot of duplicate code, at least in my config.

3. Would be cool to be able to theme via a Andre button. This could be as easy as allowing us to use a variable for the images path therefore one could change the theme with the click of a button. The reason I think this would be good to have it that you could have a high contrast theme and a standard theme. Depending the wallpaper it might be nice to change themes on the fly. For example I may have my weather live wallpaper up where some buttons my be a little hard to see and that is fine for me but if my girlfriend wants to use the remote it would be nice to change to a high contrast theme with the push of a button. Would also be nice to be able to control font colors globally with a button so say you change the theme and it changes the images folder and font color... I am sure there would be more advanced ways to do this but I'm just suggesting a basic version which probably wouldn't take much to implement.

4. Maybe I over looked this but if not I would like to be able to open Android applications with a Andre button. My thought is a little extreme as I would possibly like to set Andre as my default launcher where I have a half dozen of my common applications accessible from Andre. This way it's a single push to get to any common app from Andre and only a Home or back to get back to Andre. There would be Android Home button to launch the Android launcher (LaucherPro in my case). Taking this a step further is there anyway to have a button in Andre that could control which app is the default launcher? Would be sweet that if I sit down for TV I could have a toggle button that would make Andre my default launcher and then switch it back when i toggle the button. The thing is that when I sit down for TV I am using the remote most of the time but want quick access to common apps (email, cams, webbrowser, Droidmouse, Dish app, MediaPortal, Gizmo, etc....). This would give me 1 button push to my favorite apps while my remote is up. Just a thought! :)

5. Ok, back to more important stuff... How can I make a serviceApi call on startup? I'd like Andre to fetch my last zone and devices on startup like I do with NR. Maybe it's there and I didn't see it...

6. How about a quit or exit option under the menu as I have had to force kill it a few times.

Well, that is it for now. What an excellent application and native Android solution for NR replacement to use with a Girder backend. This is the solution I have been waiting for!

rkirmeier
June 27th, 2011, 11:25 AM
One other bug issue...
I have 3 buttons (AMP_button, TV_button, PJ_button) with 2 states (default and ActiveDeviceState). The state does not work on the PJ_button but after a bunch of headaches trying to figure it out I renamed the button to PJ1_button and changed the state calls to reflect PJ1_button instead of PJ_button and it works fine. I should mention that the TV and AMP buttons have the exact same code (other then names) and they work fine. It's just really strange that I can't call the button PJ_button. I would just use a different name but I control these button states by referencing the button with a variable that also is the a button label so I can't have it as PJ1.

Here is the code for the buttons. I get State 'ActiveOutputDevice' does not exist for button 'PJ_button' on Andre when I try to set the state. If I simply change the button name and changeState references to PJ1_button it works... Note that when I push the AMP or TV buttons it also does not correctly set the state of the PJ button to default as it should. In this case there is no error though, it just does happen...

<ButtonGroup id="OutputDevice_buttons" margins="0,0,15,0" alignParentTop="true" alignParentRight="true" >
<Parameters>
<Locale id="default">
<Parameter name="serviceUsername"></Parameter>
<Parameter name="servicePassword"></Parameter>
<Parameter name="serviceApi">/myRemoteDevices.lhtml</Parameter>
<Parameter name="labelColor">00000000</Parameter>
<Parameter name="labelStyle">normal</Parameter>
<Parameter name="labelSize">20</Parameter>
<Parameter name="labelColor" state="ActiveOutputDevice">ffffffff</Parameter>
<Parameter name="labelStyle" state="ActiveOutputDevice">bold</Parameter>
<Parameter name="labelSize" state="ActiveOutputDevice">30</Parameter>
</Locale>
</Parameters>

<Button id="AMP_button" margins="0,0,0,0" width="90" height="50" alignParentLeft="true">
<Locale id="default">
<Parameter name="buttonLabel">AMP</Parameter>
<Parameter name="serviceParams">DeviceId=_%DeviceId%_,Zone=_%Zone%_,InputDevice=_% InputDevice%_,OutputDevice=AMP</Parameter>
<Parameter name="setVariable">OutputDevice=AMP</Parameter>
<Parameter name="changeState" action="release">TV_button=default</Parameter>
<Parameter name="changeState" action="release">PJ_button=default</Parameter>
<Parameter name="changeState" action="release">ActiveOutputDevice</Parameter>
<Parameter name="changeState" action="release" state="ActiveOutputDevice">default</Parameter>
</Locale>
</Button>
<Button id="TV_button" margins="0,0,0,0" width="70" height="50" alignRightOf="AMP_button">
<Locale id="default">
<Parameter name="buttonLabel">TV</Parameter>
<Parameter name="serviceParams">DeviceId=_%DeviceId%_,Zone=_%Zone%_,InputDevice=_% InputDevice%_,OutputDevice=TV</Parameter>
<Parameter name="setVariable">OutputDevice=TV</Parameter>
<Parameter name="changeState" action="release">PJ_button=default</Parameter>
<Parameter name="changeState" action="release">AMP_button=default</Parameter>
<Parameter name="changeState" action="release">ActiveOutputDevice</Parameter>
<Parameter name="changeState" action="release" state="ActiveOutputDevice">default</Parameter>
</Locale>
</Button>
<Button id="PJ_button" margins="0,0,0,0" width="70" height="50" alignRightOf="TV_button">
<Locale id="default">
<Parameter name="buttonLabel">PJ</Parameter>
<Parameter name="serviceParams">DeviceId=_%DeviceId%_,Zone=_%Zone%_,InputDevice=_% InputDevice%_,OutputDevice=PJ</Parameter>
<Parameter name="setVariable">OutputDevice=PJ</Parameter>
<Parameter name="changeState" action="release">AMP_button=default</Parameter>
<Parameter name="changeState" action="release">TV_button=default</Parameter>
<Parameter name="changeState" action="release">ActiveOutputDevice</Parameter>
<Parameter name="changeState" action="release" state="ActiveOutputDevice">default</Parameter>

</Locale>
</Button>
</ButtonGroup>
<!--OutputDevice_buttons-->

</ButtonGroup>

ewingr
June 27th, 2011, 06:59 PM
4. Maybe I over looked this but if not I would like to be able to open Android applications with a Andre button. My thought is a little extreme as I would possibly like to set Andre as my default launcher where I have a half dozen of my common applications accessible from Andre. This way it's a single push to get to any common app from Andre and only a Home or back to get back to Andre. There would be Android Home button to launch the Android launcher (LaucherPro in my case). Taking this a step further is there anyway to have a button in Andre that could control which app is the default launcher? Would be sweet that if I sit down for TV I could have a toggle button that would make Andre my default launcher and then switch it back when i toggle the button. The thing is that when I sit down for TV I am using the remote most of the time but want quick access to common apps (email, cams, webbrowser, Droidmouse, Dish app, MediaPortal, Gizmo, etc....). This would give me 1 button push to my favorite apps while my remote is up. Just a thought! :)

^^^ Definitely.

I'm just discovering this, and just getting started reading the manual. As a result my question may be dumb: First thing I see is that the config stuff needs to be on a web server. Seems odd to me that it wouldn't be stored on the Android Device. (I"M wanting to use on a tablet).

I want to be able to have a Wake on Lan go out and wake the server. Need a button that will run a local app on the device; Need to config to be there when the server is off.

Sounds like neither is possible with this software. Am I incorrect?

[EDIT]
Reading throught the manual now. I do notice that the config gets cached on the device.

HTLuke
June 27th, 2011, 07:38 PM
OK, I spent a lot of time with Andre this weekend and I would first like to say what an outstanding application it is!
Thank you that is very kind of you to say. I'm very glad that Andre has gotten to a point to be genuinely useful for others.


It can be a little intimidating at first working with the xml text file but once you get a good editor (I used notepad++ it has syntax highlighting) being able to search and/or replace text is priceless.
I believe The XML editing is the biggest obstacle to wider adoption. I'll be adding as much on-device editing of Parameters and attributes as possible to help with this as well as a more modular ability to share config snippets so users can trade layouts easily and then customize them.


Found a bug with the userSelectInput option. It seems to call the serviceApi when you first click the button to open the pop menu. Not sure why anyone want the serviceApi call at this point.
Does the Button also have a serviceParams Parameter defined? Thinking about it, there's one gotcha with the user input Parameters that I never really gave much thought; they're modal inputs, but Andre keeps processing Parameters regardless (since the Dialogs are spun up in a different process and run independently of Andre's main code). So it kind of breaks the whole execute-in-order design of Parameters.

Given that they're asynchronous processes it may be too complicated to halt Parameter execution and wait for the dialog to finish, at least not without some significant design changes under the hood.

But there's a few potential workaround or solutions. First, you could define a new Button (no image so it's not a visible, clickable Button) with the service call in it with the variable token as part of the value, and set execOnVarChange to 'true' for the serviceParams Parameter.

As part of the latest release when a variable changes value, Andre will immediately re-evaluate and update any display/visual Parameters but won't trigger any control/functional parameters. However by setting 'execOnVarChange' to true, you can override this behavior, and the serviceParams call would be made after the variable gets set.

Another solution (a new feature) that would make this easier could be an optional parameter on a user input Parameter which specifies the ID of another Button to call once the selection is made. So you'd create one clickable Button in the UI with the userSelectInput as the final Parameter, and a second Button with any actions you'd like to take after the selection is made. The dialog pops up, takes the selection, and calls the second Button (which would probably be imageless so more of a 'function' Button than a UI Button) to do whatever it is you'd like to do with the inputted data.

I'll think about it some more too.


Feature requests/Questions:
1. Control button size by variable or at buttonGroup level as discussed above. Your solution noted above should work great.
Ok, I'll prioritize adding variable support in attributes. It'll still only pick up the variable value at config processing time but if that helps makes things flexible for you, it's quick and straightforward to add.

One question though. Are you mostly just replacing button images with larger/smaller versions for different screen resolutions? If so, you may want to let Andre handle the Button width/height, assuming the image file is already the right size for the given screen resolution. If you create your button images so they're 1:1 for your screen size and just align them against one another they'll flow based on screen real estate and image dimensions automatically. That way you can just swap out the jpg/png for a button and it'll auto re-flow larger or smaller appropriately.

In fact, I intentionally do this for my own setup which consists of Evos, Heros, Evo 3D and Nooks. For the drastically different resolutions (phones vs. tablets) I have different image directories for each. Then in Settings under 'server' there is an option to add an image directory prefix to all (non-absolute) image urls. So on the phones I have it set to /evostone and on the Nooks I have it set to /nookstone. Both directories have the same image filenames, but they're scaled to fit the appropriate screen size.

(Incidentally for the minor screen size differences like the Hero and Evo3D I just use the graphic X/Y scaling in Settings under 'Display' to squeeze the layout up/down to fit).



2. Would it be possible to set changeState actions at the ButtonGroup level? I have many buttons with the same code because I'm using variables. Seems like it would clean up the code a lot and eliminate a lot of duplicate code, at least in my config.
So you'd like to be able to call the changeState Parameter and give it a ButtonGroup ID and have all buttons within that group change at once? I believe that should be pretty easy, and a great idea. I'll add that very soon.

Oh, and I don't remember if I mentioned it in the last post but you can also set multiple states at once with the changeState Parameter. Just separate them with commas like this:


<Parameter name="changeState">btn_1=newState,btn_2=newState,btn_3=newState</Parameter>

That may still be more code than you want, and the ButtonGroup solution is still worth implementing, but if you didn't know about the commas, it should clean things up a bit.


3. Would be cool to be able to theme via a Andre button.
...
Would also be nice to be able to control font colors globally with a button so say you change the theme and it changes the images folder and font color... I am sure there would be more advanced ways to do this but I'm just suggesting a basic version which probably wouldn't take much to implement.
That's a great idea. See the images prefix option mentioned above in Settings which lets you swap out sets of Buttons just like you want, except there's no way right now to do it with a Parameter. I've already exposed some system values as Parameters (e.g. you can set Locales directly from a Parameter) but not that one. I'll add this one right away.

Font color should be doable today with variables. Just define a labelColor Parameter in your Page Parameter list and make its value an Andre variable. Then using the conditional logic (or a javascript snippet) when you change themes you just set the color variable to whatever you'd like.


4. Maybe I over looked this but if not I would like to be able to open Android applications with a Andre button.
...
Taking this a step further is there anyway to have a button in Andre that could control which app is the default launcher? Would be sweet that if I sit down for TV I could have a toggle button that would make Andre my default launcher and then switch it back when i toggle the button. I already have it on my to-do list to allow App shortcuts, but I'll bump it up on the priority list. It was supposed to come after Widget support but Widgets were such a unqiue (and painful) beast to tackle I skipped the app shortcuts piece and never went back. Shouldn't be too hard though.

I'm not sure I can switch the default launcher, Android is very finicky and protective about changing defaults for intents like that. I'll look and see if it's possible.


5. How can I make a serviceApi call on startup? I'd like Andre to fetch my last zone and devices on startup like I do with NR. Maybe it's there and I didn't see it...
There isn't a very clear way to do this, and I may someday add a 'startup' field that will trigger a given Button's behavior on launch. For now there are two pretty workable solutions:

You could use the new(-ish) Timers functionality and set a one-shot timer to call a Button that does what you want; just define the timer with a delay of 0 and set the systemTimer attribute to 'true'. This will start the timer when the app launches and because the delay is 0, it will immediately call the Button.

Alternatively you can set a control Parameter to fire on the 'display' action. When you define a Parameter and don't specify the 'action' attribute, there are two categories of behavior. For anything considered a Display Parmeter (label, colors, image, etc.) the default action is 'display', meaning when the Button is drawn the first time. For any Parameter considered a Control Parameter (web service calls, user input, playing a sound, etc.) the default action is 'touch'. However you can override these. If you create a Button (even if it doesn't have an image and is therefore invisible) with a parameter like this:


<Parameter name="serviceParams" action="display">device=1000,action=bleh</Parameters>

Then when the Button first renders it'll call the web service. Make sure to set all applicable Parameters with the 'display' action (e.g. serviceResultVar, etc.) for it to work properly.

One caviat about this approach is you don't know what page you're going to be on when Andre launches, so you'd have to have this special Button on every page, and that means when you launch the app it'll fire off the service call, but it'll do it again the first time you change to any other page too. Not really a big deal, but not perfect.


6. How about a quit or exit option under the menu as I have had to force kill it a few times.
Funny you mention this one, I was showing someone the wallpaper feature and thought the same exact thing. :)

Continuing in next post....

HTLuke
June 27th, 2011, 07:41 PM
One other bug issue...
I have 3 buttons (AMP_button, TV_button, PJ_button) with 2 states (default and ActiveDeviceState). The state does not work on the PJ_button but after a bunch of headaches trying to figure it out I renamed the button to PJ1_button and changed the state calls to reflect PJ1_button instead of PJ_button and it works fine. I should mention that the TV and AMP buttons have the exact same code (other then names) and they work fine. It's just really strange that I can't call the button PJ_button. I would just use a different name but I control these button states by referencing the button with a variable that also is the a button label so I can't have it as PJ1.

Here is the code for the buttons. I get State 'ActiveOutputDevice' does not exist for button 'PJ_button' on Andre when I try to set the state. If I simply change the button name and changeState references to PJ1_button it works... Note that when I push the AMP or TV buttons it also does not correctly set the state of the PJ button to default as it should. In this case there is no error though, it just does happen...

Ok this is officially a weird one; I'll have to throw this in a config and test it out, I can't see any reason why this would choke. Give me some time to debug it and I'll get back to you.

Thanks again for the time you've taken to give suggestions, bug reports and feedback. There's a near infinite amount of ways people use Girder and implement home automation in general, so having multiple perspectives really helps Andre become the best it can be for the widest audience.

HTLuke
June 27th, 2011, 07:55 PM
^^^ Definitely.

I'm just discovering this, and just getting started reading the manual. As a result my question may be dumb: First thing I see is that the config stuff needs to be on a web server. Seems odd to me that it wouldn't be stored on the Android Device. (I"M wanting to use on a tablet).

I want to be able to have a Wake on Lan go out and wake the server. Need a button that will run a local app on the device; Need to config to be there when the server is off.

Sounds like neither is possible with this software. Am I incorrect?

[EDIT]
Reading throught the manual now. I do notice that the config gets cached on the device.

As you've found, all server files get cached to the device (images, config file, fonts, sounds). You still need a server to pull from the first time though, and I'm aiming to fix that. I'm working on two departures from the client/server dependency in the short to medium term:

First I want to enable loading configs/images directly onto the device either by hand (using USB cable, or favorite file transfer app) or by installing modular additional packages from the market. This way if someone wants to use Andre for something that doesn't require a complicated web server (DirecTV IP control is a fantastic example) then they just install the Andre package, install the DirecTV Layout package and they're good to go.

Second, I want to eventually allow for full layout creation on the device. It'll start with editing Button Parameters and values so you'll have to start with a skeleton layout (which you could get from the first step above). Eventually I want to be able to create/move/align Pages/Buttons/Entities right on the device so people can start from scratch or get a skeleton layout and modify it to their liking.

For your other requirement, I'm going to push up the app-launch capability even higher on my priority list. If you were feeling adventurous, you could try to write an Andre (java)script to make the WOL directly too. And hell a WOL call is a great idea anyway, I'm going to put that on my to-do list as a discrete Parameter feature. :)

HTLuke
June 27th, 2011, 08:18 PM
I happened to catch a crash someone had a few minutes ago while it was trying to make a web service call to /Program Files/Promixis/Girder5/httpd/ajax_sendevent.lhtml. The URL handler didn't appear to like the space in 'Program Files', I should probably run it through a URLEncoder before instantiating the URL object. For now, you can try replacing the space with a plus:

/Program+Files/Promixis/Girder5/httpd/ajax_sendevent.lhtml

ewingr
June 27th, 2011, 08:35 PM
I happened to catch a crash someone had a few minutes ago while it was trying to make a web service call to /Program Files/Promixis/Girder5/httpd/ajax_sendevent.lhtml. The URL handler didn't appear to like the space in 'Program Files', I should probably run it through a URLEncoder before instantiating the URL object. For now, you can try replacing the space with a plus:

/Program+Files/Promixis/Girder5/httpd/ajax_sendevent.lhtml

I'll bet that was me. I put the path to the Girder file in my HTPC, and when I clicked on a button on the tablet, it FC'd. Did it a couple times. I took the path back out. I"ll try entering it again, and add a +, and will report back.

Just finished reading through the manual. I need to try to set something up and see if I can get the most basic thing done. ONe button, and see if it works ;-).

[EDIT]
I put in the + for the space, and it did not FC. Now...I have not done anything at all, so can't test anything else. Just clicked a button on the default page that loads after installing and first running Andre on the tablet.

ewingr
June 27th, 2011, 08:51 PM
OK. I created the Example 1 file from teh manual. Created the following folder and put it there, named it config.xml:

/Program Files/Andre/Test

I put this in the Config.xml Path/Name:

/Program+Files/Andre/Test/config.xml

I get an error that the file does not exist when I try to refresh.

rkirmeier
June 27th, 2011, 09:50 PM
You need to put the config file in the httpd directory for girder. If you want it in a subdirectory then say like andre then your path would be /andre/config.xml

rkirmeier
June 27th, 2011, 10:40 PM
Thank you that is very kind of you to say. I'm very glad that Andre has gotten to a point to be genuinely useful for others.


I believe The XML editing is the biggest obstacle to wider adoption. I'll be adding as much on-device editing of Parameters and attributes as possible to help with this as well as a more modular ability to share config snippets so users can trade layouts easily and then customize them.


Does the Button also have a serviceParams Parameter defined? Thinking about it, there's one gotcha with the user input Parameters that I never really gave much thought; they're modal inputs, but Andre keeps processing Parameters regardless (since the Dialogs are spun up in a different process and run independently of Andre's main code). So it kind of breaks the whole execute-in-order design of Parameters.

Given that they're asynchronous processes it may be too complicated to halt Parameter execution and wait for the dialog to finish, at least not without some significant design changes under the hood.

But there's a few potential workaround or solutions. First, you could define a new Button (no image so it's not a visible, clickable Button) with the service call in it with the variable token as part of the value, and set execOnVarChange to 'true' for the serviceParams Parameter.

As part of the latest release when a variable changes value, Andre will immediately re-evaluate and update any display/visual Parameters but won't trigger any control/functional parameters. However by setting 'execOnVarChange' to true, you can override this behavior, and the serviceParams call would be made after the variable gets set.


Not having any luck with this... You noted execOnVarChange but I think it's suppose to be evalOnVarChange right? Tried both and either will get Andre to make a second call to the webservice after using userSelectInput. I tried it in the same button and in a different button. Must be something different about the userSelectInput that is preventing the second webservice call.



Another solution (a new feature) that would make this easier could be an optional parameter on a user input Parameter which specifies the ID of another Button to call once the selection is made. So you'd create one clickable Button in the UI with the userSelectInput as the final Parameter, and a second Button with any actions you'd like to take after the selection is made. The dialog pops up, takes the selection, and calls the second Button (which would probably be imageless so more of a 'function' Button than a UI Button) to do whatever it is you'd like to do with the inputted data.



I think this would work fine and seems to make logical sense...



I'll think about it some more too.


Ok, I'll prioritize adding variable support in attributes. It'll still only pick up the variable value at config processing time but if that helps makes things flexible for you, it's quick and straightforward to add.

One question though. Are you mostly just replacing button images with larger/smaller versions for different screen resolutions? If so, you may want to let Andre handle the Button width/height, assuming the image file is already the right size for the given screen resolution. If you create your button images so they're 1:1 for your screen size and just align them against one another they'll flow based on screen real estate and image dimensions automatically. That way you can just swap out the jpg/png for a button and it'll auto re-flow larger or smaller appropriately.

In fact, I intentionally do this for my own setup which consists of Evos, Heros, Evo 3D and Nooks. For the drastically different resolutions (phones vs. tablets) I have different image directories for each. Then in Settings under 'server' there is an option to add an image directory prefix to all (non-absolute) image urls. So on the phones I have it set to /evostone and on the Nooks I have it set to /nookstone. Both directories have the same image filenames, but they're scaled to fit the appropriate screen size.

(Incidentally for the minor screen size differences like the Hero and Evo3D I just use the graphic X/Y scaling in Settings under 'Display' to squeeze the layout up/down to fit).



I do understand this... It's just that I was using some images I pulled from the web and did not re-size them. Although I may know the size I need now on my Evo I think this setting would help to figure out what image size works best. IMO this is a low priority request...






So you'd like to be able to call the changeState Parameter and give it a ButtonGroup ID and have all buttons within that group change at once? I believe that should be pretty easy, and a great idea. I'll add that very soon.



I have the following line of code under about 10 buttons and just thought it would be nice if I could define it once under the buttongroup.
<Parameter name="changeState" action="release">ActiveOutputDevice</Parameter>

I'm pretty sure I tried to define it at the buttongroup level and it did not seem to apply to the buttons. What you are saying above would be nice too but not what I am requesting... :)





Oh, and I don't remember if I mentioned it in the last post but you can also set multiple states at once with the changeState Parameter. Just separate them with commas like this:


<Parameter name="changeState">btn_1=newState,btn_2=newState,btn_3=newState</Parameter>

That may still be more code than you want, and the ButtonGroup solution is still worth implementing, but if you didn't know about the commas, it should clean things up a bit.


I didn't know about this and have already updated my code to use it. Thanks for this tip.. BTW... What is the difference between setState and changeState?



That's a great idea. See the images prefix option mentioned above in Settings which lets you swap out sets of Buttons just like you want, except there's no way right now to do it with a Parameter. I've already exposed some system values as Parameters (e.g. you can set Locales directly from a Parameter) but not that one. I'll add this one right away.

Font color should be doable today with variables. Just define a labelColor Parameter in your Page Parameter list and make its value an Andre variable. Then using the conditional logic (or a javascript snippet) when you change themes you just set the color variable to whatever you'd like.

I already have it on my to-do list to allow App shortcuts, but I'll bump it up on the priority list. It was supposed to come after Widget support but Widgets were such a unqiue (and painful) beast to tackle I skipped the app shortcuts piece and never went back. Shouldn't be too hard though.

I'm not sure I can switch the default launcher, Android is very finicky and protective about changing defaults for intents like that. I'll look and see if it's possible.


Yeah, I thought the default thing might be asking too much. The app shortcut option would be great though!



There isn't a very clear way to do this, and I may someday add a 'startup' field that will trigger a given Button's behavior on launch. For now there are two pretty workable solutions:

You could use the new(-ish) Timers functionality and set a one-shot timer to call a Button that does what you want; just define the timer with a delay of 0 and set the systemTimer attribute to 'true'. This will start the timer when the app launches and because the delay is 0, it will immediately call the Button.

Alternatively you can set a control Parameter to fire on the 'display' action. When you define a Parameter and don't specify the 'action' attribute, there are two categories of behavior. For anything considered a Display Parmeter (label, colors, image, etc.) the default action is 'display', meaning when the Button is drawn the first time. For any Parameter considered a Control Parameter (web service calls, user input, playing a sound, etc.) the default action is 'touch'. However you can override these. If you create a Button (even if it doesn't have an image and is therefore invisible) with a parameter like this:


<Parameter name="serviceParams" action="display">device=1000,action=bleh</Parameters>

Then when the Button first renders it'll call the web service. Make sure to set all applicable Parameters with the 'display' action (e.g. serviceResultVar, etc.) for it to work properly.

One caviat about this approach is you don't know what page you're going to be on when Andre launches, so you'd have to have this special Button on every page, and that means when you launch the app it'll fire off the service call, but it'll do it again the first time you change to any other page too. Not really a big deal, but not perfect.

One of these should work fine for me. thanks!

HTLuke
June 28th, 2011, 03:48 AM
OK. I created the Example 1 file from teh manual. Created the following folder and put it there, named it config.xml:

/Program Files/Andre/Test

I put this in the Config.xml Path/Name:

/Program+Files/Andre/Test/config.xml

I get an error that the file does not exist when I try to refresh.

Hopefully what rkirmeier said above helped you get it working, if not please let me know and we can troubleshoot further.

Regarding the proper encoding of URLs, I've revamped the way they're handled and now they should properly auto-encode spaces and other funny characters even in the path. The one slight downside is I've split off the domain from the port. This means first that in Settings you now enter the domain by itself for Public/Private domain (do not put 'http://' before it nor put the port number after it) and there's new fields for port by itself. Second if you're overriding the domain in the config itself using serviceUrl, you need instead to use serviceDomain (again without 'http://' at the front) and servicePort.

This formatting better complies with URL/URI standards and makes for easier and more thorough encoding and handling across the board.

I'll probably spend some more time looking at the weird state bug and fix a few other things and release a new version tomorrow or Wednesday at the latest.

HTLuke
June 28th, 2011, 04:01 AM
Not having any luck with this... You noted execOnVarChange but I think it's suppose to be evalOnVarChange right? Tried both and either will get Andre to make a second call to the webservice after using userSelectInput. I tried it in the same button and in a different button. Must be something different about the userSelectInput that is preventing the second webservice call.
You're right, it's evalOnVarChange. Let me give this a try and see if I can figure it out. evalOnVarChange is brand new so I would not be surprised if there's a bug in there.




I do understand this... It's just that I was using some images I pulled from the web and did not re-size them. Although I may know the size I need now on my Evo I think this setting would help to figure out what image size works best. IMO this is a low priority request...Fair enough and makes perfect sense. I'll see if I can get this added before my next release coming probably Wednesday with bug fixes and a few new features based on your feedback.






I have the following line of code under about 10 buttons and just thought it would be nice if I could define it once under the buttongroup.
<Parameter name="changeState" action="release">ActiveOutputDevice</Parameter>

I'm pretty sure I tried to define it at the buttongroup level and it did not seem to apply to the buttons. What you are saying above would be nice too but not what I am requesting... :)
Ah ok this should most definitely work at the ButtonGroup level the way you're wanting. If it isn't then it's a bug. All Parameters without exception should inherit from a direct parent ButtonGroup and Page. I'll take a look.



I didn't know about this and have already updated my code to use it. Thanks for this tip.. BTW... What is the difference between setState and changeState?
Um, one works and the other is me forgetting what the correct Parameter name is. :D Actually 'setState' is my Java method call for setting the state variable on a Button entity (it's what changeState calls under the hood), so I often slip up and get them confused.

The list of Parameter types is so huge now that I have to have a cheat sheet open when I'm building my own configs. Occasionally I'll be scanning the list and find a cool one I totally forgot I added!

rkirmeier
June 28th, 2011, 08:17 AM
To be sure I am not wasting your time I confirmed the following... When remove the following lines from the button and add them to the ButtonGroup the changeState no longer works on the buttons within that ButtonGroup.



<Parameter name="changeState" action="release">ActiveOutputDevice</Parameter>
<Parameter name="changeState" action="release" state="ActiveOutputDevice">default</Parameter>

ewingr
June 28th, 2011, 08:48 AM
You need to put the config file in the httpd directory for girder. If you want it in a subdirectory then say like andre then your path would be /andre/config.xml

Thanks. I moved the Andre folder and its sub folders to httpd directory, and the screen now comes up. There's a couple other interesting things now.

Again, I am starting very simple: I created the Example1 config.xml file form the manual (I don't see them in any of the files I've downlaoded), and that is what I loaded. The button labels are not showing...just buttons with no lables. NOt sure why that would be.

Another interesting note: Having changed the Program Files to Program+Files to enter the entire path for the Default Service API setting, I get an error ""Web Service API not found". So I changed it to just ajax_sendevent.lhtml, and it FCs, so I added the / in front of that, and now it works. So apparently the posts earlier about the + in the path for Program Files should have been instructions to not enter the whole path.

My next steps will be to try to figure out why no labels, and then see if I can figure out how to get one of othe buttons to actually get one of my Girder commands to do something. I'll go back to the manual and see what I can come up with. I presume it has to do with an action command.

ONe other question: CAn I get my hands on a broader example file? For example the one that comes up on the Android device may be interesting to look at, but it is not in the download. It apparently loads from the apk, but no copy of the file in the download.

[EDIT]
I'm feeling pretty stupid right now ;-) .... I just perused the manual again and don't really see much information on how I get the buttons to trigger events in Girder. Is there some different documentation I need to find on that? I do see that apparentlhy I use Web Service Parameters, but without any examples, I'm pretty lost. I don't have any devices in Girder, at this point. But I have a lot of things there that I can call.

rkirmeier
June 28th, 2011, 09:28 AM
HTLuke,
I'm not getting the systemTimer to work. Here is my code, when I start Andre (refresh or after force kill) I never see the servicecall logged in Girder although when I push the Zone_button I see the servicecall.



<Timers>
<Timer id="startuptimer" delay="0" systemTimer="true" page="myRemote" button="Zone_button" action="touch" locale="default" state="default" />
</Timers>


BTW: Don't waste any time on the PJ_button issue yet. I have been troubleshooting this and if I remove a section of buttons the issues goes away. It may still be a bug but I should be able to narrow it down for you. The reason I say still a bug is because the buttons I am removing don't have any changeState code and having nothing to do with the issue although maybe there is a syntax error somewhere I am not seeing and Andre is not picking it up.

rkirmeier
June 28th, 2011, 09:36 AM
Thanks. I moved the Andre folder and its sub folders to httpd directory, and the screen now comes up. There's a couple other interesting things now.

Again, I am starting very simple: I created the Example1 config.xml file form the manual (I don't see them in any of the files I've downlaoded), and that is what I loaded. The button labels are not showing...just buttons with no lables. NOt sure why that would be.

Another interesting note: Having changed the Program Files to Program+Files to enter the entire path for the Default Service API setting, I get an error ""Web Service API not found". So I changed it to just ajax_sendevent.lhtml, and it FCs, so I added the / in front of that, and now it works. So apparently the posts earlier about the + in the path for Program Files should have been instructions to not enter the whole path.

My next steps will be to try to figure out why no labels, and then see if I can figure out how to get one of othe buttons to actually get one of my Girder commands to do something. I'll go back to the manual and see what I can come up with. I presume it has to do with an action command.

ONe other question: CAn I get my hands on a broader example file? For example the one that comes up on the Android device may be interesting to look at, but it is not in the download. It apparently loads from the apk, but no copy of the file in the download.

[EDIT]
I'm feeling pretty stupid right now ;-) .... I just perused the manual again and don't really see much information on how I get the buttons to trigger events in Girder. Is there some different documentation I need to find on that? I do see that apparentlhy I use Web Service Parameters, but without any examples, I'm pretty lost. I don't have any devices in Girder, at this point. But I have a lot of things there that I can call.

Roger,
I would take a different approach... You should load up the sample config provided to get things working initially then try creating your own config.xml. Too many possbile issues to address the way you are doing it.

ewingr
June 28th, 2011, 10:24 AM
OK. I'll take your advice.

I'll tlry ceating one button, with one label, and see how it goes.

I am still curious about other docs or samples, to help understand how to get commands to Girder. I'm not seeing that from the manual.

By the way, I copied the DTD file from the manual into Notepad ++, and ran the verify on it, and it fails. So I"m thinking maybe the DTD in the manual may have an error. I"m not positive yet how to use that once its good. I have installed the plugin for Notepad ++ for DTD checking. I presume the schema file should pass an XML syntax validation.

HTLuke
June 28th, 2011, 10:46 AM
To be sure I am not wasting your time I confirmed the following... When remove the following lines from the button and add them to the ButtonGroup the changeState no longer works on the buttons within that ButtonGroup.



<Parameter name="changeState" action="release">ActiveOutputDevice</Parameter>
<Parameter name="changeState" action="release" state="ActiveOutputDevice">default</Parameter>


I actually think I know where the problem may lie, seeing your code. It has to do with more than one of the same type of Parameter in ButtonGroups. I'll try to debug and fix this tonight. Thanks for doing the additional testing.

rkirmeier
June 28th, 2011, 10:53 AM
HTLuke -

MAJOR ISSUE!

I loaded up a bad config and every time I open Andre it crashes. I tried clearing data, rebooting the phone, and even removed and re-installed. Still crashes and I think it's still trying to load the cached config because it refers to a lcd font I used which can't be found. How can I clear the cached files??

rkirmeier
June 28th, 2011, 11:00 AM
I think I had an issue with cut and paste from the manual because the quotes came over weird. When I replaced them it worked fine.

To tigger a girder communication event using the 'ajax_sendevent.lhtml' serviceApi (default under global settings) do this...



<Parameter name="serviceParams">device=232,event=VOLUP</Parameter>


This assumes you have the "VOLUP" Girder communication server event attached to Volume up action in girder.

HTLuke
June 28th, 2011, 11:01 AM
Thanks. I moved the Andre folder and its sub folders to httpd directory, and the screen now comes up. There's a couple other interesting things now.

Again, I am starting very simple: I created the Example1 config.xml file form the manual (I don't see them in any of the files I've downlaoded), and that is what I loaded. The button labels are not showing...just buttons with no lables. NOt sure why that would be.
Unfortunately, the examples are a bit outdated, and so is the documentation at this point. I've been adding features (and refactoring a lot of how things operate) pretty rapidly since I did that documentation pass, so I'd trust the included config file more than the examples or documentation. Also the DTD is indeed very stale at this point. Now that I have a pretty feature-stable version (well, relatively anyway) I will be spending the next several weeks revamping the documentation and creating all new examples.


Another interesting note: Having changed the Program Files to Program+Files to enter the entire path for the Default Service API setting, I get an error ""Web Service API not found". So I changed it to just ajax_sendevent.lhtml, and it FCs, so I added the / in front of that, and now it works. So apparently the posts earlier about the + in the path for Program Files should have been instructions to not enter the whole path.I thought about mentioning this, and sorry I didn't; I thought perhaps you had set your Girder root web directory to C:\. It would definitely be best to have Girder's web server up and running and accepting commands from your browser before trying to get it to work in Andre, as you'll have a better understanding of where things map to within Andre's configuration.


My next steps will be to try to figure out why no labels, and then see if I can figure out how to get one of othe buttons to actually get one of my Girder commands to do something. I'll go back to the manual and see what I can come up with. I presume it has to do with an action command.Definitely also take the included config.xml and start there (or with a piece of it). Andre is designed to be server agnostic and can speak to any web service, so the first round of docs don't go into detail about any specific server it may talk to. I personally use Girder and the development config.xml is 80% Girder-centric though, so using it will get you a long way to something functional. The release documentation will have documentation and code examples specifically for a variety of servers including Girder.


ONe other question: CAn I get my hands on a broader example file? For example the one that comes up on the Android device may be interesting to look at, but it is not in the download. It apparently loads from the apk, but no copy of the file in the download.Which version did you download? I believe 1.7.5b (http://www.andreapp.com/downloads/Andre-1.7.5b.zip should have come with three config examples; config.xml is the huge demo config with almost all Andre functionality demonstrated, and two 2way communication demo xmls explicitly made to show how to pass variables back and forth between Girder.

HTLuke
June 28th, 2011, 11:05 AM
HTLuke,
I'm not getting the systemTimer to work. Here is my code, when I start Andre (refresh or after force kill) I never see the servicecall logged in Girder although when I push the Zone_button I see the servicecall.



<Timers>
<Timer id="startuptimer" delay="0" systemTimer="true" page="myRemote" button="Zone_button" action="touch" locale="default" state="default" />
</Timers>


Can you try a delay of 1 instead? I've not had time to check but there's a possibility I don't init the timer with delays of 0. Otherwise I'll replicate this and give it a look tonight.


BTW: Don't waste any time on the PJ_button issue yet. I have been troubleshooting this and if I remove a section of buttons the issues goes away. It may still be a bug but I should be able to narrow it down for you. The reason I say still a bug is because the buttons I am removing don't have any changeState code and having nothing to do with the issue although maybe there is a syntax error somewhere I am not seeing and Andre is not picking it up.

Ok, thanks. I'm absolutely thrilled to have real-world usage happening (and the bugs/suggestions that come from it), so I don't mind tracking down things that may be red herrings. Even those may give me ideas of where to make things more clear or need a new feature. Let me know what you find and I'll look into this one further myself.

HTLuke
June 28th, 2011, 11:08 AM
HTLuke -

MAJOR ISSUE!

I loaded up a bad config and every time I open Andre it crashes. I tried clearing data, rebooting the phone, and even removed and re-installed. Still crashes and I think it's still trying to load the cached config because it refers to a lcd font I used which can't be found. How can I clear the cached files??

Yikes, you can browse the SD card with your PC (or an Android file browser like Astro or EStrongs) and delete the 'Andre' folder from the SD card. I thought I fixed the issue with uninstalling clearing everything out, but I guess not. Sorry about that.

rkirmeier
June 28th, 2011, 11:13 AM
That did it. Thanks, figured it was as easy as this but didn't know if this was the folder... Does anyone actually have an android phone without Astro? lol!

rkirmeier
June 28th, 2011, 11:21 AM
The timer seems to be working now that I cleared all data and deleted the folder...

HTLuke
June 29th, 2011, 04:05 AM
The timer seems to be working now that I cleared all data and deleted the folder...

That's good. I have a feeling that there's a problem somewhere with clearing out old data when refreshing the config. I've seen odd left-over behavior sometimes, but I've not been able to cleanly reproduce it.

HTLuke
June 29th, 2011, 06:45 AM
I've fixed a few bugs (most visible being the unencoded URLs mentioned earlier, but a few other small ones) and I've added two new features: App shortcut launching and native wake-on-lan support.

For app shortcuts, you simply supply the name as it appears in the app drawer and it'll attempt to scan the package list on the device and launch the main activity. I currently do not have any advanced functionality (no data passing to the app, no alternative activity launching, etc.) but I'll be looking into limited options down the road. For WOL support, it's simply a Parameter that takes the broadcast IP address (e.g. 192.168.0.255) and the MAC address of the machine you wish to wake up and it does exactly what you'd expect.

I have three more bugs to fix (changeState not working in ButtonGroup, better sd card cleanup on un/reinstall, and evalOnVarChange properly calling serviceParams when a variable changes) and three features I'm trying to finish up (userXXXInput method can chain a Button action after the user input is complete, a menu item to kill/restart Andre, and reading variable token values in relevent attributes).

I'm hoping I can get all of this done by the end the day tomorrow (Wednesday), I'm shooting for a build to test and release by then. I'm going to be working a bit more sporadically over the next couple of weeks as I've got another project that I need to work on, but please keep posting suggestions and bugs you find, I will be reading the forum and responding as often as I can.

rkirmeier
June 29th, 2011, 08:34 AM
Couple things to report... I'll list them in the priority of impact for me.

1. This is a new issue but now that i am actually using the app instead of just developing the config it has become an issue. If I put app in the back ground for more the 5 min (est) then open it, Andre goes through the process of loading the configuration which is a real pain to wait for all the time. If I am watching tv it happens often cause I will open other apps and go back to Andre in about 15-20min.

2. I think you are working on the userSelectInput and evalOnVarChange but what I found is that if I don't use evalOnVarChange is that it makes a single webservice call the moment I push the button to bring up the selection. If I use evalOnVarChange='true' then it make 2 calls when I push the button whereas we were hoping the second call would be after the selection. I think the option you mentioned to add a parameter to the userSelectInput that would call a another button would be great. Only catch is that we need to make sure we can capture the webservice result and process it via the called button. In my case I need to basically send the variable from the selection to girder then process the girder result to change some states/variables.

3. Can a variable set the locale? Haven't tried it but was thinking about this on my way to work this morning. I don't really use locales because my config at this point is 1 page. Yes, 1 page and 1 locale for all devices. That's the great thing about the way I use variables to send the girder communications. I do however have a need to a few completely unique buttons for a few devices/activities. In NR I all my main buttons on a overlay page that was visible by all pages so on the specific activities that i needed extra buttons I created a page and simply added the 2 or 3 buttons I needed which would either add to or cover up the overlay buttons. Was thinking I could do this with the locale option but since I set my zones via a button and variables (instead of menu and locales) I would like to be able to set the locale via a variable. Maybe I can already do this and just wasted a lot of typing... :)

4. A strange issue I ran into that you may want to look into is in the following code I had to put the serviceResultVar in the ButtonGroup instead of the Startupservice_button button otherwise the values ended up be null or undefined. Really threw me off for a while but that the reality of beta software. Glad to help find the bugs..



<ButtonGroup id="Zone_buttons" alignParentTop="true" alignParentLeft="true">
<Parameters>
<Locale id="default">
<Parameter name="serviceUsername"></Parameter>
<Parameter name="servicePassword"></Parameter>
<Parameter name="serviceResultVar">myGirderResult</Parameter>
</Locale>
</Parameters>

<Button id="Zone_button" margins="0,0,0,0" width="200" height="50" >
<Locale id="default">
<Parameter name="changeState">_%InputDevice%__button=default</Parameter>
<Parameter name="changeState">_%OutputDevice%__button=default</Parameter>
<Parameter name="buttonLabel">_%ZoneDisplayName%_</Parameter>
<Parameter name="userSelectInput">Choose a Zone|LR,Basement,Theater,Bedroom,Office,Garage,Pat io,Firepit,ALLMUSIC|Living Room,Basement,Theater,Bedroom,Office,Garage,Patio, Firepit,All Music|Zone|ZoneDisplayName</Parameter>
<Parameter name="labelXOffset">-10</Parameter>

<Parameter name="serviceApi">/myRemoteDevices.lhtml</Parameter>
<Parameter name="serviceParams">DeviceId=_%DeviceId%_,Zone=_%Zone%_,Command=Zone_b utton</Parameter>-->
<Parameter name="executeScript">setDevices</Parameter>
<Parameter name="changeState">_%InputDevice%__button=ActiveInputDevice,_%OutputD evice%__button=ActiveOutputDevice</Parameter>
</Locale>
</Button>

<Button id="Startupservice_button" width="0" height="0">
<Locale id="default">
<Parameter name="changeState">HDTV_button=default,DVD_button=default,MOVIES_butt on=default,VIDEOS_button=default,Music_button=defa ult</Parameter>
<Parameter name="changeState">TV_button=default,PJ_button=default,AMP_button=def ault</Parameter>
<Parameter name="serviceApi">/myRemoteDevices.lhtml</Parameter>
<Parameter name="serviceParams">DeviceId=_%DeviceId%_,Zone=_%Zone%_,Command=Startu p</Parameter>
<!--<Parameter name="serviceResultVar">myGirderResult</Parameter>-->
<Parameter name="executeScript">setDevices</Parameter>
<Parameter name="changeState">_%InputDevice%__button=ActiveInputDevice,_%OutputD evice%__button=ActiveOutputDevice</Parameter>
</Locale>
</Button>

</ButtonGroup>


5. Yesterday I was trying to isolate the PJ_button state issue and found that if I removed most of my buttons the issue went away. I'll work on further isolating this but I don't suspect it's an obvious syntax error as Andre is quick to recognize syntax errors. I do have another strange issue that I am started to wonder if it's related. I have a couple inactive buttons with labels that are just dashes that I using as a horizontal rule. When I first open Andre this HR is often across 2 lines but if I refresh the config it displays as I would expect. I'll work on further isolating these issues and put up some code when I find the culprit if it's not an issue in my config.

Can't think of anything else right now. Looking forward to the next release with the app launching. Hope you can address the first 2-3 things above also since my configuration would have high dependence on these. I'm also thinking my posting a basic version of my config. I would remove all the back end (girder) variable passing which is just for history/memory of InputDevices/OutputDevices/Zones.

rkirmeier
June 29th, 2011, 10:02 AM
HTLuke,
A couple releases ago you talked about Intents but I don't see any examples of it. Could you put up a brief example of the Intent to use in Tasker that would set a variable and trigger a button.

HTLuke
June 29th, 2011, 02:27 PM
HTLuke,
A couple releases ago you talked about Intents but I don't see any examples of it. Could you put up a brief example of the Intent to use in Tasker that would set a variable and trigger a button.

Sure, it's pretty straight forward. In Tasker, create an Action Intent task. Set the 'Target' drop-down to 'Broadcast Receiver' and set the Action field to:

com.buriedalive.andre.ISSUE_COMMAND_BUTTON (for triggering a Button)

or

com.buriedalive.andre.ISSUE_COMMAND_VARIABLE (for assigning an Andre variable)


The data to pass into Andre will go in the first 'extra' field. Tasker's format for passing data with the intent is extrasName:value. Our extras name for button triggering is 'payload', and for variable setting its 'variable_payload'. The value is a packed data structure separated by commas.

For Button triggering the data structure is:

pageId,buttonId,action,locale,state,suppressAnims, blendState,suppressControl,suppressDisplay,runIfUn loaded

Only the first two (pageId and buttonId) are required, the others are optional. Here's what all those fields should be for Button triggering:

pageId: ID of the page your Button is on
buttonId: ID of the Button to trigger
action: Action to trigger ('display','touch','heldstart','heldrepeat' or 'release')
locale: Locale ID to trigger (or 'default', which is the default)
state: State name of the Button to trigger (or 'default' which is the default)
suppressAnims: true or false (default is false) Should Button animate when it triggers
blendState:true or false (default is true) If state above is not 'default', include the default state too (default gets applied, then specified state values overrides default values)
suppressControl: true or false (default is false) Bypass all control-type Parameters when triggered
suppressDisplay: true or false (default is false) Bypass all display-type Parameters when triggered
runIfUnloaded: true or false (default is false) If Andre is not the current foreground app, if this is true then it is launched and brought to the foreground immediately to handle this event. If this is false, the action is queued up and waits until the next time Andre is launched before it gets processed.

Examples:


payload:pg_directv,btn_volumeup
payload:pg_directv,btn_volumeup,touch,default,defa ult,false,true,false,false,true
(the latter would launch Andre if it isn't already the foreground app)


For variable setting the format is:

runIfUnloaded,andreVarName,newVarValue

All three values are required. They are pretty obvious:

runIfUnloaded: true or false (default is false) If Andre is not the current foreground app, if this is true then it is launched and brought to the foreground immediately to handle this event. If this is false, the action is queued up and waits until the next time Andre is launched before it gets processed.
andreVarName: The name of the variable in Andre to set
newVarValue: Whatever you wish the Andre variable to be set to

Examples:


variable_payload:false,myfirstvariable,some data here
variable_payload:true,myfirstvariable,some data here
(the latter would launch Andre if it isn't already the foreground app)


That's about all there is to it. Let me know if any part of it is unclear.

HTLuke
June 29th, 2011, 03:28 PM
If I put app in the back ground for more the 5 min (est) then open it, Andre goes through the process of loading the configuration which is a real pain to wait for all the time. If I am watching tv it happens often cause I will open other apps and go back to Andre in about 15-20min.
This one is tricky because of the way the OS does memory management. Android keeps apps in memory as long as it can; as memory begins to fill up because there are too many apps loaded, it starts to tell them to shut down. Apps are expected to be able to start and stop completely on demand, from memory or from storage, and have a chance to save their state so they can re-open right where they left off.

On My Evo4G I can usually switch to the browser or IMDB or something and switch back and it'll still be loaded. If I open a lot of little stuff, play any games or do a lot of browsing, it often needs to re-launch.

On the Evo3D, which has considerably more memory, I can do almost anything and it stays loaded. It's actually kind of creepy because once I run it, it's always there and runs instantly. The 3D feature is a neat toy (at least right now) but the real upgrade over the Evo4G is the massive RAM and the dual-core processor. Not that I'm suggesting that this problem alone warrants an excuse to upgrade... ;)

It is possible that you have apps installed that are silently waking up periodically to do some work in the background and push Andre out of memory even faster. There's not a lot you can do about this if you need all those apps, though it's always worth scanning through and cleaning them out once in awhile.

As a fairly extreme option on the Andre end, I have considered making Andre tell the OS that it is a full 'background' service which would keep it alive until memory is critically low, but that may adversely impact the performace of the phone. I'd make it a configurable setting so we can experiment with it.


2. I think you are working on the userSelectInput and evalOnVarChange but what I found is that if I don't use evalOnVarChange is that it makes a single webservice call the moment I push the button to bring up the selection. If I use evalOnVarChange='true' then it make 2 calls when I push the button whereas we were hoping the second call would be after the selection. I think the option you mentioned to add a parameter to the userSelectInput that would call a another button would be great. Only catch is that we need to make sure we can capture the webservice result and process it via the called button. In my case I need to basically send the variable from the selection to girder then process the girder result to change some states/variables.
Ok that behavior is definitely not expected, I'll run it through some debugging because it really should be getting called after the dialog box closes. Of course, you still have the problem of the service being called before the input selection is made, so I still like that Button execution approach. The variable you catch the input in and the variable you catch from the web service call will both persist until updated, so it should work as you desire.


3. Can a variable set the locale?
...
Maybe I can already do this and just wasted a lot of typing... :)
You can set the locale with a Parameter (name="changeLocation"), and therefore should be able to use a variable in it to change the state. Just create a utility Button (no image) with the changeLocation Parameter defined and use your variable as the value. I've not actually tried this combination before, but the infrastructure is there and there's no reason I can think of why it wouldn't work.

And no wasted typing because you reminded me that I want to reconsider overlays and pop-op pages. :D


4. A strange issue I ran into that you may want to look into is in the following code I had to put the serviceResultVar in the ButtonGroup instead of the Startupservice_button button otherwise the values ended up be null or undefined. Really threw me off for a while but that the reality of beta software. Glad to help find the bugs..
On this occasion I think it's actually not a bug. Keep in mind that Parameters get executed in order defined in the config, and it's the 'serviceParams' Parameter that executes the web service call. In your code, the serviceResultVar is defined below the serviceParams call so it isn't defined when the web service action happens. The ButtonGroup Parameters are always set before Button Parameters, so that's why it works when defined there.

Incidentally the more complicated things get, the more I grimmace at having 'serviceParams' be the web service trigger. Even a terminology change here would probably help people understand it better. That, or separate the definition of the serviceParams from an actual 'call the web service now' Parameter... Will give this some thought.


5. Yesterday I was trying to isolate the PJ_button state issue and found that if I removed most of my buttons the issue went away. I'll work on further isolating this but I don't suspect it's an obvious syntax error as Andre is quick to recognize syntax errors. I do have another strange issue that I am started to wonder if it's related. I have a couple inactive buttons with labels that are just dashes that I using as a horizontal rule. When I first open Andre this HR is often across 2 lines but if I refresh the config it displays as I would expect. I'll work on further isolating these issues and put up some code when I find the culprit if it's not an issue in my config.
Ok. And if you decide to post your config it'll make this even easier, as I can run your exact setup through the emulator with debugging on and see what's going on in each step, without having to try to replicate it in my config.

I should have a solid 10+ hours to dedicate to Andre today, hopefully I'll be able to make significant progress on the open issues we've been discussing. Whatever I get to at the end of the night I'll post a new version.

rkirmeier
June 29th, 2011, 03:48 PM
As a fairly extreme option on the Andre end, I have considered making Andre tell the OS that it is a full 'background' service which would keep it alive until memory is critically low, but that may adversely impact the performace of the phone. I'd make it a configurable setting so we can experiment with it.


I'm passing on the Evo3D but the Samsung Within will certainly find it's way into my hands! That's at least a month out though... I think the option to keep it in memory is pretty important based on my experience. I'd rather see other things get pushed out of memory... Hope you can add this as a user option soon. Thanks!

rkirmeier
June 29th, 2011, 04:11 PM
Ok. And if you decide to post your config it'll make this even easier, as I can run your exact setup through the emulator with debugging on and see what's going on in each step, without having to try to replicate it in my config.

I should have a solid 10+ hours to dedicate to Andre today, hopefully I'll be able to make significant progress on the open issues we've been discussing. Whatever I get to at the end of the night I'll post a new version.

I'll PM you my email address so I can pass the config email for now. One problem though is that my config does rely on my girder code so not sure how things would work without it...

HTLuke
June 29th, 2011, 06:02 PM
Regarding keeping Andre running when Android is doing memory management, my solution about making some part of Andre be a service looks to be the only viable option, and even then services can get killed in low-memory situations.

The only problem with this is to do it right, I'll have to re-arrange a large part of the code to cleanly separate the service portion (which will load and store the data so it doesn't get purged) and the UI portion. This will take a lot of time and Andre will be broken in the process (e.g. no new bug-fixes or smaller features). So I'm inclined to wait until I get to my stable 2.0 RC, which includes all the bug-fixes we've talked about recently as well as most of the feature additions. So while I'm going to take a stab at it, I probably won't get a chance for a few weeks, considering starting Monday I'll have a lot less time to focus on Andre for a little while.

The database rewrite I put into 1.7.5 should have helped start-up times a bit, and I'm always looking at other optimizations as well to make things even speedier, which might make it less of an issue.

HTLuke
June 30th, 2011, 04:53 AM
Here's the next version:

http://www.andreapp.com/downloads/Andre-1.7.6b.zip

The beta expiration has been pushed out to August 15th.

Changes:

- New Parameter: 'wakeOnLan'


Format:
<Parameter name="wakeOnLan">broadcastIp|macAddr</Parameter>

Example:
<Parameter name="wakeOnLan">192.168.0.255|00:55:4f:9a:0d:ea</Parameter>

- New Parameter: 'launchApp'


Format:
<Parameter name="launchApp">appName</Parameter>

Example:
<Parameter name="launchApp">gallery</Parameter>

- BUG: Properly delete sdcard cache directory when un/re-installing Andre, in case a bad config gets wedged

- New menu option: Quit (handy for restarting after certain Settings change like wallpaper on/off)

- Changed Parameter: userTextInput & userSelectInput can now take a full set of values for triggering a button after the user input is finished

The format is the same as Parameter triggerButton:

pageId|buttonId|action|suppressAnims|blendState|su ppressControlParams|suppressDisplayParams

Only pageId and buttonId are required. Just add the values at the end of the userXXXInput value, as such:


<Parameter name="userTextInput">myfirstvariable|Enter stuff below:|pg_directv|btn_volumeup</Parameter>

or

<Parameter name="userSelectInput>Choose:|option1,option2,option3|Choice #1,Choice #2,Choice #3|myOptionVar|myTextVar|pg_directv|btn_volumeup|t ouch|false|true|false|false</Parameter>

Note for userSelectInput you must have the textVariable field there, even if blank (e.g. myOptionVar||pg_directv|btn_volumeup|....) because it counts on the fields being in that specific order.

- Revamped URL settings to separate out domain, port and path so the right parts of a URL can be properly encoded.

THIS INCLUDES CHANGES THAT WILL BREAK EXISTING INSTALLS. You will need to go into settings and change the way the default domains are specified. In Private/Public Domain remove "http://" and any port that might be there (e.g. :80). Put the port in the new dedicated space for private/public 'Port'.

Also if you use serviceUrl at all in the config.xml you must split it out into serviceDomain and servicePort Parameters, removing 'http://' and moving the port to servicePort. serviceUrl is no longer used.


I think that's everything, except a few non-visible performance tweaks and such. I really haven't had a lot of time to test this version, and the other zip contents are the same as 1.7.5b (which means even my own config.xml has the old serviceUrl setting). Please let me know if there's problems/questions.

rkirmeier
June 30th, 2011, 09:45 AM
I updated my config and the new userSelectInput changes work great. Also configured a button to lunch Gizmo and that works great! I'll work on optimizing my config in the next few days and let you know if I find any other strange behavior. Not sure what to say about the re-load issue as it does seem to be an issue on my phone if I use any other apps. I'm running a rooted "stock" (ginderbread/sense) rom although I admit I have a lot of apps I don't really use, just like to have them on the phone in case I find myself without Internet and bored... :o I was on a CM7 rom not too long ago and I'm sure there was a lot more free memory running that rom but way too many issues and the latest Evo Ginderbread rom is actually very fast and good on battery.

Anyway to easily add an option to keep it loaded on a rooted rom for those of use who are rooted? If not hopefully you can figure out the service thing cause I wouldn't consider my phone old or to have bad specs... Although I plan to get a new phone within a month or two my existing Evo was going to be used as a spare remote in my house.

Last but not least I would like to thank you again for creating such an awesome app for Android and Girder! And again for all your work recently to address and troubleshoot any issues or requests that come up!

rkirmeier
June 30th, 2011, 11:12 AM
I might have found a work around to the re-load issue for rooted phones. There is a app called AutoKiller Memory Optimizer and some recommended settings that are suppose to help prevent Gingerbread from closing apps so quickly. Other have reported great results so I am hopeful. The thing is I have at least free 150MB of memory and it still gets closed so I'm hoping this app and settings will allow me to keep more apps in memory.

http://www.droidforums.net/forum/bugless/131879-task-manager-too-aggressive-gingerbread-2.html#post1369760

HTLuke
June 30th, 2011, 12:13 PM
I might have found a work around to the re-load issue for rooted phones. There is a app called AutoKiller Memory Optimizer and some recommended settings that are suppose to help prevent Gingerbread from closing apps so quickly. Other have reported great results so I am hopeful. The thing is I have at least free 150MB of memory and it still gets closed so I'm hoping this app and settings will allow me to keep more apps in memory.

http://www.droidforums.net/forum/bugless/131879-task-manager-too-aggressive-gingerbread-2.html#post1369760
Thanks for the link, please let me know if it helps because I can easily see this being one of the most problematic issues people have, particularly on old hardware (my Evo 4G just became a permanent remote along with two Heros so I'm sure I'd run into it as well).

I'll see if there's anything special I can do for rooted phones, though most of the stuff is just flat out beyond what any app can reach. A custom ROM would likely be the only way to truely get better control over how the Android app-killer behaves.

The service approach should do the trick, and I may be over-estimating the work involved, I'll do a preliminary investigation and see what kind of effort I'm looking at. There may be a shorter-term hacky way to accomplish it and then I can go back and clean it up to be more efficient and well-behaved.

ewingr
June 30th, 2011, 04:22 PM
Couple things: Autokiller: It will be interesting to see if you can exclude an app from closing wiht Autokiller. I use it, but it is designed to tweak the settings in Android for when the Android native program killer works. According to the thread in XDA about it, you cannot exclude programs.

The other thing: HTLuke: Any chance you have a matching Girder GML file for your sample config.xml file that you ship with your app? It may greatly help me understand how you are using the ServiceParams to trigger Girder actions.

rkirmeier
June 30th, 2011, 04:54 PM
No luck with Autokiller... It's kind of crazy how quickly Ginderbread shuts it down. I spent a lot of time today trying different hacks and even trying to set the oom_adj file with a script but no real luck. One thing I discovered is that Andre is showing up as a "Empty App" vs. a "Hidden App" via Auto Memory Manager which may be a clue as to why it terminates so quickly. Another thing I read is that if an app obtains root permissions it is less likely to be terminated. Maybe a quick hack would be to have a checkbox to run as root for those of us who are rooted? Otherwise maybe the service solution won't be so bad... You don't need any sleep anyways, do you? lol!

Otherwise everything is working great!!! Thanks again!!

HTLuke
June 30th, 2011, 04:55 PM
Any chance you have a matching Girder GML file for your sample config.xml file that you ship with your app? It may greatly help me understand how you are using the ServiceParams to trigger Girder actions.

My Girder config is pretty straight forward but it is split out across a dozen or so GMLs. Basically I have devices defined in the Event Mapping Editor (View->Event Mapping) which maps each device to a unique number. Then I create USB-UIRT actions (which are nothing morethan the IR emitter captures) for each remote button. Attached to each of these are events with unique event strings. This lets me trigger the USB-UIRT action with a combination of device number and event string.

Here's a snippet from my DirecTV configuration. Pretty much the entirety of my config is just this with different IR codes, device numbers and event strings:



<?xml version="1.0" encoding="UTF-8"?>
<Girder Version="400">
<FileRoot Name="DTV_HR21-700.gml" Identifier="0" Enabled="TRUE" FileGUID="{8E62664B-F8B2-4FC4-8DB0-CE1EFC1DC410}" TimeStamp="0" Locked="FALSE" ErrorBreak="FALSE" ErrorJump="FALSE" ErrorEmail="FALSE" ErrorGirderLog="FALSE" ErrorSystemLog="FALSE">
<Group Name="New" Identifier="1852788687" Enabled="TRUE" ErrorBreak="FALSE" ErrorJump="FALSE" ErrorEmail="FALSE" ErrorGirderLog="FALSE" ErrorSystemLog="FALSE">
<Command Name="Power On" Identifier="1852788721" Enabled="TRUE" ErrorBreak="FALSE" ErrorJump="FALSE" ErrorEmail="FALSE" ErrorGirderLog="FALSE" ErrorSystemLog="FALSE">
<OSD>FALSE</OSD>
<Topmost>TRUE</Topmost>
<MatchNum>1</MatchNum>
<sValue1>...IR Code raw values...</sValue1>
<bValue1>False</bValue1>
<iValue1>0</iValue1>
<iValue2>4</iValue2>
<iValue3>0</iValue3>
<Binary Encoding="Base64">QQEAAAAAAAAAAAAAAAAAAA==</Binary>
<ActionType>75</ActionType>
<ActionSubType>1</ActionSubType>
<EventString Name="POWER_ON" Identifier="1852788737" Enabled="TRUE" Invert="FALSE" Device="4008" IrStr="POWER_ON" KeyMod="1">
</EventString>
</Command>
<Command Name="Power Off" Identifier="1852788720" Enabled="TRUE" ErrorBreak="FALSE" ErrorJump="FALSE" ErrorEmail="FALSE" ErrorGirderLog="FALSE" ErrorSystemLog="FALSE">
<OSD>FALSE</OSD>
<Topmost>TRUE</Topmost>
<MatchNum>1</MatchNum>
<sValue1>...IR Code raw values...</sValue1>
<bValue1>False</bValue1>
<iValue1>0</iValue1>
<iValue2>4</iValue2>
<iValue3>0</iValue3>
<Binary Encoding="Base64">QQEAAAAAAAAAAAAAAAAAAA==</Binary>
<ActionType>75</ActionType>
<ActionSubType>1</ActionSubType>
<EventString Name="POWER_OFF" Identifier="1852788738" Enabled="TRUE" Invert="FALSE" Device="4008" IrStr="POWER_OFF" KeyMod="1">
</EventString>
</Command>
</Group>
</FileRoot>
</Girder>


My calls to Girder emulate the default Girder web server page that you get to by hitting http://<your.ip.here/events.html. If you can control your Girder setup with that page, then you can drop in Andre with the serviceParams (which are just the query parameters on the web service URL call) and do the exact same thing.

rkirmeier
June 30th, 2011, 04:55 PM
ewingr,
You shouldn't need the girder gml file. Simply press a button on Andre and watch the log for an event. I think you can simply drag the event into your Girder action...

HTLuke
June 30th, 2011, 05:03 PM
No luck with Autokiller... It's kind of crazy how quickly Ginderbread shuts it down. I spent a lot of time today trying different hacks and even trying to set the oom_adj file with a script but no real luck. One thing I discovered is that Andre is showing up as a "Empty App" vs. a "Hidden App" via Auto Memory Manager which may be a clue as to why it terminates so quickly. Another thing I read is that if an app obtains root permissions it is less likely to be terminated. Maybe a quick hack would be to have a checkbox to run as root for those of us who are rooted? Otherwise maybe the service solution won't be so bad... You don't need any sleep anyways, do you? lol!

That's too bad. I'm going to put my other features on hold for a bit and see if I can find a fix for this, and/or start the service-based solution. I looked into what 'Empty' vs. 'Hidden' is, and basically it's that Andre is idle and consuming no resources (other than memory) vs an app that was 'paused' in the middle of something. So yeah, because Andre is behaving, it may be considered superfluous and killable. :P Perhaps I can put something akin to an optional keep-alive in the app which tricks the OS into thinking the app is still busy and not quite as attractive a kill-target.

I'm still surprised that Gingerbread is so drastic about it on the Evo4G. My 4G is still on 2.2 (rooted and I need to get stuff off it before wiping and updating) and behaves pretty well. My 3D is on 2.3.3 and is insane; I ran Andre once yesterday afternoon and have used other stuff all night and all morning and yet it was still loaded and ready to go when I just tried it.

I'll keep you posted, I've got a few hours today to look into this.

HTLuke
June 30th, 2011, 05:03 PM
ewingr,
You shouldn't need the girder gml file. Simply press a button on Andre and watch the log for an event. I think you can simply drag the event into your Girder action...

Wow, I never knew about the draggable events from the log. That's cool.

HTLuke
June 30th, 2011, 05:28 PM
Here's a small hack to test the super-user theory. Nothing is different about this version from 1.7.6b other than the 'Debug' option in the menu attempts to request super-user permissions. It'll tell you if it succeeds or not (but you'll probably know anyway because of the SuperUser popup dialog).

http://www.andreapp.com/downloads/Andre-1.7.6c.zip

ewingr
June 30th, 2011, 05:57 PM
ewingr,
You shouldn't need the girder gml file. Simply press a button on Andre and watch the log for an event. I think you can simply drag the event into your Girder action...

Cool. I too didn't know I could do that either. That is done that way on EventGhost, and is real nice.



My Girder config is pretty straight forward but it is split out across a dozen or so GMLs. Basically I have devices defined in the Event Mapping Editor (View->Event Mapping) which maps each device to a unique number. Then I create USB-UIRT actions (which are nothing morethan the IR emitter captures) for each remote button. Attached to each of these are events with unique event strings. This lets me trigger the USB-UIRT action with a combination of device number and event string.

Here's a snippet from my DirecTV configuration. Pretty much the entirety of my config is just this with different IR codes, device numbers and event strings:

My calls to Girder emulate the default Girder web server page that you get to by hitting http://<your.ip.here/events.html. If you can control your Girder setup with that page, then you can drop in Andre with the serviceParams (which are just the query parameters on the web service URL call) and do the exact same thing.

I think therein lies my confusion. I do not have any devices at all in my Girder file. In fact I just tried to load one from an Onkyo file I got from someone in another thread, and the Transport doesn't hook communicate with my Onkyo correctly (communication faild). It does fine from EventGhost, so not sure what is wrong with it in Girder.

One thing I just tried, working with the first orange button in the example file, was changing the device in the file to the name of a group of commands in Girder, and the event to the name of the macro. Naturally, neither came across in the log.

Maybe the drag and drop that rkirmeier suggested will work for me.

rkirmeier
June 30th, 2011, 07:26 PM
Go into girder setting and make sure all logging is enabled. You can disable the ones you don't want log once things are working...

In an Andre button use the following code.


<Parameter name="serviceParams">device=232,event=TV.ON</Parameter>


When you push the button you should see a WebServer event and a communication server event. The comm server event will have "TV.ON" as the event details which is the event trigger for your action.

ewingr
June 30th, 2011, 07:58 PM
rkirmeier...I have success. One thing....I must use a number for a device. Cannot use a name. So to keep it straight, if I put a number on the names of my folders in Girder to correspond with a device, I'll be able to identify what is what when I send a device number, with the command.

I"m going to install the latest from above, and try to get the WOL working. Then I'm going to start on my screen. Will be simple at first.

I appreciate the help. Hopefully in not too distant future, I may be able to help test, and provide feedback for review, as I'll probably be doing different things. But I"m way behind from where you are.

ewingr
June 30th, 2011, 08:21 PM
ewingr,
You shouldn't need the girder gml file. Simply press a button on Andre and watch the log for an event. I think you can simply drag the event into your Girder action...

Cool. I too didn't know I could do that either. That is done that way on EventGhost, and is real nice.



My Girder config is pretty straight forward but it is split out across a dozen or so GMLs. Basically I have devices defined in the Event Mapping Editor (View->Event Mapping) which maps each device to a unique number. Then I create USB-UIRT actions (which are nothing morethan the IR emitter captures) for each remote button. Attached to each of these are events with unique event strings. This lets me trigger the USB-UIRT action with a combination of device number and event string.

Here's a snippet from my DirecTV configuration. Pretty much the entirety of my config is just this with different IR codes, device numbers and event strings:

My calls to Girder emulate the default Girder web server page that you get to by hitting http://<your.ip.here/events.html. If you can control your Girder setup with that page, then you can drop in Andre with the serviceParams (which are just the query parameters on the web service URL call) and do the exact same thing.

I think therein lies my confusion. I do not have any devices at all in my Girder file. IN fact I just tried to load one from an Onkyo file I got from someone in another htread, and the Transport doesn't hook communicate with my ONkyo correctly. It does fine from EventGhost, so not sure what is wrong with that.

One thing I just tried, working with the first orange button in the example file, was changing the device in the file to the name of a group of commands in Girder, and the event to the name of the macro. Naturally, neither came across.

Maybe the drag and drop that rkirmeier suggested will work for me.

ewingr
June 30th, 2011, 08:24 PM
I took the basic code from the General Functional Overview to use as a starting template, to modify, to start my first file of my own. Here is the code:


<?xml version="1.0" encoding="UTF-8"?>
<Remote>
<Locales>
<LocaleDef id="livingroom" name="Living Room"/>
</Locales>
<Settings>
<StartPage>pg_television</StartPage>
<StartLocale>livingroom</StartLocale>
</Settings>
<Pages>
<Page id="pg_television">
<Buttons>
<Button id="power">
<Locale id="default">
<Parameter name="imageUrl">/bluebutton.jpg</Parameter>
<Parameter name="buttonLabel">Power</Parameter>
<Parameter name=”serviceUrl”>http://192.168.1.100</Parameter>
<Parameter name="serviceParams">device=4001,event=POWER</Parameter>
</Locale>
</Button>
</Buttons>
</Page>
</Pages>
</Remote>

When I do a Check XML with that code in NOtepad++, I get the error : "XML Parsing Error at line 24. Extra Content at the end of the document"

Line 24 is the last line, </Remote>.

I collapsed the config.xml that works fine from the shipping example, and all looks good to me. Any thoughts?

NOTE: I included indenting; I tried to find a method to imbed code here in the forum, but don't see it. So the Quote wrappers is not showing the indentions.

Next, I have put the file out there, and edited it just a bit to create my first button. It works, but as in my very first test posted a while back, the label is not showing up on the button. The button works (yeah!), just no lable. I thought maybe it was because I had two words on the label, so I concatenated it. Here is the code as is is now:

<?xml version="1.0" encoding="UTF-8"?>
<Remote>
<Locales>
<LocaleDef id="livingroom" name="Living Room"/>
</Locales>
<Settings>
<StartPage>pg_Onkyo</StartPage>
<StartLocale>livingroom</StartLocale>
</Settings>
<Pages>
<Page id="pg_Onkyo">
<Buttons>
<Button id="power_on">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">OnkyOn</Parameter>
<Parameter name="serviceParams">device=1,event=POWER_ON</Parameter>
</Locale>
</Button>
</Buttons>
</Page>
</Pages>
</Remote>

FYI..I do NOT get the error as in the top file when I check this one.

Any idea why I can't get the label to show?

ewingr
June 30th, 2011, 09:14 PM
As noted above, I have one button working (albeit with no label working). I decided to add a second button and try the WOL. So I installed 1.76b.

When I load the one button one, I get the error " Malformed URL: null", and then "Communication error fetching XML from server. Check settings". Settings look same/fine to me.

I went back to 1.75b, and it worked fine. Went back to 1.76b again, same error.

rkirmeier
June 30th, 2011, 09:59 PM
Nice! Seems to help, not sure how much yet. I'll report more tomorrow...

rkirmeier
June 30th, 2011, 10:00 PM
Did you change the Settings as noted above in that release post?

rkirmeier
June 30th, 2011, 10:03 PM
Yeah, I was wrong about the draggable events but he could just learn the learn option when creating a new event. :)

ewingr
July 1st, 2011, 02:57 AM
Did you change the Settings as noted above in that release post?

Doh! I had not read through the entire post. It appeared from just very early reading that it was just new information on how to use other parameters, etc. But now that you mention it to me, I read through and see the important information later in the post. Some of it is a bit beyond my comprehension, as I am so early into this. But once I try to work on it, I will likely get it going.



Yeah, I was wrong about the draggable events but he could just learn the learn option when creating a new event. :)

No, you weren't.I tried it and it does work for me.

HTLuke
July 1st, 2011, 05:47 AM
When I do a Check XML with that code in NOtepad++, I get the error : "XML Parsing Error at line 24. Extra Content at the end of the document"

It appears that the quotes around serviceUrl are the wrong type of quotes. Replace them with standard double quotes and it should pass the XML syntax check. When troubleshooting XML there's a few things you can look for. In a syntax-highlighting editor like Notepad++, look for colored text that stands out (e.g. in your case, serviceUrl is not purple in Notepad++ like all the other Parameter names) for a hint of where the problem is. Also XML should pass the syntax test with any complete, matched pair of tags so you can cut out all but the <Remote> and </Remote> tags and re-check. If that passes, add in the next set of tags and re-check, etc.

It's a bit brute force but it works in a pinch. Finally, don't get too distracted by an error that points to the end of the file (or any specific line number for that matter), as unmatched open and close tags can often lead to the detectable error being in a weird place that isn't the problem.


Next, I have put the file out there, and edited it just a bit to create my first button. It works, but as in my very first test posted a while back, the label is not showing up on the button. The button works (yeah!), just no lable. I thought maybe it was because I had two words on the label, so I concatenated it.

You might try setting explicit values for the label details, like color, text size, etc. It really should be picking up reasonable defaults if not specified, but that's the first thing I can think of. Drop these parameters in with the other button Parameters and see if it works:



<Parameter name="labelColor">ffffffff</Parameter>
<Parameter name="labelSize">24</Parameter>


Did you get the config.xml that comes with it to run before trimming it down, and did the labels properly display there? If not, there may be a bug I'm not aware of; if this is the case, please tell me the device you're running and what version of Android is installed.

ewingr
July 1st, 2011, 06:43 AM
HTLuke...

Thanks. First...I really appreciate your dedication to help and support. Also while the manual is not current, it is a nice start, and good work. Product looks like it is going to be great too. I will definitely be a donator/purchaser when the time comes. I hope in the meantime I can ultimately provide value in feedback.

I put the parameters in per your suggestion, and that worked. Before that, I had also tried adding <FONT> information, which did not help.

FYI...the WOL works. Thanks for that!

A couple questions:

Entereing Code Snippets in this forum
I see your code snippet above, and saw one from rkirmeier earlier. I cannot for the life of me find the method to do that in this forum. Other forums I have no problem. But none of the buttons for formatting the post in the Quick Reply offer coding quote wrappers when I post; and if I select Go Advanced, none appear at all (what the heck?)

Fonts
I am experimenting with trying to use a TT font. I first tried putting this code in under after the settings:

<Fonts>
<Font id="baroque" url="Andre/Fonts/BaroqueScript.ttf" />
</Fonts>

Thinking that would use it as default font, and it didn't.

NExt I tried adding the parameter statement for it. IN fact here is all the code for a button:

<Button id="power_on">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">Onkyo On</Parameter>
<Parameter name="serviceParams">device=1,event=POWER_ON</Parameter>
<Parameter name="labelColor">ffffffff</Parameter>
<Parameter name="labelSize">24</Parameter>
<Parameter name="labeltypeface">baroque</Parameter>
</Locale>
</Button>

As I'm sure you guessed by now, it is not using the font. I do have it on the server in the path listed.

A suggestion
Hmmm...maybe I can already do this...need to try.

The suggestion is being able to send ISCP commands, which would allow sending commands direct to an Onkyo receiver, eliminating the need for the HTPC to be up if wanting to just control that.

Thanks again.

[EDIT]
Tried sending to the Onkyo direct. I suspect my problem is not having, or knowing, what to enter for the Service API. The only Service API I know about at this point is the one for Girder.

By the way: I am on an ASUS Transformer Tablet, with Honeycomb 3.1, Stock Rom at the moment.

rkirmeier
July 1st, 2011, 08:42 AM
Click the Reply With Quote option on a post that has code and you will see the tags. It's just the code tag... :)

So you Onkyo receiver can be controlled via network IP communications? That cool but I wouldn't give up on using Girder on the backend. Adds a lot of advanced capabilities and flexibility. For instance, when I moved to Andre from NR I didn't have to change any IR codes or actions in girder. Once I had Andre sending the comm events everything was working. Also, you can't expect HTLuke to enable Andre to talk to all the different devices, why not let girder do that part since there is already a lot of support. I actually really like EventGhost too and considered switching but was too much to take on right now. Seems like EventGhost has more support for plug-ins also has a android client although probably not necessary... I just like opensource type software and there seems to be a lot of activity/development (plug-ins, etc)ongoing for EventGhost.

I have a ASUS Trans too but doing most of my work on my Evo right now... I have bigger better Andre config plans for that screen! :)

HTLuke - This is a VERY minor thing but something to note. When you open Andre on Honeycomb it always displays the loading screen in portrait even if Andre is set to Landscape. Again VERY minor but thought you would like to know...

I've been thinking more and more about using Andre as a replacement launcher. I'm sure we'll need the service capabilities before I can do this. I just think it would work great as you could have your remote buttons, launch apps, and have widgets all on your home screen (andre). The home button in Andre could be assigned to the real launcher... With actual wallpaper support it could look like the OEM home screen with a little work. I think this is a feature/benefit to Andre that may not have planned... :) May down the road you could add the capability to grap the app icon directly from the apk file or whatever so in the config you just name the app...

rkirmeier
July 1st, 2011, 09:22 AM
Anyway to move all the settings config options (except path to config file for obvious reason) into the xml file so a person does not need to config each device? I know it's a one time thing but with the recent update we then needed to update all devices again. Just thinking forward... If there were changes like this again we just change it in the config and good to go on all devices.

ewingr
July 1st, 2011, 09:55 AM
Click the Reply With Quote option on a post that has code and you will see the tags. It's just the code tag... :)


Doesn't work for me. I see a Quote marker, but not code marker. I used the Quote one earlier, and no indents, etc.

Here is the tags that show up:http://i132.photobucket.com/albums/q17/kruiser_56/Quote.jpg




So you Onkyo receiver can be controlled via network IP communications? That cool but I wouldn't give up on using Girder on the backend. Adds a lot of advanced capabilities and flexibility. For instance, when I moved to Andre from NR I didn't have to change any IR codes or actions in girder. Once I had Andre sending the comm events everything was working. Also, you can't expect HTLuke to enable Andre to talk to all the different devices, why not let girder do that part since there is already a lot of support. I actually really like EventGhost too and considered switching but was too much to take on right now. Seems like EventGhost has more support for plug-ins also has a android client although probably not necessary... I just like opensource type software and there seems to be a lot of activity/development (plug-ins, etc)ongoing for EventGhost..

I don't really intend to abandon Girder. But I do use my Onkyo without need for the HTPC and would love to be able to control it without having to turn on the PC. WAF in particular is an issue. Re teh EventGhost client, it is VERY light right now.



I have a ASUS Trans too but doing most of my work on my Evo right now... I have bigger better Andre config plans for that screen! :)
Me too. I have a Captivate, and will likely experiment with it, but the tablet is my main focus atm.



HTLuke - This is a VERY minor thing but something to note. When you open Andre on Honeycomb it always displays the loading screen in portrait even if Andre is set to Landscape. Again VERY minor but thought you would like to know...
I see the same thing.



I've been thinking more and more about using Andre as a replacement launcher. I'm sure we'll need the service capabilities before I can do this. I just think it would work great as you could have your remote buttons, launch apps, and have widgets all on your home screen (andre). The home button in Andre could be assigned to the real launcher... With actual wallpaper support it could look like the OEM home screen with a little work. I think this is a feature/benefit to Andre that may not have planned... :) May down the road you could add the capability to grap the app icon directly from the apk file or whatever so in the config you just name the app...

I in fact was thinking the same thing. With being able to launch apps in Android, might be able to really have a custom tablet for around the house.

rkirmeier
July 1st, 2011, 10:42 AM
You can set the locale with a Parameter (name="changeLocation"), and therefore should be able to use a variable in it to change the state. Just create a utility Button (no image) with the changeLocation Parameter defined and use your variable as the value. I've not actually tried this combination before, but the infrastructure is there and there's no reason I can think of why it wouldn't work.


I know you have some other obligations but can you take a look at the changeLocation parameter? I can't get it to work and really can't implement any special buttons on my config without it unless I basically change everything about the way my config works...

I put the following line in a button and the location does not change when I press the button. I have confirmed my locale works by selecting the locale via the menu button. I'm not even using a variable at this point... This will actually be used for activities instead of zones in my config. When I select say "DISH" it will set the locale that will then set device specific buttons to show or hide.



<Parameter name="changeLocation">Theater</Parameter>

rkirmeier
July 1st, 2011, 10:45 AM
Doesn't work for me. I see a Quote marker, but not code marker. I used the Quote one earlier, and no indents, etc.



[ code ]
write code here
[ / code]

remote spaces...

rkirmeier
July 1st, 2011, 11:22 AM
I don't really intend to abandon Girder. But I do use my Onkyo without need for the HTPC and would love to be able to control it without having to turn on the PC. WAF in particular is an issue. Re teh EventGhost client, it is VERY light right now.




I don't get the point to using WakeOnLan and/or shutting down your HTPC! Use some power saving settings and it will cost less then $5/mth to run 24/7...

ewingr
July 1st, 2011, 01:40 PM
I don't like letting it run constantly, running the fan, and wearing on it. WOL is working, so why not? If I used it every day, then maybe, but I don't. And if I get something going to run my Onkyo w/o Girder, I will use it even less. I pretty much only use the HTPC for movies (probably only a couple times a month), and occasionally for ripped music, but I play pandora straight from my Onkyo more.

I do use that method for my Unraid server.

Update on my learning progress
I have downloaded some fonts, and got those working; successfully changing fonts; finally figured out the way to set the default colors so I don't have to specify them on every button; font size changes, etc.

One thing I am struggling with now is getting it to use a background jpg. I've tried to mimic what I see in the example config.xml, but it just isn't working for me. One thing that has bitten me a few times already is forgetting the / in front of a path. But I'm good on that for the background, so not sure what my problem is.

rkirmeier
July 1st, 2011, 01:58 PM
Copy and paste should be your best friend! I don't think I typed out a full single line in my config... C/P Luke's code into your config, test it, works? Yes, change graphic name... No, try a different graphic...

ewingr
July 1st, 2011, 03:27 PM
Yup. Been doing that.

Just figured out the background. It is just a background sized button. After studying the code long enough, it finally clicked.

BTW...any idea if animations work in this? The sample file has all kinds of references to animations, but I can't tell that they do anything. I even turned off animations in settings, looks the same. Wondering if it is not yet really implemented.

HTLuke
July 2nd, 2011, 02:21 PM
Anyway to move all the settings config options (except path to config file for obvious reason) into the xml file so a person does not need to config each device? I know it's a one time thing but with the recent update we then needed to update all devices again. Just thinking forward... If there were changes like this again we just change it in the config and good to go on all devices.

I have it on my longer to-do list to create an import/export tool for Settings which would dump all Settings out to another separate XML file which you could load on other devices (and tweak before doing so if you wanted to change anything on a per-device basis). I wanted to keep the app preferences/settings apart from layout/remote functionality to keep things cleaner.

That said, there are a number of Settings I want to expose to the remote itself so you can change them from within the app (such as image path prefix), which ultimately means you could set some global Parameters to set the Settings the way you like in-line with config.xml anyway. :) This is aways out though, since I'm focusing on the in-memory persistence issues and several half-finished features and bugs right now.

HTLuke
July 2nd, 2011, 02:30 PM
I am experimenting with trying to use a TT font. I first tried putting this code in under after the settings:
It sounds like you got fonts working later in this thread, but I did want to mention something that your code snippet reminded me of that isn't in the manual. The order in which Parameters are defined in your config.xml are the order they are interpreted and executed by Andre. This isn't usually a big deal for Display-type Parameters (fonts, type sizes, shadow colors, etc.) because those are all persistent on the text-draw function once set. But for Command-type Parameters (service calls, variable or state changes, etc.) the order can be very important. You'd definitely want to assign the serviceResultVar before calling serviceParams for example, or the result variable will never get set.


The suggestion is being able to send ISCP commands, which would allow sending commands direct to an Onkyo receiver, eliminating the need for the HTPC to be up if wanting to just control that.
Right now Andre only support HTTP as a protocol so it's limited to web service calls, however I already have preliminary support for other TCP based protocols in the design, I just need to find the time to figure out how best to expose it in the config file. so eISCP will be possible down the road (as will any TCP communication).

HTLuke
July 2nd, 2011, 02:40 PM
This is a VERY minor thing but something to note. When you open Andre on Honeycomb it always displays the loading screen in portrait even if Andre is set to Landscape. Again VERY minor but thought you would like to know...
Thanks, I've not run Andre on Honeycomb in quite awhile, but I do have a bootable SD card image of it for the Nook, and should be able to set it up in the emulator too to give it a try.


I think this is a feature/benefit to Andre that may not have planned... :) May down the road you could add the capability to grap the app icon directly from the apk file or whatever so in the config you just name the app...
I certainly hadn't thought of this until you started mentioning it, I think it's a really neat idea! I did approach Andre's design from a "I'm sitting on the couch and want as complete a control center as possible" which sorta implies the basic concept, but even with widgets and app-launching functionality I never realized how close to a bona-fide launcher it was getting. Of course with the Evos and the stock launcher, there's all the HTC Sense stuff I can't replicate in Andre, which is kind of a bummer.

When I started implementing the app-launching capability I was going to first make it behave more like a launcher app shortcut (and therefore similar to how widgets are loaded in Andre) where you define a button as an 'app container' and then in the UI you click it and it brings up an app-picker list and you choose which one you want. Then it would assign the app, load the icon, etc. But that was going to be a LOT more work, and it actually was less useful. I already hate having to go around to every page and click 'add widget' when I re-install Andre, I'd not want to do that with apps too.

However I should be able to easily add a new Parameter called something like 'useAppIcon' which would allow you to use App icons for your buttons any time you want, even if the button isn't calling 'launchApp'. :)

HTLuke
July 2nd, 2011, 02:58 PM
BTW...any idea if animations work in this? The sample file has all kinds of references to animations, but I can't tell that they do anything. I even turned off animations in settings, looks the same. Wondering if it is not yet really implemented.

Yes, there's extensive animation support in Andre. The latest config that accompanies Andre has most of it not assigned because I had finished testing it and didn't want it to interfere with other features I was testing/releasing. I believe in that config the only animations enabled are fade-in and fade-out of some pages, and the globe sprite (tap the second button from the top in the Widgets page (Menu->Widgets)) assuming I got the sprite sheet image filename right...

Andre supports animated alpha (fade in/out), rotation, size and position for both individual Button entities and page transitions. There's also fully customized sprite-sheet cell animation support as well, for doing cartoon/game style animated images.

I'm a game developer by trade, so animations was probably the second feature I worked on, after the core web service communication stuff. :D The good news about that is I think I managed to document a lot of the animation syntax in the first pass so the manual is fairly accurate there, except for sprite animations which came later. I believe I documented the sprite animations pretty well in the release post earlier in this thread though, and the globe sprite example in the most recent config should be a good starting point.

There are still a few fairly advanced features I have planned for animation support (adding some conditional logic to them to allow for complex animation cycles and chains) but the stuff in there now works great to beautify page transitions and button clicks.

rkirmeier
July 2nd, 2011, 02:59 PM
Thanks for all status updates! Wondering if you figured out anything with the changeLocation parameter?

ewingr
July 2nd, 2011, 04:42 PM
Yes, there's extensive animation support in Andre. The latest config that accompanies Andre has most of it not assigned because I had finished testing it and didn't want it to interfere with other features I was testing/releasing...

Thanks for the input. With a lot of animation stuff in the setup in the config, yet my not being able to tell that any was working, it was confusing.

I'm making a bit of progress learning, but it is a steep curve.

Looking like this will be a great product. I must say, I am thinking this is taking a LOT of programming. May take a while to really get it where you really want. Will keep you entertained ;-)

On a side note, I've noticed graphics or smilies (not sure which) embedded in your's and rkirmeier's posts, but they all show up as broken links with just marker icons when I view the posts. Same for you? I did post an image link in a post earlier and it looks fine, to me.

HTLuke
July 2nd, 2011, 05:52 PM
Thanks for the input. With a lot of animation stuff in the setup in the config, yet my not being able to tell that any was working, it was confusing.
Yeah things are a real mess right now because I'm iterating so fast and not keeping up with documentation or configuration examples. Once I can stop myself from expanding the feature set and fixing bugs, I'll go back into documentation mode and catch all that up, which should make a huge difference for newcomers.

Right now it's at more of a tinkerer's level, just so I can make sure I cover other advanced users' use cases and test alternative/obscure hardware/software/config combinations.


Looking like this will be a great product. I must say, I am thinking this is taking a LOT of programming. May take a while to really get it where you really want. Will keep you entertained ;-)
It is definitely growing well beyond what I originally set out to do. I'm currently at about 21,000 lines of code, and that doesn't represent the web stuff to support push notifications or the two or three major re-writes I've done when the design had to shift dramatically to accomodate big new capabilities.

It has been a lot of fun so far and there is little that I want that Andre can't do, given some time and creative config.xml implementation. :) That said, there are some big items left (non-HTTP device communications being one of the biggest) and a bunch of smaller ones (a few new controls like sliders and data tables, cleaning up error notifications, secure comms, etc.) and I want to add a layer of editability so you can examine and eventually edit layouts right on the device. So I see another six months or so before I run out of stuff to do! But I'm going to cut a 2.0 version very very soon, and that'd probably when I'll put it up in the market as an actual release.


On a side note, I've noticed graphics or smilies (not sure which) embedded in your's and rkirmeier's posts, but they all show up as broken links with just marker icons when I view the posts. Same for you? I did post an image link in a post earlier and it looks fine, to me.

It does look like some of the smiley icons are not where they should be in the forum file structure, I just type out the text smiley without thinking about it and the forum parses it into the image. It's such a habit that I don't even usually notice, and now I've gotten used to seeing the broken image and just translating that into a smiley in my head.

rkirmeier
July 3rd, 2011, 11:35 AM
HTluke,
I have the locationChange working with variables but wondering if there is anything you can do to improve speed of switching locatoins and I would definitlt ike an option to supress the "Locatiion changed to ...." message that pops up.

HTLuke
July 3rd, 2011, 03:05 PM
HTluke,
I have the locationChange working with variables but wondering if there is anything you can do to improve speed of switching locatoins and I would definitlt ike an option to supress the "Locatiion changed to ...." message that pops up.

I will move the message to be part of the debug verbose messaging. As far as speed goes, I'll see what I can do to improve it. Changing location means having to reset all buttons on all pages so they all get their display parameters re-evaluated, which is costly. But I recently monkied with some stuff in that code path and might have introduced some extra overhead that I can optimize.

rkirmeier
July 4th, 2011, 07:06 AM
Thanks! Getting rid of the pop up message may be enough.

HTLuke
July 4th, 2011, 08:27 PM
Quick holiday update!

Here's an incremental version that only has two real changes. First, the acknowledgement text for changing a location has been moved to a debug verbose warning. It will not show up if debug mode is disabled.

Second, I've implemented an experimental foreground service option. This basically just launches an empty service and subscribes to it in the same process in order to avoid Andre being killed by the memory manager in Android.

Turn this feature on by selecting Menu->Settings->Tools and check the box for 'Stay Running'. You will know this is working because if you leave Andre (or don't have it in full screen mode) you will see a persistent notification icon for Andre. This is a requirement by the OS for foreground services. Hopefully this greatly reduces the amount of times Android kills Andre when it isn't the foreground app in devices with limited memory.

http://www.andreapp.com/downloads/Andre-1.7.7b.zip

This is fairly quickly thrown in there, so there's likely to be some oddities I didn't catch in my brief tests. If you experience anything unusual, please let me know.

rkirmeier
July 6th, 2011, 10:26 PM
Sure, it's pretty straight forward. In Tasker, create an Action Intent task. Set the 'Target' drop-down to 'Broadcast Receiver' and set the Action field to:

com.buriedalive.andre.ISSUE_COMMAND_BUTTON (for triggering a Button)

or

com.buriedalive.andre.ISSUE_COMMAND_VARIABLE (for assigning an Andre variable)


The data to pass into Andre will go in the first 'extra' field. Tasker's format for passing data with the intent is extrasName:value. Our extras name is 'payload' and the value is a packed data structure separated by commas.

For Button triggering the data structure is:

pageId,buttonId,action,locale,state,suppressAnims, blendState,suppressControl,suppressDisplay,runIfUn loaded

Only the first two (pageId and buttonId) are required, the others are optional. Here's what all those fields should be for Button triggering:

pageId: ID of the page your Button is on
buttonId: ID of the Button to trigger
action: Action to trigger ('display','touch','heldstart','heldrepeat' or 'release')
locale: Locale ID to trigger (or 'default', which is the default)
state: State name of the Button to trigger (or 'default' which is the default)
suppressAnims: true or false (default is false) Should Button animate when it triggers
blendState:true or false (default is true) If state above is not 'default', include the default state too (default gets applied, then specified state values overrides default values)
suppressControl: true or false (default is false) Bypass all control-type Parameters when triggered
suppressDisplay: true or false (default is false) Bypass all display-type Parameters when triggered
runIfUnloaded: true or false (default is false) If Andre is not the current foreground app, if this is true then it is launched and brought to the foreground immediately to handle this event. If this is false, the action is queued up and waits until the next time Andre is launched before it gets processed.

Examples:


payload:pg_directv,btn_volumeup
payload:pg_directv,btn_volumeup,touch,default,defa ult,false,true,false,false,true
(the latter would launch Andre if it isn't already the foreground app)


For variable setting the format is:

runIfUnloaded,andreVarName,newVarValue

All three values are required. They are pretty obvious:

runIfUnloaded: true or false (default is false) If Andre is not the current foreground app, if this is true then it is launched and brought to the foreground immediately to handle this event. If this is false, the action is queued up and waits until the next time Andre is launched before it gets processed.
andreVarName: The name of the variable in Andre to set
newVarValue: Whatever you wish the Andre variable to be set to

Examples:


payload:false,myfirstvariable,some data here
payload:true,myfirstvariable,some data here
(the latter would launch Andre if it isn't already the foreground app)


That's about all there is to it. Let me know if any part of it is unclear.


Luke,
Could you double check the intent code? I can't get the variable or button intent to work. Pretty simple stuff here and triple checked my syntax... Thanks!

UPDATE: I have been able to get the button intent to work but not the variable intent. I just created a service button that set the variable so that works great for now...

ewingr
July 7th, 2011, 03:14 PM
I don't necessarily expect anyone to study this hard and answer, but being more familiar with this than I you may see my issue at a quick glance. Net net is that I cannot get inheritance to work. My default page shows the buttons, but doesn't show the background button which is inherited from pg_Template. And the hard button navigation is not working either, which is also inherited. That comment is based on selecting the Onkyo button, which calls another page (also doesn't get the background inherited), and the back hard button does not take me back to the previous page.

I'll keep studying this, and if I get an answer, will post it back for anyone in the future that may run into this.

BTW...rkirmeier...thanks for the info on entering code snippits.



<Pages>
<Page id="pg_Template">
<Parameters>
<Locale id="default">
<Parameter name="labelColor">ffffffff</Parameter>
<Parameter name="labelSize" action="display,release">20</Parameter>
<Parameter name="labelSize" action="touch">30</Parameter>
<Parameter name="labelXOffset">-6</Parameter>
<Parameter name="labelYOffset">-8</Parameter>
<Parameter name="labelShadowRadius">3</Parameter>
<Parameter name="labelShadowXOffset">3</Parameter>
<Parameter name="labelShadowYOffset">3</Parameter>
<Parameter name="labelShadowColor">ff000000</Parameter>
<!-- <Parameter name="spriteAnimation" action="touch">globe</Parameter> -->
<!-- <Parameter name="animation" action="display">0:fadein,r500-1000,0</Parameter> -->
<Parameter name="buttonTintColor" action="touch">FFFF3737</Parameter>
<Parameter name="buttonTintColor" action="display,release">FFFFFFFF</Parameter>
<!--Parameter name="labelStyle">bold</Parameter-->
<Parameter name="labelTypeface">aero</Parameter>
<Parameter name="vibrateLength">50</Parameter>
<Parameter name="playSound" action="touch">pop</Parameter>
</Locale>
</Parameters>
<Buttons>
<ButtonGroup id="btngrp_template_background">
<Button id="btn_background" width="fill" height="fill">
<Locale id="default">
<Parameter name="imageUrl">/buttons/Main.jpg</Parameter>
<Parameter name="inactiveElement">true</Parameter>
<Parameter name="scaleType">fitxy</Parameter>
<Parameter name="animation" action="display"></Parameter>
</Locale>
</Button>

</ButtonGroup>

<ButtonGroup id="btngrp_template_nav">
<Parameters>
<Locale id="default">
<Parameter name="animation" action="display"></Parameter>
</Locale>
</Parameters>
<Button id="btn_previous_page" hardButton="back">
<Locale id="default">
<Parameter name="linkPreviousPage">true</Parameter>
</Locale>
</Button>
<Button id="btn_search" hardButton="search">
<Locale id="default">
<Parameter name="doVoiceControl">true</Parameter>
</Locale>
</Button>
</ButtonGroup>
</Buttons>
</Page>

<Page id="pg_HTPC" inheritFrom="pg_Template">
<Buttons>
<ButtonGroup id="htpc_background" intheritFrom="btngrp_template_background"/>
<ButtonGroup id="btngrp_htpc_nav" inheritFrom="btngrp_template_nav"/>
<ButtonGroup id="btngrp_template_htpc" margins="0,150,0,0">
<Button id="WOL">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">WOL</Parameter>
<Parameter name="wakeOnLan">192.168.0.20|00:1F:D0:20:C5:E0</Parameter>
</Locale>
</Button>
<Button id="HTPCSleep" alignRightOf="WOL">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">HTPC Sleep</Parameter>
<Parameter name="serviceParams">device=2,event=HTPCSleep</Parameter>
</Locale>
</Button>
<Button id="REBOOT" alignRightOf="HTPCSleep">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">HTPC Reboot</Parameter>
<Parameter name="serviceParams">device=2, event=HTPCReboot</Parameter>
</Locale>
</Button>
<Button id="HTPCShutdown" alignRightOf="REBOOT">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">Shutdown</Parameter>
<Parameter name="serviceParams">device=2,event=HTPCShutdown</Parameter>
</Locale>
</Button>
<Button id="pg_Onkyo" alignRightOf="HTPCShutdown">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">Onkyo</Parameter>
<Parameter name="pageLink">pg_Onkyo</Parameter>
</Locale>
</Button>
</ButtonGroup>
</Buttons>
</Page>
<Page id="pg_Onkyo" inheritFrom="pg_Template">

<Buttons>
<ButtonGroup id="htpc_background" intheritFrom="btngrp_template_background"/>
<ButtonGRoup id="btngrp_htpc_nav" inheritFrom="btngrp_template_nav"/>
<Buttongroup id="Maingroup" inheritFrom="btngrp_template_htpc"> //atempting to inherit htpc page buttons...but doesn't work either
<Button id="pg_Main">
<Locale id="default">
<Parameter name="animation" action="display"></Parameter>
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">Main</Parameter>
<Parameter name="pageLink">pg_Main</Parameter>
</Locale>
</Button>
</Buttongroup>
</Buttons>
</Page>

rkirmeier
July 7th, 2011, 03:23 PM
I don't necessarily expect anyone to study this hard and answer, but being more familiar with this than I you may see my issue at a quick glance. Net net is that I cannot get inheritance to work. My default page shows the buttons, but doesn't show the background button which is inherited from pg_Template. And the hard button navigation is not working either, which is also inherited. That comment is based on selecting the Onkyo button, which calls another page (also doesn't get the background inherited), and the back hard button does not take me back to the previous page.

I'll keep studying this, and if I get an answer, will post it back for anyone in the future that may run into this.

BTW...rkirmeier...thanks for the info on entering code snippits.



<Pages>
<Page id="pg_Template">
<Parameters>
<Locale id="default">
<Parameter name="labelColor">ffffffff</Parameter>
<Parameter name="labelSize" action="display,release">20</Parameter>
<Parameter name="labelSize" action="touch">30</Parameter>
<Parameter name="labelXOffset">-6</Parameter>
<Parameter name="labelYOffset">-8</Parameter>
<Parameter name="labelShadowRadius">3</Parameter>
<Parameter name="labelShadowXOffset">3</Parameter>
<Parameter name="labelShadowYOffset">3</Parameter>
<Parameter name="labelShadowColor">ff000000</Parameter>
<!-- <Parameter name="spriteAnimation" action="touch">globe</Parameter> -->
<!-- <Parameter name="animation" action="display">0:fadein,r500-1000,0</Parameter> -->
<Parameter name="buttonTintColor" action="touch">FFFF3737</Parameter>
<Parameter name="buttonTintColor" action="display,release">FFFFFFFF</Parameter>
<!--Parameter name="labelStyle">bold</Parameter-->
<Parameter name="labelTypeface">aero</Parameter>
<Parameter name="vibrateLength">50</Parameter>
<Parameter name="playSound" action="touch">pop</Parameter>
</Locale>
</Parameters>
<Buttons>
<ButtonGroup id="btngrp_template_background">
<Button id="btn_background" width="fill" height="fill">
<Locale id="default">
<Parameter name="imageUrl">/buttons/Main.jpg</Parameter>
<Parameter name="inactiveElement">true</Parameter>
<Parameter name="scaleType">fitxy</Parameter>
<Parameter name="animation" action="display"></Parameter>
</Locale>
</Button>

</ButtonGroup>

<ButtonGroup id="btngrp_template_nav">
<Parameters>
<Locale id="default">
<Parameter name="animation" action="display"></Parameter>
</Locale>
</Parameters>
<Button id="btn_previous_page" hardButton="back">
<Locale id="default">
<Parameter name="linkPreviousPage">true</Parameter>
</Locale>
</Button>
<Button id="btn_search" hardButton="search">
<Locale id="default">
<Parameter name="doVoiceControl">true</Parameter>
</Locale>
</Button>
</ButtonGroup>
</Buttons>
</Page>

<Page id="pg_HTPC" inheritFrom="pg_Template">
<Buttons>
<ButtonGroup id="htpc_background" intheritFrom="btngrp_template_background"/>
<ButtonGroup id="btngrp_htpc_nav" inheritFrom="btngrp_template_nav"/>
<ButtonGroup id="btngrp_template_htpc" margins="0,150,0,0">
<Button id="WOL">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">WOL</Parameter>
<Parameter name="wakeOnLan">192.168.0.20|00:1F:D0:20:C5:E0</Parameter>
</Locale>
</Button>
<Button id="HTPCSleep" alignRightOf="WOL">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">HTPC Sleep</Parameter>
<Parameter name="serviceParams">device=2,event=HTPCSleep</Parameter>
</Locale>
</Button>
<Button id="REBOOT" alignRightOf="HTPCSleep">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">HTPC Reboot</Parameter>
<Parameter name="serviceParams">device=2, event=HTPCReboot</Parameter>
</Locale>
</Button>
<Button id="HTPCShutdown" alignRightOf="REBOOT">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">Shutdown</Parameter>
<Parameter name="serviceParams">device=2,event=HTPCShutdown</Parameter>
</Locale>
</Button>
<Button id="pg_Onkyo" alignRightOf="HTPCShutdown">
<Locale id="default">
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">Onkyo</Parameter>
<Parameter name="pageLink">pg_Onkyo</Parameter>
</Locale>
</Button>
</ButtonGroup>
</Buttons>
</Page>
<Page id="pg_Onkyo" inheritFrom="pg_Template">

<Buttons>
<ButtonGroup id="htpc_background" intheritFrom="btngrp_template_background"/>
<ButtonGRoup id="btngrp_htpc_nav" inheritFrom="btngrp_template_nav"/>
<Buttongroup id="Maingroup" inheritFrom="btngrp_template_htpc"> //atempting to inherit htpc page buttons...but doesn't work either
<Button id="pg_Main">
<Locale id="default">
<Parameter name="animation" action="display"></Parameter>
<Parameter name="imageUrl">/buttons/bluebutton.png</Parameter>
<Parameter name="buttonLabel">Main</Parameter>
<Parameter name="pageLink">pg_Main</Parameter>
</Locale>
</Button>
</Buttongroup>
</Buttons>
</Page>




I don't use any inheritance at this point since my config is only a single page for 8 zones, 5 activities (devices), and 3 output devices (TV, PJ, AMP) so I don't know if I will be of any help... :)

I did notice on one line of code that you did not terminate the line correctly...



<Buttongroup id="Maingroup" inheritFrom="btngrp_template_htpc">


should be...



<Buttongroup id="Maingroup" inheritFrom="btngrp_template_htpc" />

ewingr
July 7th, 2011, 03:27 PM
Thanks

Actually, I am later adding a different button, so the termination is in a later </Buttongroup> statement.

IN any event that doesn't help the inheritance problem on the default page, even if it is an issue.

Thanks for looking though. I'll keep trying to figure it out, and will post what I come up with.

BTW...I am still using 1.7.6b

ewingr
July 7th, 2011, 10:17 PM
Alignment: right next to previous button
I've given up on inheritance, and will also write out everything for each button.

The next thing I am struggling with is placement. In particular, I am trying to duplicate what the demo config has for the NAV group, with the 4 buttons for HD, SD, XBox 360, Source, and Widget. They are all positioned directly next to each other...touching at edges.

It appears from the example config file that it is done with the alignrightOf= parameter. But when I use that, I get a bit of a space between each button.

By the way, I tried adding margins="0,0,0,0" after the alignrightOf parameter. That didn't help either.

Any thoughts?

Fonts on device
Also, one other question: Do Fonts not get downloaded with the config to the local device? When I launch Andre while the HTPC is off, I get errors that teh fonts are not found.

Network issue in Andre
I find that sometimes, particularly when I have had the Tablet shutdown overnight, that when I launch Andre and try to use the WOL, it doesn't work. If I click one of the other buttons a couple times (doesn't happen when clicking the WOL button for some reason], I get a 'No Connection...check network' error. But the tablet is on the network and working fine.

rkirmeier
July 8th, 2011, 01:40 PM
Alignment: right next to previous button
I've given up on inheritance, and will also write out everything for each button.

The next thing I am struggling with is placement. In particular, I am trying to duplicate what the demo config has for the NAV group, with the 4 buttons for HD, SD, XBox 360, Source, and Widget. They are all positioned directly next to each other...touching at edges.

It appears from the example config file that it is done with the alignrightOf= parameter. But when I use that, I get a bit of a space between each button.

By the way, I tried adding margins="0,0,0,0" after the alignrightOf parameter. That didn't help either.

Any thoughts?

Fonts on device
Also, one other question: Do Fonts not get downloaded with the config to the local device? When I launch Andre while the HTPC is off, I get errors that teh fonts are not found.

Network issue in Andre
I find that sometimes, particularly when I have had the Tablet shutdown overnight, that when I launch Andre and try to use the WOL, it doesn't work. If I click one of the other buttons a couple times (doesn't happen when clicking the WOL button for some reason], I get a 'No Connection...check network' error. But the tablet is on the network and working fine.


I wouldn't give up on inheritance... What I would do is create a backup on your xml file then remove everything expect for the base required code and the code for your base button and the page you are inheriting. This will help you determine if it's really an andre issue or a code issue. I had some strange behavior going on and basically did this and remove code until the problem went away. I then discovered that while doing copy and paste of buttons that I forgot to change a button name so I had several buttons that had the same same. Not saying this is your problem but this should help to determine if you have some code issues.

As for the network issue. I have not experienced this issue on my Evo (gingerbread) unless my wifi signal is weak or gone. Could be something to do with Honeycomb, one of these days I'll get around to working on my config for the tab. The difference between the feedback from the WOL and other buttons is probably because WOL will simply send out ethernet subnet broadcast for the MAC address of the device you are issuing the WOL whereas a button may require TCP/IP (2 way communications). Just a thought...

Under wifi advanced settings you should be able to set your wifi policy to never sleep. I always set this on all my devices! In wifi panel click Mneu then advanced.

As for the alignment... I don't have any graphics that split requiring seamless alignment so not sure if I would have issue or not. You can use negatives in the margin settings which should solve the issue...

ewingr
July 8th, 2011, 03:50 PM
I wouldn't give up on inheritance... What I would do is create a backup on your xml file then remove everything expect for the base required code and the code for your base button and the page you are inheriting. This will help you determine if it's really an andre issue or a code issue. I had some strange behavior going on and basically did this and remove code until the problem went away. I then discovered that while doing copy and paste of buttons that I forgot to change a button name so I had several buttons that had the same same. Not saying this is your problem but this should help to determine if you have some code issues.

I've tried that, but...I will do it and create the most basic set of inputs and parameters and see if I can get it to work, and expand from there.



As for the network issue. I have not experienced this issue on my Evo (gingerbread) unless my wifi signal is weak or gone. Could be something to do with Honeycomb, one of these days I'll get around to working on my config for the tab. The difference between the feedback from the WOL and other buttons is probably because WOL will simply send out ethernet subnet broadcast for the MAC address of the device you are issuing the WOL whereas a button may require TCP/IP (2 way communications). Just a thought...

The network issue is definitely something Andre related...maybe due to Honeycomb. But all other apps communicate fine over the network; including the other WOL program. Maybe because Andre realizes that the HTPC is not up and running when it launches, it won't even send the WOL. Because once I boot the HTPC, then have Andre load and see it, then I can put it to sleep, and do the WOL, and it works fine.



As for the alignment... I don't have any graphics that split requiring seamless alignment so not sure if I would have issue or not. You can use negatives in the margin settings which should solve the issue....

I had tried that and thought it didn't work...but turns out I needed a larger negative number. That is working.

This sure has been a learning curve ;-) ... but I enjoy learning and piddling with this type of stuff.

[EDIT]
Tried a simple file, and still no luck with inheritance. I'll try to simplify it more, and post it. Maybe ultimately HTLuke can glance at it and tell me what I'm doing wrong. I'm sure its something I'm doing.

ewingr
July 8th, 2011, 04:46 PM
Here is my simple code. First page (pg_template) is default with 3 buttons: background, WOL button, and a button to call the next page. When the next page comes up, which has two inherited buttons: the background, and the WOL button, I get no background, and no WOL button.

I"m sure I"m doing something wrong, but I have no idea what:



<?xml version="1.0" encoding="UTF-8"?>
<Remote>
<Locales>
<LocaleDef id="livingroom" name="Living Room"/>
</Locales>
<Settings>
<StartPage>pg_Template</StartPage>
<StartLocale>livingroom</StartLocale>
</Settings>
<Sounds>
<Sound id="pop" url="/pop.ogg" />
</Sounds>
<Fonts>
<Font id="baroque" url="/Andre/Fonts/BaroqueScript.ttf" />
<Font id="Aero" url="/Andre/Fonts/Aero.ttf" />
<Font id="airstream" url="/Andre/Fonts/airstreamNF.ttf" />
</Fonts>
<Pages>
<Page id="pg_Template">
<Buttons>
<ButtonGroup id="btngrp_template_background">
<Button id="btn_background" width="fill" height="fill">
<Locale id="default">
<Parameter name="imageUrl">/buttons/Main.jpg</Parameter>
<Parameter name="inactiveElement">true</Parameter>
<Parameter name="scaleType">fitxy</Parameter>
<Parameter name="animation" action="display"/>
</Locale>
</Button>
<Button id="WOL" margins="0,150,0,0">
<Locale id="default">
<Parameter action="display" name="imageUrl">/buttons/LeftEdge.png</Parameter>
<Parameter name="labelColor">ffffffff</Parameter>
<Parameter name="buttonTintColor" action="touch">FFa09d9d</Parameter>
<Parameter name="buttonTintColor" action="display,release">FFFFFFFF</Parameter>
<!--Parameter action="touch,heldStart,heldRepeat,release" name="imageUrl">/buttons/LeftEdgeDown.png</Parameter-->
<Parameter name="buttonLabel">WOL</Parameter>
<Parameter name="wakeOnLan">192.168.0.20|00:1F:D0:20:C5:E0</Parameter>
</Locale>
</Button>
<Button id="pg_Onkyo" alignRightOf="WOL" margins="-15,150,0,0">
<Locale id="default">
<Parameter name="imageUrl">/buttons/CenterEdge.png</Parameter>
<Parameter name="labelColor">ffffffff</Parameter>
<Parameter name="buttonLabel">Page Onkyo</Parameter>
<Parameter name="pageLink">pg_Onkyo</Parameter>
</Locale>
</Button>
</ButtonGroup>

</Buttons>
</Page>
<Page id="pg_Onkyo" inheritFrom="pg_Template">

<Buttons>
<ButtonGroup id="onkyo_background" intheritFrom="btngrp_template_background"/>
<Button id="on_bkgrnd" inheritFrom="btn_background"/>
<Button id="onkyo_WOL" inheritFrom="WOL"/>

</Buttons>
</Page>
</Pages>
</Remote>


You know, I'm beginning to think I still need to enter all the commands to display them. Although I did not see the evidence of that in the example config.xml. But maybe its there buried where I haven't looked yet. But if so, I"m not really sure what all the inheritance is about. Maybe parameters other than displaying them. The older docs multi page example does not include inheritance.

[EDIT]
Just tried to install 1.77b on the tablet, as well as my Captivate (2.2 Android) and it will not install on either.

Update 7/19

Not sure why above didn't inherit, and not chasing it at the moment, but I do have inheritance working.

rkirmeier
July 10th, 2011, 06:34 PM
Remove existing Andre then install new version instead of upgrade...

ewingr
July 10th, 2011, 09:12 PM
I think I tried that, but will try again.

...

Yep...that worked. I thought I had done that, but apparently not.

ewingr
July 11th, 2011, 09:04 PM
I see something about scripts in the example config.xml file. But I see nothing about scripts in the manual yet.

Not sure what language the 'script' would be. But here's an example of code that I think will send commands to the Onkyo receiver over the LAN (it uses ISCP, but I am told this accomplishes that). So I"m wondering if I may be able to write scripts in this to send to the Onkyo

The example code:



import socket

# create a socket connection
s = socket.socket()
s.connect(('192.168.0.123', 60128))

# setup command - in this case, 'power on'
cmd="!1PWR01"

length=len(cmd)
print cmd
length=length+1
code = chr( length )

# setup the string we are sending ...
line = "ISCP\x00\x00\x00\x10\x00\x00\x00code\x01\x00\x00\x 00cmd\x0D";
line = line.replace("code", code)
line = line.replace("cmd", cmd)
# send it !
s.send(line)
# close the socket
#data = s.recv(1024)
data = s.recvfrom(65565)
s.close()
print data



I have to confess that the post I found this example code on does not specify what language or script it is for. I"m thinking Visual Basic, maybe.

Update 7/19
Given that scripting is in Java Script (which I need to learn ...) I presume ultimately I will be able to directly send commands to the Onkyo similar to the script included here.

rkirmeier
July 12th, 2011, 09:46 AM
When in doubt go back and read the entire thread... The scripting language is javascript.

ewingr
July 12th, 2011, 11:24 AM
Sure enough. Its time I read it again. The first time, I knew nothing about this app, and most went over my head and out the door. Now that I know at least a little, maybe some will stick.

Hopefully I'll get a hint on my problem with inheritance. I have commented out lines in the example, and determined it is working as I expected, identifying the lines that bring forward the inherited things. But I just cannot duplicate it in my file. I must me overlooking something. It must be one of those things that is obvious, but just can't bee seen unless the next guy looks at it ;-)

Its interesting that apparently nobody but you and I are messing with this. It is going to be a nice tool.

I'll post a couple screen shots of what I'm building just for interest in a bit.

...Ok... here's a couple screen shots of what I"ve got so far. Been working pretty fast. I'm sure this design will change immensely. But going easy method while learning (also a bit of learning in Photoshop while I create all the graphics and buttons):

Default Page:

http://i132.photobucket.com/albums/q17/kruiser_56/P20110712220141.png

And the Onkyo Page.

http://i132.photobucket.com/albums/q17/kruiser_56/P20110712220130.png

The Music button just launches Gizmo.

ewingr
July 12th, 2011, 09:59 PM
OKay...I've just finished reading through the whole thread again. Definitely turned on some lights, and put a few that were out at least on dim. (he he ) (smilies no workee).

JFYI...on my Asus Transformer (Honeycomb), I am not finding yet that any of the attempts to stop it from dropping from memory to help. If I go out to home for a while and go back, it always reloads. It is interesting, as it is running, I can switch to it, but it reloads. I wonder if the reload process itself needs to be revisited. Does it really mean it has been dumped from memory, when I can change to it from the task list (or whatever that button on Honeycomb is called)? My expectations would be if it was dumped from memory, I'd have to launch it again.

Well, I didn't find any answers to my inherited problem, although, reirmeir, I see you have a similar problem for inheritance on the Buttongroup. All of my inheritance issues have been for button groups. But whats interesting, is as I noted above, the sample config file seems to work.

HTLuke...when you get back to this thread...just want to say again...WOW. You are doing a great job. Just from this thread, your interactions, and coding, I see evidence of a great coder, with the right attitude and methods to create a great app for end users. reirmeir has given you a lot of good suggestions, and you happily jump on them, and enhance even more. Bravo! I like your thoughts of what you have yet to do. Lots of work ahead of you.

Well, back to my learning curve and see what else I can get done.

Update 7/19
JFYI...still drops from memory, and needs to refresh even if still in memory and haven't been in focus for a while.

rkirmeier
July 13th, 2011, 09:25 AM
I'll have to look into the reloading on my Transformer. I'm pretty sure it's being closed when it needs to reload, might be a bug in HC that it's not removing it from the task list. Or it could be the new service option that is causing the task list to stay populated but the actual app still needs to be reloaded since the current service option is not really working at all...

Never that less it performs much faster on my Transformer then my EVO and don't use it much there so I just haven't really noticed this issue much on there...

ewingr
July 13th, 2011, 09:42 AM
Well, interesting...I just entered inheritance commands for my Zone2 screen from Zone1 (which is in the printscreen above).

All the buttons came down; the positioning of the center 3 came in at the top of the screen; the background button did not inherit.

Progress...


[EDIT]
The docs indicate I can use any text as a state. I have entered this statement:

<Parameter name="changeState" action="release">inactive</Parameter>

And when I click the button that has it, I get an error "State 'inactive' does not exist for button...". If I change it to active, then no errors.

I don't recollect reading in this thread that state must be a certain list of states. I did a search on state, and too many posts with the word to read through.

Update 7/19
Above state issue resolved, and noted in later post.

rkirmeier
July 14th, 2011, 10:49 AM
Do you have both states defined on the actual button? This is the state name and the default state is 'default'. Post the button code...

ewingr
July 14th, 2011, 06:07 PM
That is it, I believe. I was trying to define a state but from a different button. So apparently, in order to assign a state to a button I would need to first 'define' it on the original button.

All I can find in the documentation for 'defining' a state is ChangeState parameter. So, tell me if this is incorrect: If I may later want to assign a button to a state of 'inactive', I will have to change the state of the button to 'inactive' in the original definition of the button (even thought I don't want it to be inactive at the moment), then change it back to 'default', or 'active', if I prefer that.

That way the inactive state will exist, and I can assign it from a different button.

That it?

ewingr
July 14th, 2011, 09:04 PM
I recall that there were some problems with execIf. I think maybe we are waiting for his return and a fix. Just did a search on the thread though, and for some reason didn't find the issue.

I have this button code, in which I have a usersel command populate a variable, and later an execIf that launches the Dish app IF I had selected Yes on the list. Problem is, it launches the app immediately after clicking the button, then when I back out of the app, the select dialog box is there. Here is the code. Also, I did define the variables at the top of the program. Default value for the variable is No. Oh well, here is that code:



<Variables>
<Variable id="var_Lch_Dish">No!</Variable>
<Variable id="vaf_disp_lch_dish">No!</Variable>
</Variables>


Just curious if I have something wrong with the code, or if execif is broken:



<Button id="DISH_IN" alignRightOf="INET_IN" margins="20,550,0,0">
<Locale id="default">
<Parameter name="imageUrl">/buttons/btn_input_up.png</Parameter>
<Parameter name="buttonTintColor" action="touch">FFa09d9d</Parameter>
<Parameter name="buttonTintColor" action="display,release">FFFFFFFF</Parameter>
<Parameter name="buttonLabel">Dish</Parameter>
<Parameter name="changeState" action="release">active</Parameter>
<Parameter name="changeState" action="release">HTPC_IN=default,Tuner_IN=default,INET_IN=default,M usic_Server_IN=default,VCR_IN=default</Parameter>
<Parameter name="serviceParams">device=1,event=Onk_Input_DISH</Parameter>
<Parameter name="userSelectInput">Launch Dish App?|Yes,No|Yes,No|var_Lch_Dish|vaf_disp_lch_dish</Parameter>


<Parameter name="imageUrl" state="active" >/buttons/btn_input_down.png</Parameter>
<Parameter name="changeState" state="active" action="release" >default</Parameter>
<Parameter name="labelStyle" state="active" >bold</Parameter>
<Parameter name="launchApp" execIF="'Yes'=='_%var_Lch_Dish%_'">Dish</Parameter>

</Locale>
</Button>


Update 7/19
Resolved and noted in later post.

rkirmeier
July 15th, 2011, 06:29 AM
For starters execIF should be execIf

ewingr
July 15th, 2011, 09:20 AM
Very good start. My eyes didn't see that. That did make it so that now Dish doesn't launch before the prompt screen. But, it doesn't launch no matter how I answer the question, unless I hit the button again. Something is not interpreting as I expect.

It would see to me that this is the order of the code:

Press button
Ask if want to launch Dish.
Answer yes, so variable gets changed from default of No to Yes
The execIf line will launch Dish if the variable is Yes. Having just changed the variable to Yes, it should launch

But it doesn't launch until I hit the button again, at which time it immediately launches Dish, at which time when I come back to Andre, it is asking the question again.

Thanks again for your input.

rkirmeier
July 15th, 2011, 12:29 PM
Probably won't work like that. Look back at my posts regarding the UserSelectInput and HTLuke's response. Basically the userSelectInput calls an Android function and does not stop the processing in Andre so your app launch call is happening the moment you click the button. Instead make a service button (zero out the size so it's hidden) with the launchapp parameter in that button. Call the service button from UserSelectInput.

ewingr
July 15th, 2011, 01:38 PM
Thanks. So, I just found the other syntax for userSelectInput which has the parameters for calling another button. I'll study through it and give it a shot.

HTLuke's programming is excellent. It will be nice when the docs are completed. Keeping track in this thread is a bit challenging, but I am catching up. Your help is much appreciated.

[EDIT]
Celebration...got it to work on first attempt (he he)

Another interesting thing, probably again related to how this flows when. I added a state="default" parameter to the userSelectInput statement, as I only want it to pop up in default state, not if the button is active. It gets put into active state on release after first click. But on second click, which is when I am thinking it is active (and seems to be, as the different graphic is used which is defined for active state), it still runs. Maybe for some reason the state setting is not valid for userSelectInput. It did not show that in the example in this thread. Have you used state on that parameter?




<Button id="DISH_IN" alignRightOf="INET_IN" margins="20,550,0,0">
<Locale id="default">
<Parameter name="imageUrl">/buttons/btn_input_up.png</Parameter>
<Parameter name="buttonTintColor" action="touch">FFa09d9d</Parameter>
<Parameter name="buttonTintColor" action="display,release">FFFFFFFF</Parameter>
<Parameter name="buttonLabel">Dish</Parameter>
<Parameter name="userSelectInput" state="default">Launch Dish App?|Yes,No|Yes,No|var_Lch_Dish|var_disp_lch_dish| pg_Onkyo|btn_Call_Dish|touch|true|false|false|fals e</Parameter>
<Parameter name="changeState" action="release">active</Parameter>
<Parameter name="changeState" action="release">HTPC_IN=default,Tuner_IN=default,INET_IN=default,M usic_Server_IN=default,VCR_IN=default</Parameter>
<Parameter name="changeState" state="active" action="release" >default</Parameter>

<Parameter name="serviceParams">device=1,event=Onk_Input_DISH</Parameter>
<Parameter name="imageUrl" state="active" >/buttons/btn_input_down.png</Parameter>
<Parameter name="labelStyle" state="active" >bold</Parameter>

</Locale>
</Button>

ewingr
July 17th, 2011, 06:16 AM
When I press the button per code below, I get a Force Close in Andre. Any thoughts as to why that would be?



<Button id="btn_REBOOT" alignBelow="btn_HTPCSleep" margins="20,0,0,0">
<Locale id="default">
<Parameter name="imageUrl">/buttons/Blue.png</Parameter>
<Parameter name="buttonLabel">HTPC Reboot</Parameter>
<Parameter name="serviceParams">device=2, event=HTPCReboot</Parameter>
</Locale>
</Button>

rkirmeier
July 17th, 2011, 10:38 PM
Maybe the space in the serviceparms line?

rkirmeier
July 18th, 2011, 08:29 AM
You shouldn't need the state parameter for default although you may be correct in that it does not work with userselectinput. I would keep a list of any bugs find that you can't resolve then when Luke it back post them in 1 list so it's easy for him to review without reading all the posts and getting side-tracked...

HTLuke
July 19th, 2011, 05:39 AM
Hi guys,

I had some unfortunate luck two weeks ago and lost about four (long) days worth of work, and then had to immediately do some unexpected travelling so I've been unable to re-do the code I lost or keep up with the messages. I'm back to working on things as of tonight though and should make up the lost code and then some over the next few days. I'll also catch up with the messages here to see if there's any unanswered questions.