Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Javascript example error
02-07-2013, 11:31 PM
Post: #1
Javascript example error
Hello all. I'm very new to openhome and honestly fairly lost. I currently have a NAS with upnp/dlna already configured and have a Raspberry Pi setup as a renderer (using gmstreamer). My current control point is my android device, using BubbleUpnp, but I would like to use buttons and lcd connected to the Raspberry Pi to control music.

I'm a web programmer, so very familiar with python, javascript, etc., but much less familiar with C/C++/C#, so I thought the easiest way to learn this stuff might be to play with the javascript libraries. However, I can't even get the example (in OpenHome/Net/Bindings/Js/ControlPoint/example/basic) to work. I get a javascript error on line 330 of ohnet.subscriptionmanager.js ("Uncaught ReferenceError: nodeUdn is not defined").

I've tried putting in the IP address of my NAS, but no joy. Can someone give me a little guidance on how to get this going?

Thanks!

Branton
Find all posts by this user
03-07-2013, 09:19 AM
Post: #2
RE: Javascript example error
Hi,

Welcome to the openhome forums!

Can you try declaring the variable nodeUdn in the global scope. This variable should be set to the device's udn.
For the basic example, it should be set to

Code:
var nodeUdn = 'device-ohNetTestBasic';


I've updated the ohNet codebase to reflect this and should be available this evening (pending successful build).

Many Thanks

Chris
Find all posts by this user
03-07-2013, 11:51 AM
Post: #3
RE: Javascript example error
(02-07-2013 11:31 PM)bluecamel Wrote:  Hello all. I'm very new to openhome and honestly fairly lost. I currently have a NAS with upnp/dlna already configured and have a Raspberry Pi setup as a renderer (using gmstreamer). My current control point is my android device, using BubbleUpnp, but I would like to use buttons and lcd connected to the Raspberry Pi to control music.

I'm a web programmer, so very familiar with python, javascript, etc., but much less familiar with C/C++/C#, so I thought the easiest way to learn this stuff might be to play with the javascript libraries. However, I can't even get the example (in OpenHome/Net/Bindings/Js/ControlPoint/example/basic) to work. I get a javascript error on line 330 of ohnet.subscriptionmanager.js ("Uncaught ReferenceError: nodeUdn is not defined").

I've tried putting in the IP address of my NAS, but no joy. Can someone give me a little guidance on how to get this going?

Thanks!

Branton

Hi Branton,

I'm not sure if you are interested but I have written a Java renderer based on OpenHome and mplayer that can run on windows or a raspberry pi (hard or soft float wheezy).

I have also added a plugin interface with the intention of adding LCD and buttons control, but have not got round to that yet.

The code is at Java Renderer

The code for a plugin to drive the LCD would be something like below, at the moment it just prints to log file but it could use Pi4J to interface to the LCD

Code:
@PluginImplementation
public class LCDDisplayImpl implements LCDDislayInterface, Observer {

    private static Logger log = Logger.getLogger(LCDDisplayImpl.class);

    public LCDDisplayImpl() {
        log.debug("Init LCDDisplayImpl");
        PlayManager.getInstance().observInfoEvents(this);
        PlayManager.getInstance().observVolumeEvents(this);
        PlayManager.getInstance().observTimeEvents(this);        
    }

    @Override
    public void update(Observable o, Object e) {
        //log.debug("Event: " + e.toString());
        EventBase base = (EventBase)e;
        switch(base.getType())
        {
        case EVENTTRACKCHANGED:
            EventTrackChanged etc = (EventTrackChanged) e;
            CustomTrack track = etc.getTrack();
            if (track != null) {
                log.debug("TrackChanged: " + track.getArtist() + " : " + track.getMetadata());
            } else {
                log.debug("Track was NULL");
            }
            break;
        case EVENTUPDATETRACKMETATEXT:
            EventUpdateTrackMetaText et = (EventUpdateTrackMetaText) e;
            log.debug("Track Changed: " + et.getArtist() + " : " + et.getTitle());
            break;
        case EVENTVOLUMECHNANGED:
            EventVolumeChanged ev = (EventVolumeChanged)e;
            log.debug("VolumeChanged: " + ev.getVolume());
            break;            
        }        
    }
}

Pete..
Find all posts by this user


Forum Jump: