View Single Post
Posts: 1,203 | Thanked: 3,027 times | Joined on Dec 2010
#44
Blaizzen:

Finally managed to crack on. Plugin worked first time on Vista machine.

I'm trying to put together some code to enable GuidanceMockUp to provide route simulation. In the code we have two simulators, S60SimulatorPositionProvide and FfSimulatorPositionProvider. It checks for browser.S60 and creates as necessary. I was thinking along the lines of adding a button that appears after a route has been calculated that allows a simulation of the route to be played. I thought this may be beneficial for testing when attempting to add voice navigation. As of yet I've not coded anything other than remove the statement which checks to see if GuidanceMockup can provide guidance.

Here's what I've looked into so far:

The following code is called to signal a route being calculated successfully.
Code:
this.fireEvent(new nokia.aduno.utils.Event(RoutingModel.EVENT_ROUTE_CALCULATION_DONE, eventData));
This in turn calls is dispatched to a number of event handlers, with the route created being eventData. Looking into one such event handler in RoutingModel, you can follow the code to a call to applyRouteCalculationResult, which in turn iterates over all of the maneuvers in the route.

Looking in Maneuver:GetDescription, it is possible to see how the guidance messages are constructed using the different members stored in the object. This should enable the creation of some basic voice commands by stringing together several sound files, same as S60 version does if I recall correctly.

Could we therefore create a new class, say VoiceNav, that registers a new handler to listen for route completion, change etc. We could store a pointer? to the route and then parse the Maneuvers as needed for each instruction. There are a series of events in GuidanceModel:

Code:
    GuidanceModel.EVENT_GUIDANCE_STARTED = "guidanceStarted";
    GuidanceModel.EVENT_GUIDANCE_STOPPED = "guidanceStopped";
    GuidanceModel.EVENT_GUIDANCE_DONE = "guidanceDone";
    GuidanceModel.EVENT_ON_NEXT_MANEUVER_CHANGED = "guidanceOnManeuver";
If these are also generated by the plugin we could listen to these to start/stop the voice commands. Unfortunately the last one isn't implemented in the current index.html anywhere. I've not checked if its called on the N900.
 

The Following User Says Thank You to Android_808 For This Useful Post: