mti
Posts: 268
Joined: Thu Aug 14, 2008 5:02 pm
Contact: Website

3.0 Chat and Generic Device Framework

Mon May 02, 2011 12:16 am

Can the chat and dispatch plugin be used via the Franson Framework to integrate application similar to the Garmin PND and using Generic Device integration?

regards
mti

User avatar
Mattias
GpsGate
Posts: 135
Joined: Wed Dec 16, 2009 3:59 pm
Location: Sweden

RE: 3.0 Chat and Generic Device Framework

Mon May 02, 2011 8:52 pm

Hi,

Yes, it is possible to send chat messages and job dispatches to other devices than Garmin PND.

Currently we have implemented chat support for Garmin PND, SysTech MDT and cell phones of course. Dispatch is only implemented for Garmin PNDs.
It is really easy to add support for more devices. All you need to do is implement a GpsGate command for your device. Are you familiar with this so you want to do it yourself?

We will of course add support for chat and dispatch to more devices in future versions too.

Regards,
Mattias

mti
Posts: 268
Joined: Thu Aug 14, 2008 5:02 pm
Contact: Website

RE: 3.0 Chat and Generic Device Framework

Mon May 02, 2011 11:16 pm

We can do it ourself, if you just give us some references about namespaces and classes to be used/extend/inherited.

regards
mti

mti
Posts: 268
Joined: Thu Aug 14, 2008 5:02 pm
Contact: Website

RE: 3.0 Chat and Generic Device Framework

Fri May 06, 2011 12:20 am

What I mean is, is t enough to reference the Chat class? Any development hints?

User avatar
Mattias
GpsGate
Posts: 135
Joined: Wed Dec 16, 2009 3:59 pm
Location: Sweden

RE: 3.0 Chat and Generic Device Framework

Tue May 10, 2011 7:49 pm

You need to reference the following:
GpsGate.Chat.dll
Franson.dll
GpsGate.Online.dll
Jayrock.Json.dll

The class you need to extend is named SendChatTextCmdExe. You need to override and implement the Namespace property and the Commit method.

VERY short example:

Code: Select all

[Loadable(Installable = true, Description = "_SendChatText for MyDevice.")]
public class Class1 : SendChatTextCmdExe
{
	public override string Namespace
	{
		get { return "MyDeviceNamespace"; }
	}

	public override void Commit()
	{
		OutgoingConnection.ProtocolToDevice(ChatText);
		base.Commit();
	}
}
Regards,
Mattias

mti
Posts: 268
Joined: Thu Aug 14, 2008 5:02 pm
Contact: Website

RE: 3.0 Chat and Generic Device Framework

Wed May 11, 2011 12:58 am

Mattias, thanks for your reply.

To avoid too much reverse engineering, can you please just list the essential properties/methods to be overridden to show a message in and a message out in the chat?
We basically already have a driver managing the low level protocol and everything needed. At a certain point in the code I will have a string corresponding to a “message in” or a “message out”. I need to forward this in the chat window to show in and out messages.

We don’t need the code, just some hints to avoid too much time wasted guessing

User avatar
Mattias
GpsGate
Posts: 135
Joined: Wed Dec 16, 2009 3:59 pm
Location: Sweden

RE: 3.0 Chat and Generic Device Framework

Wed May 11, 2011 2:19 pm

If you simply just want to insert chat text, do the following:

Code: Select all

ChatWriter writer = new ChatWriter();
writer.AddChatText(int iFromUserId, int iToUserId, int iDeviceId, string strChatText, bool bOutgoing);

For a complete integration, see the example from my previous post for the outgoing command that you need to extend for sending a chat message. The chat plugin finds an appropriate device automatically when clicking the "Send" button. An appropriate device is one that supports the _SendChatText command.

To handle incoming chat messages you need to do the following in your device's Protocol-class:

Code: Select all

if (HASINCOMINGCHATMESSAGE)
{
	FRCMD cmd = new FRCMD(null, "_ReceiveChatText", new string[] { INCOMINGCHATMESSAGE });
	GpsGateClientDirect client = new GpsGateClientDirect();
	client.Connect(NmeaConnection.Device);
	client.CmdToServer(cmd);
}
Regards,
Mattias

mti
Posts: 268
Joined: Thu Aug 14, 2008 5:02 pm
Contact: Website

RE: 3.0 Chat and Generic Device Framework

Sat May 14, 2011 11:35 am

Mattias, do you have any similar suggestion to also link the "Dispatch" plugin?

User avatar
Mattias
GpsGate
Posts: 135
Joined: Wed Dec 16, 2009 3:59 pm
Location: Sweden

RE: 3.0 Chat and Generic Device Framework

Tue May 17, 2011 1:34 pm

Similar to "_SendChatText", there is a command named "_SendStop". When you right-click a job in the dispatch list and select "Send job to driver", this command will be executed. Implement like this:

Code: Select all

[Loadable(Installable = true, Description = "_SendStop for MyDevice.")]
public class Class2 : SendStopCmdExe
{
	public override string Namespace
	{
		get { return "MyDeviceNamespace"; }
	}

	public override void Commit()
	{
		// available properties are Text (the job notes), Longitude and Latitude
		OutgoingConnection.ProtocolToDevice("DATA");
		base.Commit();
	}
}
Regards,
Mattias

mti
Posts: 268
Joined: Thu Aug 14, 2008 5:02 pm
Contact: Website

RE: 3.0 Chat and Generic Device Framework

Wed May 18, 2011 12:23 am

Great. We appreciate.

ibraimcesar
Posts: 7
Joined: Mon May 07, 2012 10:30 am
Location: Brazil
Contact: Website

RE: 3.0 Chat and Generic Device Framework

Tue May 15, 2012 6:56 am

When I click a job in the shipping list and select "Submit Job for driver", this command will executado.e sent to a mobile phone or tablet, is.

Italic

mateusz
Posts: 10
Joined: Wed Sep 15, 2010 3:22 pm
Location: Poland
Contact: Website

RE: 3.0 Chat and Generic Device Framework

Tue Jul 24, 2012 8:56 pm

I have problem with impementing chat in out device. I extend class SendChatTextCmdExe :

Code: Select all

[Loadable(Installable = true, Description = "_SendChatText for GLP devices.")]
public class GLPSendChatTextCmdExe : SendChatTextCmdExe
{
	private static Logger m_nlog = LogManager.GetCurrentClassLogger();
	public override string Namespace
	{
		get
		{
			return "GLP";
		}
	}
		
	public override void Commit()
	{
		OutgoingConnection.ProtocolToDevice(ChatText);
		base.Commit();
	}
	
}
In device definition I have:

Code: Select all

protected override DeviceDefinitionCommandProperty? RegisterCommad(GateCmd gateCommand)
{
	DeviceDefinitionCommandProperty? retCmdProp = null;

	switch (gateCommand.Name)
	{
		case "_GprsSettings":
			retCmdProp = new DeviceDefinitionCommandProperty(gateCommand.Name, new string[] { "sms" });
			break;
		case "_SendChatText":
			retCmdProp = new DeviceDefinitionCommandProperty(gateCommand.Name, new string[] { "tcp" });
			break;
		case "_SendStop":
			retCmdProp = new DeviceDefinitionCommandProperty(gateCommand.Name, new string[] { "tcp" });
			break;
	}

	return retCmdProp;
}
but when I try send chat message from server I get error: "Client was disconnected from server".

Logs after a failed attempt to send a message:
2012-07-24 17:49:01.6716 | Info | 7 | TcpNmeaListener.m_Listen | New incoming connection! m_uiAcceptCount = 3, remoteEP = 127.0.0.1:4528, type = GpsGate.Online.Net.Tcp.GpsGateTcpListener |
2012-07-24 17:49:01.6816 | Info | 7 | NmeaConnection.DoLogin | User authenticated: admin1 @ 127.0.0.1:4528 Auth: |
2012-07-24 17:49:01.6816 | Info | 7 | NmeaConnection.get_Device | Update Unknown |
2012-07-24 17:49:01.6916 | Info | 7 | DAOFactory.EndRoundTrip | Process time: 00:00:00.0200288 DB:8 admin1@TcpConnection |
2012-07-24 17:49:01.7016 | Info | 7 | TcpNmeaListener.m_Listen | New incoming connection! m_uiAcceptCount = 4, remoteEP = 127.0.0.1:4529, type = GpsGate.Online.Net.Tcp.GpsGateTcpListener |
2012-07-24 17:49:01.7016 | Info | 7 | NmeaConnection.DoLogin | User authenticated: _SYSTEM @ 127.0.0.1:4529 Auth: |
2012-07-24 17:49:01.7117 | Info | 7 | DAOFactory.EndRoundTrip | Process time: 00:00:00.0100144 DB:5 _SYSTEM@TcpConnection |
2012-07-24 17:49:01.7117 | Info | 7 | NmeaConnection.get_Device | Update Unknown |
2012-07-24 17:49:01.7117 | Info | 7 | GpsGateProtocol.m_VersionHandshake | From Client: $FRVER,1,1,GpsGate Client SDK 2.0*63
for GpsGate |
2012-07-24 17:49:01.7117 | Info | 7 | DAOFactory.EndRoundTrip | Process time: 00:00:00 DB:1 _SYSTEM@TcpConnection |
2012-07-24 17:49:01.7117 | Info | 7 | DAOFactory.EndRoundTrip | Process time: 00:00:00 DB:0 _SYSTEM@TcpConnection |
2012-07-24 17:49:01.7317 | Info | 7 | CmdFactory.CreateGateCmd | Outgoing CmdExe created GLP._SendChatText IN:_SYSTEM@TcpConnection OUT: Device:7 |
2012-07-24 17:49:01.7317 | Info | 7 | DAOFactory.EndRoundTrip | Process time: 00:00:00.0100144 DB:5 _SYSTEM@TcpConnection |
2012-07-24 17:49:01.7317 | Info | 7 | DAOFactory.EndRoundTrip | Process time: 00:00:00 DB:0 _SYSTEM@TcpConnection |
2012-07-24 17:49:01.7317 | Info | 7 | DAOFactory.EndRoundTrip | Process time: 00:00:00 DB:0 _SYSTEM@TcpConnection |
2012-07-24 17:49:01.7417 | Info | 7 | DAOFactory.EndRoundTrip | Process time: 00:00:00.0100144 DB:0 _SYSTEM@TcpConnection |
2012-07-24 17:49:01.7417 | Info | 7 | Queue.QueueItem | Queue 4: GLP._SendChatText IN:_SYSTEM@TcpConnection OUT: Device:7 Unknown 0 |
2012-07-24 17:49:01.7717 | Info | 3 | GpsGateProtocol.m_VersionHandshake | From Client: $FRVER,1,1,GpsGate Client SDK 2.0*63
for GpsGate |
2012-07-24 17:49:01.7717 | Info | 3 | DAOFactory.EndRoundTrip | Process time: 00:00:00 DB:0 admin1@TcpConnection |
2012-07-24 17:49:01.7717 | Info | 3 | CmdFactory.CreateGateCmd | Incoming CmdExe created GpsGate._CloseFlagNotifier IN:admin1@TcpConnection |
2012-07-24 17:49:01.7717 | Info | 3 | DAOFactory.EndRoundTrip | Process time: 00:00:00 DB:0 admin1@TcpConnection |
2012-07-24 17:49:01.7818 | Info | 3 | DAOFactory.EndRoundTrip | Process time: 00:00:00.0100144 DB:0 admin1@TcpConnection |
2012-07-24 17:49:01.7918 | Info | 3 | DAOFactory.EndRoundTrip | Process time: 00:00:00.0100144 DB:1 admin1@TcpConnection |
2012-07-24 17:49:01.8018 | Info | 3 | TcpConnection.m_ReadCallback | Client closed connection admin1@TcpConnection |
2012-07-24 17:49:01.8018 | Info | 3 | NmeaConnection.Dispose | Disposing... admin1@TcpConnection 127.0.0.1:4528 |
2012-07-24 17:49:01.8418 | Error | 7 | OutgoingCmd.get_OutgoingConnection | Outgoing connection not found for GLP._SendChatText over $ROUTE,device,7,direct*57
Have you enabled the listener for this protocol/transport? |
2012-07-24 17:49:01.8418 | Error | 7 | Protocol.Send | GpsGate.Online.GateCmdException | No outgoing connection found over direct for GLP._SendChatText IN:_SYSTEM@TcpConnection OUT: Device:7
2012-07-24 17:49:01.8519 | Info | 7 | GpsGateProtocol.m_ExecuteCmd | Franson.Message.QueueFatalError | No outgoing connection found over direct for GLP._SendChatText IN:_SYSTEM@TcpConnection OUT: Device:7
2012-07-24 17:49:01.8519 | Error | 7 | NmeaConnection.DeviceToProtocol | Ascii: $FRVAL,UTC,2012-07-24 15:49:01.661*3A
|
2012-07-24 17:49:01.8519 | Error | 7 | NmeaConnection.m_LogBinary | Binary: 0x24,0x46,0x52,0x56,0x41,0x4C,0x2C,0x55,0x54,0x43,0x2C,0x32,0x30,0x31,
0x32,0x2D,0x30,0x37,0x2D,0x32,0x34,0x20,0x31,0x35,0x3A,0x34,0x39,0x3A,
0x30,0x31,0x2E,0x36,0x36,0x31,0x2A,0x33,0x41,0x0D,0x0A, |
2012-07-24 17:49:01.8519 | Info | 7 | DAOFactory.EndRoundTrip | Process time: 00:00:00.1101584 DB:7 _SYSTEM@TcpConnection |
2012-07-24 17:49:01.8619 | Error | 7 | TcpConnection.m_ReadCallback | Franson.Message.QueueFatalError _SYSTEM@TcpConnection, 127.0.0.1:4529 | No outgoing connection found over direct for GLP._SendChatText IN:_SYSTEM@TcpConnection OUT: Device:7
2012-07-24 17:49:01.8619 | Info | 7 | NmeaConnection.Dispose | Disposing... _SYSTEM@TcpConnection 127.0.0.1:4529 |

What I'm doing wrong?

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

RE: 3.0 Chat and Generic Device Framework

Tue Jul 31, 2012 5:55 pm

The MyDevice guide is now extended with a new sample "MyDeviceCommand.zip" which demonstrates outgoing commands.

More info:
topic.asp?TOPIC_ID=9805

Regards,
Johan

GpsGate Support

x893.00
Posts: 61
Joined: Fri Nov 28, 2008 6:02 pm

RE: 3.0 Chat and Generic Device Framework

Wed Mar 27, 2013 1:00 pm

Where i can find GpsGate.Chat.dll ?

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

RE: 3.0 Chat and Generic Device Framework

Wed Mar 27, 2013 1:02 pm

Install the Chat plugin. Then you find it in the "Franson NMEA Service" folder.

Regards,
Johan

GpsGate Support

Return to “GpsGate for Developers”