Results 1 to 10 of 10
  1.    #1  
    I have a home automation system that has a web server. You can send commands to it via typing a url in a browser. For example:

    Code:
    http://ip-address/ph-cgi/ccbutton?type=1&btnid=CABLEBOX&parm1=18
    changes the channel on my cable box.

    In Ares:
    How would I assign this url to a button widget?
    Is it possible to send the command without having the Pre open up a new card?

    I'm pretty sure I need to type something around here:

    Code:
    function MainAssistant(argFromPusher) {
    }
    
    MainAssistant.prototype = {
       setup: function() {
          Ares.setupSceneAssistant(this);
       },
       cleanup: function() {
          Ares.cleanupSceneAssistant(this);
       },
       button1Tap: function(inSender, event) {
          
       }
    };
  2. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #2  
    I would create a drawer. In the drawer I would embed the web interface. I would then have the button load the url in the drawer and then just never open the drawer.

    It would look like this if the drawer were open tho.



    obviously, you can load Style Matters from the Palm SDK onto your Emulator to get more details on how to set that up. I use eclipse tho so I don't know how the process would differ in Ares.

    Palm Pre Backup Utility...done!
    Locate Pre....done!
  3.    #3  
    Thanks for the response DrewPre.

    But, I still need training wheels (Ares).

    PowerPoint sums up the extent of my coding skills.
  4. pomokey's Avatar
    Posts
    526 Posts
    Global Posts
    540 Global Posts
    #4  
    what does the url return? html? xml? JSON? or is it just blank?

    give this a shot:

    Code:
     button1Tap: function(inSender, event) {
     	//setup the url for channel change
     	var url = "http://ip-address/ph-cgi/ccbutton?type=1&btnid=CABLEBOX&parm1=18";
    
     	//create new ajax request to submit the url
     	new Ajax.Request(url, {
     		method: 'get',
     		onSuccess: function(transport){
     			//looks like it worked, hooray
    			Mojo.Log.info('should have changed the channel');
     		}
     	});
    }
    you can red more about Ajax.request here:

    http://www.prototypejs.org/api/ajax/request
    Last edited by pomokey; 05/20/2010 at 06:27 PM.
  5.    #5  
    Thanks Pomokey,
    I messed something up as all I ended up with was a blank screen.

    Frankie at Palm gave me the following tip that worked like a charm:

    You can use WebService component to send the http request. In the Palette, drag the "Web Service" component onto the screen. In the property inspector, type in the URL in the url field. Then in your button tap function, invoke the WebService you just created. For example,

    Code:
    button1Tap: function(inSender, event) {
        this.$.webService1.execute();
    }
    HTH
    Between Palm and this Forum I am so stoked. In a million years I did not see myself actually making an app for my own phone. Now I can control the lights and home theater from my Palm Pre using an app I made myself.
  6. #6  
    I doubt this will help but you could tape the cable box remote to your pre...
  7.    #7  
    Quote Originally Posted by prequan View Post
    I doubt this will help but you could tape the cable box remote to your pre...
    You're right: not helpful.

    Plus the cable box remote isn't useful to turn lights on and off, open close curtains, like my Pre will now that I can control my home automation system via my personal app.
  8. #8  
    Quote Originally Posted by Mannyman View Post
    You're right: not helpful.

    Plus the cable box remote isn't useful to turn lights on and off, open close curtains, like my Pre will now that I can control my home automation system via my personal app.
    That's actually the most amazing thing ever.
  9.    #9  
    1st Scene CableBox with Zap2It TVGuide plus a couple of Music Channels I pump to anywhere in the house.
  10. DrewPre's Avatar
    Posts
    818 Posts
    Global Posts
    829 Global Posts
    #10  
    sweet! Good Job.

    Palm Pre Backup Utility...done!
    Locate Pre....done!

Posting Permissions