JonasJ
Posts: 185
Joined: Wed Jun 03, 2009 9:39 pm
Location: Sweden
Contact: Website

Plugin: Template command with argument

Thu Dec 03, 2009 12:01 am

Template command with argument

Note: for an updated version of this and other articles, we recommend you to check our knowledge base here

Requires GpsGate Server v2.3 build 1944 or later

Here is a plugin to demonstrate executing a template command, taking a phone number as argument, for a selected device. GpsGate has a flexible plugin framework, which you can use to easily extend functionallity. Source code is included in this sample.

Image

Install and run the sample - step by step:

1. Download and unzip http://franson.com/gpsgateserver/samples/TemplateCommandWithArgument.zip
into to a directory “[install_path]\IIS\Resources\ScriptPlugins\MyPlugins\TemplateCommandWithArgument”
where install_path is where you installed GpsGate Server.

2. Login to SiteAdmin. Go to the “Script Plugin” tab. Click on “Refresh Script Plugins”. A plugin named "TemplateCommandWithArgument" should be present in the drop down.

3. Select TemplateCommandWithArgument in the drop down. Check the applications for which to enable the plugin. Click "Save". The plugin is now enabled for the selected applications.

4. Create and save a new command "MyTemplateCommand" having a template containing the parameter [phoneNr] in SiteAdmin (see screenshot below) for the protocol of your device type.
Image

5. Login to the application for which you enabled the plugin. A menu named "windows" should exist with an item named "TmplCmdWithArgument". Click the "Windows" -> "TmplCmdWithArgument" menu item and the window should pop up.

6. Select a vehicle.

7. In the plugin window, the list of devices is now be updated with all devices for the selected vehicle. Select a device having the protocol that now supports the "MyTemplateCommand" command.

8. Enter a phone number in the textbox.

9. Click Execute. The command should now be sent to the selected device.

Source code
The source code for this plugin may be modified and reused in any way.

Take a look in "Display Platform Kit" for how you develop your own custom Windows in VehicleTracker. Download the "Display Platform Kit" here:
http://franson.com/gpsgateserver/guide.asp

Regards,
JonasJ

GpsGate

lele81
Posts: 44
Joined: Mon Nov 09, 2009 7:41 pm

RE: Plugin: Template command with argument

Thu Dec 03, 2009 1:37 pm

Hy is possible to send a SMS text instead a telephone number ( I have A1 with Data Display Monitor for viewing SMS text)?
Thanks a lot.
Claudio

User avatar
johan
GpsGate
Posts: 15404
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Plugin: Template command with argument

Thu Dec 03, 2009 7:59 pm

You should see this plugin as a sample. If you have knowledge in Javascript/ASP.NET programming, you can typically other things like sending a message to a A1 data display. You need to customize the Window, and you need to add a suitable "Template Command".

Regards,
Johan

Franson Support

husky92
Posts: 362
Joined: Wed Mar 31, 2010 2:08 am
Location: Norway

RE: Plugin: Template command with argument

Thu Jun 24, 2010 7:25 pm

Hi!

I have successfully modified the TemplateCommandWithArgument plugin and created a customized window for executing commands for setting various parameters in the GlobalSat TR-203 tracker. The problem is. I need to send commands to the tracker using TCP (not SMS). When sending the command, the tracker will not always be online. The tracker (TR-203) will go online (connect to the server) by calling it or by pressing the SOS button. The command can then be sent.

Problem 1: I am getting the error message: "'g' is not a function" when trying to execute the command using tcp and not SMS and the tracker is not online. It is the javascript. The error is coming from the d.addErrback() in the GpsGate.Server.Directory.GetDeviceCommandStatus(). This is unchanged code from the original TemplateCommandWithArgument example.

Problem 2: I need to have the script wait for the tracker to come online before the command is sent. Is this possible? This question also applies to the general Send Command window in the VT application.

Any help on this issue will be appreciated.

Best Regards,

JonasJ
Posts: 185
Joined: Wed Jun 03, 2009 9:39 pm
Location: Sweden
Contact: Website

RE: Plugin: Template command with argument

Thu Jun 24, 2010 10:02 pm

Problem 1:
This could be a bug resulting from wrong function ownership (this). See if this helps. Add a function similar to onServiceError to Franson.TemplateCommandWithArgumentWindow.Content, such as:

...
},

onPollStatusError: function(error){
this.poll = false;
this.enableAbort(false);
this.displayError(error.message);
},

...

and use it in d.addErrback() in the same manner that onServiceError is added to the deferred d = GpsGate.Server.Command.SendWithArgs(device.id, strCmd),
like the following:

d.addErrback(
method(this, this.onPollStatusError)
);

Problem 2:
We will consider this for the next release of GpsGate Server.

Best Regards,
Jonas

GpsGate

limyo
Posts: 375
Joined: Sat Jun 19, 2010 4:18 pm
Location: Cambodia

RE: Plugin: Template command with argument

Sun Aug 29, 2010 9:08 pm

I downloaded and follow instruction to install.
In Vehicle Tracker window menu I choose TmplCmdWithArgument, it popup window and display "Error: The page can not be found".

How to fix this problem?

Best regards

hpi
Posts: 107
Joined: Tue Jan 18, 2011 1:50 pm

RE: Plugin: Template command with argument

Sun Apr 24, 2011 1:39 am

Hi,

Is the Display Platform Kit still a feature in GpsGate V3?

I'd like to develop additional windows and features...but it seems like all the Platform Kit stuff is outdated? Maybe I'm wrong, but I can't really find info on this. There seems to be info on the older Franson site, but not on this site.

Any Topics I can visit to see how to start developing my own features if using GpsGate V3?

Thanks

User avatar
johan
GpsGate
Posts: 15404
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Plugin: Template command with argument

Sun Apr 24, 2011 12:33 pm

Yes, please read this:
http://forum.gpsgate.com/topic.asp?TOPIC_ID=12928

Regards,
Johan

GpsGate Support

geordierob
Posts: 28
Joined: Sun Mar 13, 2011 3:36 pm
Location: Australia

RE: Plugin: Template command with argument

Wed Jun 08, 2011 1:06 pm

Hi Again Johan,
I was browsing the forum and came across the discussion about template command with argument.. Thought I would see if I could work this command BUT after downloading and installing as directed in your advice I found that in my GGS there is no Script Plugin Tab!! or at least none that I could find!!I have ver 3.0 installed on my computer.
The "TemplateWithArgument" is installed in my GGS installed path.
Where do I look for the Script Plugin Tab???
Regards,
George

User avatar
johan
GpsGate
Posts: 15404
Joined: Wed Aug 04, 2004 10:40 pm
Location: Sweden
Contact: Website

RE: Plugin: Template command with argument

Wed Jun 08, 2011 1:23 pm

You need to rescan the ScriptPlugins to make GpsGate aware of that you have copied the files.

More info here.
http://forum.gpsgate.com/topic.asp?TOPIC_ID=12914

Regards,
Johan

GpsGate Support

husky92
Posts: 362
Joined: Wed Mar 31, 2010 2:08 am
Location: Norway

RE: Plugin: Template command with argument

Wed Jan 06, 2016 5:52 pm

Hi!

Refering to the plugin sample, how can I submit arguments containing literal comma (,) characters using the GpsGate.Server.Command.SendWithArgs(device.id, strCmd)?

Thanks!

Return to “GpsGate for Developers”