How to read from a device's COM Port? - c#

I´ve a device running Windows CE, which is capable to receive GPS datas. Now I wrote an application (C#, .Net Compact Framework 2.0 using VS2008) in order to receive this data and later on work with it.
The support contact of the device told me to use its COM port (number 5) to get the data.
As I´m not that experienced in working with C#, I have tried so hard to get the data (Longitude, Latitude) into my local variables … in vain.
My first idea was to add the library (*.dll) brought by the device’s SDK. There I found a structure which contains the variables dLongitude and dLatitude. I thought getting the values of this datas into my local variables would be the solution…result was: they only returned 0.0… … I can’t get rid of the feeling that I’m totally barking up the wrong tree…
(see my first question on this site)
You would help me so much, if you could give me a hint in which direction I have to go. I just don’t know how to read from device’s COM Ports or where to read about how to do so.
Thank you!!

GPS data through serial ports often follows the NMEA 0183 standard. It's pretty much just periodic human-readable numbers.

Related

Extract gps data storage

I am using dotSpatial labrary in c#, I only can read realtime data.
but my problem is this.. how could I extract gps data storaged in my usb-gps device (it is passive gps)?
device information
brand : landairsea
Model: Gps Tracking Key
webPage: http://www.landairsea.com/gps-tracker/gps-tracking-key
From looking at their user guide:
http://www.landairsea.com/downloads/past-track-10.pdf
You could use the past-track software to save the stored data as .las format.
I believe that DotSpatial has a LIDAR plug-in that can read .las files:
Dotspatial.Plugins.LiDAR
If you are asking how to write a C# replacement for the Past-Track program that connects directly to the USB however, I don't know exactly.
DotSpatial has a positioning library that is DotSpatial.Positioning that was originally ported from http://geoframework.codeplex.com/. It is possible that this utility will have the capability to connect to your device, but I think it would probably only support a limited subset of GPS devices, and I never used it myself at all.
Hopefully that information is a little helpful though and will point you in the right direction.
Edit:
I have downloaded the Past-Track 10 software that is designed to retrieve data from the unit. This in turn installed Antaris4 and u-blox5 USB drivers. I think this is half of what you will need to write a C# app that can talk to your GPS and do things in code. You can find the drivers on the web. I think I found it here:
http://www.driverguide.com/driver/detail.php?driverid=1869444
But make sure you find a version of the driver that matches your PC configuration (32/64 and correct operating system). Incidentally, that will probably mean you will need to make x86 and x64 builds for your C# app.
The next step is to find some documentation for it and then attempt to use the drivers from C#. So far I haven't found a good document showing how to work with the drivers, but I'm sure it exits. I will update with a link when I find it.

Using agsXMPP , can it send images?

I found this lib here
http://www.ag-software.de/agsxmpp-sdk/
hacked on this example here:
http://www.dotnetcurry.com/ShowArticle.aspx?ID=346
It works pretty well actually but I am wondering if one could rig up a message thats an image that would show up in the others (google talk client) or some other client for display? I poked around on the web, couldn't figure out definitively if this is possible...their site says the api supports XML-RPC, could that do it?
Just want to know im not going down a dead end for this functionality...if XMPP jabber even supports it.
This library seems not to support XEP 0231, the specification that "defines an XMPP protocol extension for including or referring to small bits of binary data in an XML stanza."

A lot of data in WP 7 App, how?

I would like to have a lot of data (quotes of famous people, arround 100 k quotes). And I want that users are able to search, sort on category and sort on authors.
Got a big big xml file at the moment, but what is smart to do? How can i get all the quotes in the app? maybe a sql lite database? or just loop the xml when app starts?
Any tips are most welcome!
Kevin
UPDATE: Thanks for all the replies and tips, I really appreciate it and I am looking forward to program my App, did make a runkeeper-like app yesterday, now starting the quotes app.
I would recommend storing this data on a webserver somewhere and using some SOAP interface of something like this, to access it. I wouldn't be positively surprised when a downloaded application all of a sudden decides to download a big file of quotes.
I would recommend a SQL CE database (.sdf file)
Great overview here: http://windowsphonegeek.com/tips/Windows-Phone-Mango-Local-Database%28SQL-CE%29-Introduction
And here: http://msdn.microsoft.com/en-us/library/hh202860%28v=VS.92%29.aspx
There's no SQLite on WP7. There's SQL Server Compact though. Read up on the latter, and also on LINQ. WP7.5 only.
Alternatively, store data on the Web server, and use a service to pull it on demand. In that case, read up on services and SOAP.
With the fact that you are looking at a 500mb file I think you have a couple of options.
1) Put all of this data in a database on a webserver, then have your phone application use whatever method you like to contact the database to get specific data that is needed. Obviously your UI would have to be optimised to allow a user to sort by the type of quote and / or the person to whom the quote is attributed.
2) If you want this to be done without the use of the webserver you could have a stripped down basic database of quotes in the application itself, to extend this connect to the database and download more data.
This method may be best as it lets you use the database data to say populate a website if you wanted to (make a bit of money from ad revenue / promote your app) and also it means if your users dont have an internet connection they can still get some use from your app.
Without more knowledge of the platform I couldnt say what would happen if you try load a 500mb application but I doubt it would be good, though having such a large file locally is a bad idea for a mobile device. I can see this going two ways.
1) Im out and see your application, I set it downloading, pay it no attention and then later check to find it has downloaded 500mb over my mobile phone data package. This could mean a big bill.
2) I start to download your application, it hasnt finished downloading after 10mins, I delete it and dont bother trying again.
You can do something like let the user to enter three character minimum before search from webservice ans user the service result to bind the data.
Check the following links
How to connect to a Webservice from a Windows Mobile Device 6.0
http://msdn.microsoft.com/en-us/library/aa446547.aspx
Let me know if this helps.

Reading from USB device and sending queries to it, in C#

I've read this: https://stackoverflow.com/questions/1176053/, which was an insightful article.
However, I have no great background in WMI, and I found the large amount of documentation to be overwhelming. I can't find what I'm looking for.
The situation is that I have a device that will send data over the USB port, to the soundcard of the PC in question.
Consider camera-software. You connect your camera, start the program, and you can control the program with the camera, and vica versa. For instance, you can press a button on the camera and it'll start transmitting to the program. Or you can click a button in the program and it will start querying for data.
I need to find a way to query and catch this data, safely and correct.
It's probably a Stream of bytes, but searching for that doesn't produce any results.
I'm thinking I first need to somehow connect.
Then send the query.
Then receive.
However, connecting and querying both is something that I can't find in the example code, or the System.Management documentation on MSDN.
I don't think that WMI code would be relevant for you, I think that's just able to get out basic information about the device. If you want to actually read and send data to it you'll have to use different APIs.
When I've done any USB develoment it's been mostly using HID which is fairly straightforward, but I don't think you can transfer audio streams using HID, you'll need to use the Audio class driver. Though you might need to use HID to find out information about the soundcard.
Some useful links to get you started are:
Jan Axelson's website (author of USB Complete) - http://janaxelson.com/usbc.htm
A USB HID Component for C# - http://www.codeproject.com/KB/cs/USB_HID.aspx?msg=2004501
A USB library for .Net - http://www.icsharpcode.net/OpenSource/SharpUSBLib/
A Java sample for a webcam app - http://www.mutong.com/fischer/java/usbcam/
Here is another great one for reading and writing to USB devices:
http://winusbnet.codeplex.com/

Question on Speech Recognition classes in .NET

Is it possible to have an application built using the .NET speech recognition classes and pass in a WAV file for it to go through and create a text representation of it. For example, this what I'm trying to do:
We have a QA department at my office and they have to listen to hundreds of calls a day which is quite impossible, and there's not enough people listening to everything to keep up. What I want to do is have the audio file uploaded to our server and have the server parse it and create a transcript of it. It doesn't matter if it's not perfect, but just a base which would be easier to skim through a couple of dozen lines of text than listen to a 2 hour recording.
Based on a saved transcript I can implement full-text search in the database and also run checks against the transcript if someone is saying something that's a misrepresentation.
So, is it possible to create an application using the .NET speech recognition classes and just pass the WAV file to it and it spit out a rough transcript?
I've dug around MSDN on the Speech classes briefly while thinking up the idea, so I don't have that much knowledge if it's possible to be done.
If possible, I would appreciate any examples in C#. Topic 1055347 is similar to the question I'm having, and was provided links, the most specific of which is in C++. I'm not a C++ developer, nor have I ever went to school for programming, I'm all self though C#, so I would like to stay in the language that I know.
Thanks in advance!
This sounds like you've got a call center type of application. Microsoft Speech Server has a SR engine optimized for telephony (8000 Hz sample rate), which will generate much better recognitions than the desktop SR engine. However, the engine isn't really designed for transcription (although it can do it), and the transcriptions definitely need to be reviewed before further processing occurs. Microsoft Exchange Unified Communications uses the SR engine to generate transcripts of voice mail, and while it's better than nothing, it often generates amusing nonsense.
With areas like speech recognition you are likely to either find a stand alone EXE or an API in c/c++.
For the links in the other topic, you can use a tool like P Interop Assistant to generate C# code. The C# code acts like a wrapper around the unmanaged dll, so you can call it from c#.
This is likely to be the best way to get the functionality you are looking for.
Yes.
I did such an application a few years ago on the Tablet PC; you can read about it at http://web.archive.org/web/20060615192119/www.devx.com/TabletPC/Article/30761 (At the time, I spoke of using Interop to access the libraries, but I believe that the programming model has remained the same, just with a managed wrapper.)
At the time, the results were very poor, but maybe for your use-case better than nothing.
How about route the calls to Google Voice? I'm sure there are similar services. I have been amazed at its accuracy so far, plus you can click and listen to it if required. Google Voice will forward voice calls to SMS or email.
UPDATE: On reread, maybe since you are recording calls it won't work as I yous the voice message left.

Categories