Posted: 8/17/2011
Hi Mike,
To get live data from a serial port, first implement one listener, who will gonna liste the serial port and write the data in SQL database.
To display all this data use the standard data acces to read serial port data from database, and display them to a single asp.net page on which you will have timer for refreshing at particular time.
Here: http://www.codeproject.com/KB/system/SerialPortListener.aspx is a nice artical for a serial port listener.
This is a breaf suggestion.
If you need more help for building database structure or web page, dont hesitate to ask.
Best Regards,
Gjorgji
how about developing two separate applications.
One to read the data and send it to the web application via web services to be written to the database.
The second would the be actual web application including the web services to receive and write the data to the database as well as displaying the data on the site once it is uploaded.
What do you think about this task - the data is coming in bits
Hi Mike
I have designed and coded such implementations in the past; there are a number of designs you can use depending on the model of operation; if you will be initiating the communication with the device ad hoc you might consider writing a windows application which will serve as the communications engine, parser and validator of the data as it comes in and writing it into the database. This may include handling the modem/terminal, port, check-digit validation, etc. The application can also host a windows form with some graphical interface for the user (such as how many records have been successfully read, parsed and written into the database, communication errors, etc). The windows form can also serve as a rudimentary reporting interface.
If this functionality is not really needed, you might also get away with a simple console application which will be executed either ad hoc or using the Windows Scheduler (or some other scheduling service).
As far as the web part of the operation is concerned, the web application can access the database either via web services (which will also need to be developed), or of course directly using SQL statements (not my favorite) or stored procedures. This way you separate the operational part of the solution from the business reporting or business intelligence part.
Let me know if something is not clear with this.
Chris
thanks for the explaination Chris.
what do you think about the overall project ?
Mike
If the data will be flowing ad hoc (i.e. not controlled by you) and the device cannot buffer it until you poll it, a windows service can work fine (it will keep the PC serial port DTR/RTS open, set at 1200 bps with the correct flow control RTS/CTS or XON/XOFF, 32 bit word). Upon receiving data (usually delimited with a character) it will have to validate and parse it and then write it into the db. The service can also write into a text log file as well as the database for redundancy. This piece is not too difficult if you have developed serial communicatios before; if not it will require a learning curve (Microsoft had the MSComm control up to VB6. With .Net 2.0 they have introduced the Ports library.). If you don't have that kind of experience you may alternatively look for ready made controls for .Net controlling the port (although I am not familiar with their current prices).
The project offers some complexity in handling the comms but other than that I would not classify it as huge (I am sure you appreciate that this is ofcourse a subjective term).
Hope I helped a it.
Thanks Chris.
Mike I will see what I can find (although this goes back to 05/06, so I may take a while; in the meantime look for the Ports library in .Net, and with examples there; you should have a lot to start with. You also need to read the documentation of the device to see exactly the format in which data is being sent; i.e. how are sentences separated? how is each sentenced to be parsed? as well as the way it communicates Word length, baud rate, stop bits and parity (e.g. 1200bps 8N1 means 1200 bits per second, 8-bit words, no parity one stop bit) as well as flow control (CTS/RTS or XON/XOFF). Once you have that info, you can define and instantiate the port, set its properties and then open it for listening. When data arrives an event is fired which you then check to see if it is a complete sentence (by checking whether the sentence separator has arrived). if so, you can Read it off the port, validate it (check any check digits there are) and pass it on the parsing and processing methods. Another thing is the protocol with the device; in case the string received is wrong (failing check digit) you may have to send a NAK control character to the device for it to resend it. This should not be an issue since I assume that the device is connected through a cable, not a modem.
Yes device is connected to the server with serial cable and on that server I want to deploy this application.
thanks Chris for all the information. I will keep an eye here for your reply.
And yes, I do have the manual of that device and have all the information about how many numbers are coming and data seperated by how many spaces etc.
chris, please check your PM (inbox). thanks
Posted: 8/18/2011
Chris, did you get my last PM ?