I have a USB GPS device that puts out periodic serial information. I want to read that serial data, save some of it in local variables if needed and feed that information to an Iframe widget in an HTML5 object.
How are these processes done? I can't figure out how to read the data coming in the USB port. (I have not seen that setting the Serial interface as a GPS port allows me to do any actual reading of the data and the GPS Receiver checkbox forces 4800 baud onto port 2 when the dongle talks at 9600 baud).
Once I get there, I have to figure out how to dynamically modify the html Site Specification string with the Lat / Lon info and relaunch.. Or is there a better way?
18 comments
-
David Herde This would be like feeding a weather widget or a transit widget automatically depending when the unit is placed.
-
David Herde "when" should be "where" sorry.
-
David Herde I will be starting with 40 devices placed around the city so it behooves me to make this generic.
-
Bright Scripters Hi David,
From a recent poking in the BrightAuthor autorun code, I found that USB GPS devices, are introduced to the system just like any other serial ports.
I don't have a way to test it, but try to capture data coming from Serial port 2, or any port you have designated to GPS in the presentation properties.
See screenshots, showing what I would try first, have I had a GPS device to test with :)
The idea is to capture the serial input, and store it in a User Variable.
Then you would present the variable value in HTML or with a Live Text state.
You can also parse the serial input with the asterisk (wildcard).
http://docs.brightsign.biz/display/DOC/Serial+Input
Please share your results, whatever they are.
(GPS: Gotta Pull-over Soon)
-
David Herde Thanks for your kind ideas..
No love thus far..
My test unit is a XD1132.
I have a thumb drive in USB port A (which I am using for initial setup and storage) and the GPS in USB port B.I set up a GPSData variable as private local
I set up all of the com ports so that they should be able to talk to the dongle.
I tried setting them as a GPS device but got nothing so I set them up as just serial devices to catch anything.
Set up the event handler and serial event, but on preview it does not seem to trigger so I can't tell if it is doing anything. I linked a live text field to it, but do not get anything except the default text.Is there a way to monitor events?
Is there any way to show what port has something attached to it?Thanks..
-
Bright Scripters You cannot test such application using the BrightAuthor preview feature.
Please test on a player.
You can use the XD1132 DB9 serial port to get some insight.
You would need to connect to a computer equipped with a serial port (or with USB to serial adapter)
The DB9 port is serial 0.
You would use an application like putty, or similar serial terminal emulator software.
(The serial port is the bright scripter's best friend... :)
For tracking events, you could enable logging during the player setup process.
Happy scripting!
-
David Herde Thanks for that.. I have found a problem in that when I set up that Interactive Interface for GPS, it wants the port to talk at 4800 baud. (Resets to that and greys all port settings out.)
The GPS dongle I have talks at 19200,N,8,1.
Is there a way to change the baud rate for a GPS object in the Interactive interface ? or do I need to reinvent the object and functionality in code?
-
Bright Scripters Can the GPS dongle be configured to a different baud rate?
You may be able to manually edit the baud rate in the bps file, and publish without actually opening the bps file in BA.
Exit BA
Edit the bps in Notepadd++ or similar
Launch BA, and go directly to Publish, without opening the presentation file
Publish the presentation to the player or SD card.
I never tried that, so the process my need some tweaking... :)
-
David Herde Good Question about the dongle.. I'll have to check it out.
Regarding the clever work around, I don't know that I could be comfortable going there.
While I may be able to force the workaround onto a unit, it would violate the Bright Author workflow and really be a volatile duck and would not allow for any adaptation or further development.
Would there be any way to have an auto detect subroutine for ports?
I expect something out there exists for this, but It would need to be integrated into the Bright Author interface which is way outside my sphere of influence.
Any thoughts?
Thanks..
-
David Herde I suppose the correct way to look at it is to allow a port to be tagged as GPS without forcing the port values to certain specs.
Is there a way to talk to Brightsign about this?
Thanks..
-
David Herde Or implement both notions......
-
Bright Scripters If configuring the dongle is an option, it would be the cleanest solution.
Thinking about it now, I think that the dongle may not be able to keep the speed change between power cycles...
In your place I would first try the BA hack, merely to confirm that the dongle is compatible with BrightSign. Once confirmed, that would be the time to bring in the BrightSign big guns :) -
David Herde I know the dongle is compatible except for the baud rate. I can pull in the NMEA compliant stream fine on port 2 without the GPS box checked. The dongle just talks faster than 4800 baud.
-
David Herde I have a 4800 baud compatible dongle and it configures the port as GPS.
In the debug stream, it shows the location lat and lon. How can I access those number and get them into a user variable?
I find references to m.bsp.gpslocation.latitude and .longitude, but without changing the autorun, how can I get at those values?
Thanks..
-
David Herde (Just as a note..... Would lat, lon and fix be good to include as a system variable?
-
Shaun David, did you resolve this?
-
David Herde Not yet..
I have created a plugin that does not crash, however, I find that I need a better understanding of variable scope and context.
Where do I make a Lat, lon, fix variable array that I can access globally? (And how do I set up that global object?)
If I create a variable array in the plugin init, does it persist?
Is a new instance created whenever a plugin call is made?
How do I reference that variable outside of the plugin?
Can I set object (interfaces?) properties for the plugin, (as in tarcplugin.lat and tarcplugin.lon) or can this be tied to some global variable created inside the init of the plugin?
Questions.. Questions..
Thanks for any insight..
-
Shaun Can you post a link to the plugin you are working on. I made a GPS based plugin sometime ago but can't find it for you to use but I might be able to save you some time. What exactly are you looking to read? Time, date, lon, lat etc.. Are you wanting to read these in a BA presentation or HTML site?