Active Topics

 



Notices


Reply
Thread Tools
Posts: 1,203 | Thanked: 3,027 times | Joined on Dec 2010
#21
I've never really looked into javascript much, so please ignore me if I'm being a complete idiot. I seem to recall some of the Maps stuff on N95 being Lua...Anyway

var cPLX = Components.classes["@nokia.com/MapsPlugin"].getService(Components.interfaces.IPlugin);
I'm guessing MapsPlugin is a XPCOM library. Where on the file system would this be located and would it be compiled or interpreted. I have found several warnings in the index.html file for functions like pause, resume etc. within GuidanceMockup which may be implemented in the library above. It would also appear that the Guidance instance is called by several dispatch functions. pauseNavigation() for example calls this._guidance.pause().

I imagine if there is a call to this library somewhere to display the directions at a given time on route, an extra function could be added to the dispatcher, using some sound library, to play standard Ovi voice files.
 

The Following User Says Thank You to Android_808 For This Useful Post:
Posts: 1,397 | Thanked: 2,126 times | Joined on Nov 2009 @ Dublin, Ireland
#22
It looks promising! Thanks a lot.
 
Blaizzen's Avatar
Posts: 397 | Thanked: 802 times | Joined on Jan 2010 @ Sydney
#23
Originally Posted by Android_808 View Post
I'm guessing MapsPlugin is a XPCOM library. Where on the file system would this be located and would it be compiled or interpreted. I have found several warnings in the index.html file for functions like pause, resume etc. within GuidanceMockup which may be implemented in the library above. It would also appear that the Guidance instance is called by several dispatch functions. pauseNavigation() for example calls this._guidance.pause().

I imagine if there is a call to this library somewhere to display the directions at a given time on route, an extra function could be added to the dispatcher, using some sound library, to play standard Ovi voice files.

I have actually been trying to follow the GuidanceModel function and access its functions (eg get the distance to next manaeuver using getNextManeuverDistance). However it seems that the plugin does not support any of these functions to being with. They seem to have just been thrown in there maybe for the future or a different OS. On the desktop GuidanceMockup is run since the oviplugin doesn't support GPS hence no guidance, however on the n900 it seems to "support" the GuidanceModel, so pausenavigation, repeatlastvoicecommand etc, but since the plugin doesn't have any of these commands, its basically returning nothing.

I'm thinking to get it to work, we might need to employ other methods, such as checking to see if the position comes close enough to a maneuver (ie we're driving over it) and hence the next one in the array is coming up (so notify the driver). However it won't have distance to next turn or any of the other features.

Otherwise we can somehow change the plugin to support those commands (which is probably impossible )
 

The Following 6 Users Say Thank You to Blaizzen For This Useful Post:
elie-7's Avatar
Posts: 968 | Thanked: 663 times | Joined on Jun 2010 @ Australia (Melbourne/vic) / Lebanon (Zgharta/north)
#24
best of luck man, you are doing a great job.
__________________
rolling down the street, smoking ENDO, sipping on gin and juice
laid back, with my mind on my money and my money on my mind .
 

The Following User Says Thank You to elie-7 For This Useful Post:
zdanee's Avatar
Posts: 311 | Thanked: 376 times | Joined on Nov 2010 @ Hungary
#25
So... if the whole OVI maps stuff is JavaScript can you add a function to import POIs from Symbian edition's XML?
 
elie-7's Avatar
Posts: 968 | Thanked: 663 times | Joined on Jun 2010 @ Australia (Melbourne/vic) / Lebanon (Zgharta/north)
#26
Originally Posted by zdanee View Post
So... if the whole OVI maps stuff is JavaScript can you add a function to import POIs from Symbian edition's XML?
that sounds like a great idea.
__________________
rolling down the street, smoking ENDO, sipping on gin and juice
laid back, with my mind on my money and my money on my mind .
 
Posts: 1,203 | Thanked: 3,027 times | Joined on Dec 2010
#27
Blaizzen:

As I say, I don't have a great deal of experience with Javascript, but could you help me understand the following a bit better.

Code:
var GuidanceModel=new Class({Name:"GuidanceModel",Implements:[EventSource,Destroyable],
_currentRoute:null,
_MANEUVER_ICONS:null,
_guidance:null,
initialize:function(aPluginControl,aRoutingModel,aPositionModel,aMapModel)
{
    var modelInstance=nokia.maps.pfw.PlayerManager.getModelInstance(aPluginControl,this.className);
    if(modelInstance)
    {
        return modelInstance
    }
    else
    {
        nokia.maps.pfw.PlayerManager.addModelInstance(aPluginControl,this.className,this)
    }
    
    this._pluginControl=aPluginControl;
    
    try
    {
        this._guidance=this._pluginControl.getGuidance()
    }
    catch(ex)
    {
        this._guidance=null
    }

    if(!this._guidance)
    {
        this._guidance=new GuidanceMockup()
    }
    
    this._guidance.setOnGuidanceDone(bind(this,this._onGuidanceDone));
    this._routeModel=aRoutingModel;
    this._mapModel=aMapModel;
    this._positionModel=aPositionModel
}
When the code is run on the desktop, you state that GuidanceMockup is used. On the N900, what would happen? Would the class be constructed from the instance received in the first few lines, or would this._guidance be set in the "try" block?

I'm trying to deduce if the code in the HTML file for certain functions is used, if it is replaced by the plugin or it is never called at all. For example:

Code:
pauseNavigation:function(aPause)
{
    if(aPause===true||aPause===undefined)
    {
        this._guidance.pause()
    }
    else
    {
    this._guidance.resume()
    }
}
this._guidance.pause() would obviously be the plugin, but is the function for pauseNavigation in the HTML used or is this replaced by the plugin.
 
Blaizzen's Avatar
Posts: 397 | Thanked: 802 times | Joined on Jan 2010 @ Sydney
#28
Although I'm not that good at javascript either, I'll try explain what I think happens

1. Application opens up and all the important functions etc are initialised. In the "postAttach: function () {" function it creates a new instance of "GuidanceModel"
Code:
this.guidance = new nokia.maps.pfw.GuidanceModel(this._pluginControl, this.routing, this.position, this.map);
2. This creates the "GuidanceModel" with the current settings etc. Since its been created, it will run any code in the initialise section
Code:
    var GuidanceModel = new Class({
        Name: "GuidanceModel",
        Implements: [EventSource, Destroyable],
        _currentRoute: null,
        _MANEUVER_ICONS: null,
        _guidance: null,
        initialize: function (aPluginControl, aRoutingModel, aPositionModel, aMapModel) {
            var modelInstance = nokia.maps.pfw.PlayerManager.getModelInstance(aPluginControl, this.className);
            if (modelInstance) {
                return modelInstance
            } else {
                nokia.maps.pfw.PlayerManager.addModelInstance(aPluginControl, this.className, this)
            }

            this._pluginControl = aPluginControl;
            try {
                this._guidance = this._pluginControl.getGuidance();
            } catch (ex) {
                this._guidance = null
            }
            if (!this._guidance) {
                this._guidance = new GuidanceMockup();
            }
            this._guidance.setOnGuidanceDone(bind(this, this._onGuidanceDone));
            this._routeModel = aRoutingModel;
            this._mapModel = aMapModel;
            this._positionModel = aPositionModel;
		
        },
        isGuidanceSupported: function () {
            return this._guidance !== null && this._guidance !== undefined && this._guidance.className !== "GuidanceMockup"
        }, etc etc
On my desktop, since we don't have access to GPS features etc, guidance is not supported, so it sets guidance as "GuidanceMockup". This is to prevent any calls to the function from failing (at least I think so... ).

On the N900, guidance is partially supported, so it does not create an instance of "GuidanceMockup".

3. Guidance (the plugin on the N900 or the GuidanceMockup on the desktop), is by
Code:
this._pluginControl = this._page.getChildAt("plugin");
.
.
.
this.guidance = new nokia.maps.pfw.GuidanceModel(this._pluginControl, this.routing, this.position, this.map);
Now what this plugin is exactly, I'm not too sure, but I think its the atlas plugin inside MicroB (but sadly that doesn't explain why I can't open the html page from normal microB).



A little tip i figured out. I made a small textbox in the body of the html
HTML Code:
    <body>
    <textarea cols="95" rows="5" id="recmsg"></textarea>
    </body>
then a small function in the javascript (right at the top)
HTML Code:
        <script type="text/javascript" id="javascriptApplication">
try {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
    var cPLX = Components.classes["@nokia.com/MapsPlugin"].getService(Components.interfaces.IPlugin);
} catch (e) {
    var cPLX = null;
}


[B]//here here
function writemessage(e){
	var txt = e;
	var tbox = document.getElementById('recmsg');
	if (tbox)
	{
		tbox.value = tbox.value + "\n" + txt;
		tbox.scrollTop = tbox.scrollHeight - tbox.clientHeight;
	};
}[/B]
so anytime time in the code I want to check if something is run or messages or warnings etc, I call writemessage("blaa blaa") and it will display in the textbox. Sadly though it kinda screws up with the maps application (so the bottom is cut off), but for quick testing its helping.


Hope that explains most of it

Last edited by Blaizzen; 2010-12-23 at 09:34.
 
Blaizzen's Avatar
Posts: 397 | Thanked: 802 times | Joined on Jan 2010 @ Sydney
#29
Originally Posted by zdanee View Post
So... if the whole OVI maps stuff is JavaScript can you add a function to import POIs from Symbian edition's XML?
I don't have a symbian phone currently I can use, and I'm not too sure how to connect XML with javascript so not sure if i'll be able to do it, but I shall maybe give it a look some time, if not, I did see some POI stuff in the javascript, so i'll see what I can do with that.
 
direx's Avatar
Posts: 102 | Thanked: 153 times | Joined on Feb 2010
#30
Originally Posted by Blaizzen View Post
Feedback is welcome
This is awesome! The guidance mod turns Ovi Maps into a usable navigation system for pedestrians - I've just tried it, it's good.

Please keep up the excellent work and thank you for this!
 

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


 
Forum Jump


All times are GMT. The time now is 16:51.