Clinical Device interface programming using ASTM protocol in .Net - c#

How can we implement ASTM protocol in C# to read data from Clinical Device ?
Can any one suggest open source framework to write ASTM segments ?

I've been doing this since Mar of 2008 . I do not know one. Beside this not all of these diagnostic devices 100% compatible with ASTM 1394 . Especially package checksum calculation differs .
But I've infrastructures for Com port and TCP-IP level communications. Using USB directly is not commonly preferable because of the data-loss occurrences. Building an infrastructure for physical layer is logical. Because its a real standard but even for HL7 people use segments carelessly.In practice,this can happen; Lets put the patient insurance number to 11.segment ! But it could be 5 digits integer in standard. They don't care.
Have a look into this http://makecircuits.com/blog/2010-06-25-astm-protocol.html
But you should write on your own.
These guys are saying they had produced one which supports RS232, Bluetooth, HID, USB or network socket connection for ASTM
http://www.deepsoftware.com/nrcomm/astm.html It is not free and probobly won't help for the varity reasons I shared. It says HID supported. HID is Human Interface Driver for USB as you know, just a few diagnostic devices use USB directly. Most of them use USB to send data to their inner central stations and provide you over TCP/IP. But some significant devices support USB directly but not with HID , they had coded their own drivers. Such as Welch Allyn's Propaq LT,its a handy monitor for US army use.
All the best!

Be aware ASTM 1381 & 1394 protocol specs are now maintained by CLSI as LIS01-xx and LIS02-xx (https://clsi.org/standards/products/automation-and-informatics/documents/lis01/). If I am not mistaken there are nuget packages available for LIS01 & LIS02.

Don't think there is open source available.
But you might check http://www.deepsoftware.com/nrcomm/astm.html

the first step you need to understand ASTM, is that you have to work with Control Characters, , , these are not symbols, these are not string, these are not numbers.
so the first step in c# es convert these Control Characters
static string enq = char.ConvertFromUtf32(5);
static string ack = char.ConvertFromUtf32(6);

Related

Update driver for one of the same model network adapters

There are multiple network adapters of the same model in the target computer. As below, they are all Intel I211.
PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03\0060E0FFFF6336A000
Name: Intel(R) I211 Gigabit Network Connection
Hardware IDs:
PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03
PCI\VEN_8086&DEV_1539&SUBSYS_00008086
PCI\VEN_8086&DEV_1539&CC_020000
PCI\VEN_8086&DEV_1539&CC_0200
Compatible IDs:
PCI\VEN_8086&DEV_1539&REV_03
PCI\VEN_8086&DEV_1539
PCI\VEN_8086&CC_020000
PCI\VEN_8086&CC_0200
PCI\VEN_8086
PCI\CC_020000&DT_0
PCI\CC_020000
PCI\CC_0200&DT_0
PCI\CC_0200
PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03\0060E0FFFF6336A100
Name: Intel(R) I211 Gigabit Network Connection #2
Hardware IDs:
PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03
PCI\VEN_8086&DEV_1539&SUBSYS_00008086
PCI\VEN_8086&DEV_1539&CC_020000
PCI\VEN_8086&DEV_1539&CC_0200
Compatible IDs:
PCI\VEN_8086&DEV_1539&REV_03
PCI\VEN_8086&DEV_1539
PCI\VEN_8086&CC_020000
PCI\VEN_8086&CC_0200
PCI\VEN_8086
PCI\CC_020000&DT_0
PCI\CC_020000
PCI\CC_0200&DT_0
PCI\CC_0200
How do I update driver for a specific one of these same model adapters by devcon, C++ or C#? For example, update by the unique device instance ID (ex: PCI\VEN_8086&DEV_1539&SUBSYS_00008086&REV_03\0060E0FFFF6336A100)
Thanks
EDIT:
I've searched APIs for this but they all use hardware ID to update the driver, which will update all of the same model adapters' drivers.
Ex: C++'s UpdateDriverForPlugAndPlayDevicesA and devcon's update command.
EDIT2:
The motivation of this issue is that we are using an RTOS (real-time OS, RTX64) and we want to establish a real-time network communication (EtherCAT connection) with other devices by the RTOS. We need to update one of the adapters' driver to the driver provided by RTX64, so that this adapter can be used by it.
The only workable solution for us to just update one of them is using Windows' "Device Manager". (There's no same model adapters in the below picture, it's just shows how to update by device manager manually)
We are asking our users to do this manual update after installing our software. It's not convenient for them. So we are trying to find an automatic way to do this.
Since Device Manager in Windows can do this, we suppose that there's an API can do this too.
Two workarounds. One minimizes manual customer interaction when updating the device driver, the other fully automates the process, but requires coding in a BASIC like language.
The first one consists on automatically showing the Hardware Update Wizard for that particular device instance, using the API function DiShowUpdateDevice as described in the previous link.
The second one is to use the free AutoIt automation software. With it you can automate basically everything in a Windows system, it's very powerful and I've used it in conjunction with web bots and automatic web testing (non-headless). I've also used it in double-click roll-outs of Windows systems and many sysadmin tasks.
As a remark, you could also mix both approaches. First, use DiShowUpdateDevice to show the wizard and then an AutoIt script can automatically perform UI interaction, the client won't have to do anything at all.
This is not really a average Programmer Problem.
Driver Programming - as a subset of Realtime Programming - is a highly specialized field. The average C# or C++ .NET Programmer will rarely have to deal with stuff like pointers and neer with assembler level code. But for those two, it is their daily bread and butter. I can not give you little more then general advice:
My first advice for you is to get somebody elses code to make that decision and installation. Usually drivers of one Manufacturer are distributed in packages. Wich do understand how to deal with idenitifcation of the hardware. Usually those installers also have a silent mode. So it comes down to calling them and intercepting the console output/looking for the return value.
My second advice, is to use their name as listed in the Device Manager. Optionally get them renamed manually. It is not that reliable as strings are quite patient and easily changed/missmatched, but it would get you somewhere to start from.
But as I understand it your problem is worse then just general driver updates. You have two instances of the same Hardware, and want to use different drivers for each. Wich is a order worse:
I am not even sure this is possible. Since the driver folder still uses the good old "only one file of each name" approach, it is propable that you can not use different drivers for different instances of the same hardware. Unless you define your own driver storage location.
I have no idea why you would do that. The average enduser programm does not need to worry about even selecting wich interface it will use. It just hands it's request off the to network stack and does not deal with layer 3 or below. Servers may have to pick a specific adapter to listen on, or just listen on both in paralell. But even those do not care for the driver version in use. They do not even care if it is a real, physical interface - after all missclassification like with early Bluetooth and Virtual Devices like for Virtual Machine Monitors/PDF printers are a thing.
So it honestly sounds like you got a XY Problem, with this idea being the (propably wrong) Y, to your real X.

client-server data exchange format

We create client-server erp system with huge amount(in the future) of data and use c# for client and c for server. We started with xml for small requests/responses and it looks ok for now. But what is the best data exchange format for increasing amount of data per response(up to 100MB i think)?
P.S.
Highest priority is encode/decode speed.
We use Sockets to transfer data.
It really depends on what kind of data you are going to send to and receive back from the server. If “data” is some sort of a buffer with the known length and the usual operations are to put / get an object to / from the server, then I would recommend you to take a look at HTTP: it's a very simple protocol, there are many libraries and applications that support it, you can easily extend the protocol, add an encryption (HTTPS) and compression (gzip), and this protocol is easy to debug and work with.
If you want to send network packets that contain many data fields of different types, then you want to encode and decode such packet (serialize) before sending to the network. There are a plenty of open source libraries in the Internet which support both C and C# languages (you can even write your own implementation, it's not that hard). I would recommend you to take a look at XML / JSON (text-based standards for data exchange), you will find it much more easier to debug communication problem when working with a textural data.
Hope it helps !
I would suggest to take a look at JSON:
http://www.json.org/

How to fetch PLC S7-300 serial hexdata

We have Siemens PLC S7-300 with Ethernet communication port.
Which type of java or other language coding available for getting the frame data of plc.?
this PLC communicate only with step-7 software.
This frame structure data also can store in xml of some text file so we can continuous send it to internet.
Please help me
There are 3rd party libraries that allow that. At our company we are using Accon AGLink. It's a native library, but it also provides a .NET wrapper. The library is somewhat fast. You could also try this one (indi.an PLCCom) which is managed, and not so fast, but it has a free version.
Alternatively you could try setting up an OPC server and read the PLC data using an OPC client, but they are somewhat expensive.
Have a look at Snap7, which is written in C but with many wrappers and ports available, including Python, Node.js, .NET, C#, Arduino, and one in Java called Moka7, since you asked.
From the official documentation:
Snap7 is an open source, 32/64 bit, multi-platform Ethernet communication suite for interfacing natively with Siemens S7 PLCs. The
new CPUs 1200/1500, the old S7200, the small LOGO 0BA7/0BA8 and SINAMICS Drives are also partially supported.
I'm assuming that your setup consists on an S7-300 CPU with a CP 343 communication module. To read data from the CPU, the system must be running an S7 server (configurable via NetPro, inside SIMATIC Manager, as explained in the Siemens commissioning manual). The remote machine should be using the Snap7 client library.
The library includes functions to read different memory areas, such as the process inputs (I), process outputs (Q), merkers (M), timers (T), and counters (C), as well as general purpose data blocks (DBs). If the server is enabled, and the configuration is not restricted (for instance to a certain IP address) the client should have access by default to at least the I's, Q's and M's, as well as to some system properties (like the CPU model and the firmware version).
For your case in Java, have a look at the Moka7 documentation, which can be found in the same download package. There are several code examples to get started.
If successful, the ReadArea function will return hex data of the bytes you specified (i.e. the memory position to start reading from, and the number of bytes). As a remark, remember that most Siemens PLCs are big-endian, so you may have to make a conversion if you're reading memory areas that hold data in different types.

Protocol communication help

Using Visual Studio 2005
Language: c#
A new to c#
I have software, the software should communicate with gprs devices. So i want to write a protocol, TCP, UDP communication code.
Can any one give some idea for writing a source code and some sample code also.
When you say the software should communicate with GPRS devices,
I'm going to assume you mean they want to communicate with eachother using TCP/IP and the fact that the two endpoints are connected to eachother by GPRS modems should make little to no difference except for that fact that you have to keep in mind the limited bandwith and slower transfer speeds.
(Some extra work does have to be done when you are using GPRS modems which are connected to your system using RS232 or USB interfaces, I'm assuming GPRS modems with a direct RJ45 connector here)
Your first step is to make sure you understand the basics of TCP/IP and UDP/IP.
You did not mention what kind of data you want to exchange between the applications,
so that leaves us very little to go on. You need to decide what type of messages the
applications will exchange and you need to determine whether you'll use TCP/IP or UDP/IP
to exchange those messages. Long story short, you should only use UDP if you can afford to lose a few bytes along the way. (For example, it doesn't matter if you lose a few frames while streaming video).
Once you've decided what kind of messages the applications should exchange,
you need to determine how you will represent them. Olivier pointed out you should take
a look at ProtoBuf.Net, which is a .NET implementation of the Google Protocol Buffers.
You can find more information on the topic here: http://code.google.com/intl/nl-NL/apis/protocolbuffers/docs/overview.html
Basically it allows you to define messages like this:
message Person {
required string name = 1;
required int32 id = 2;
optional string email = 3;
enum PhoneType {
MOBILE = 0;
HOME = 1;
WORK = 2;
}
message PhoneNumber {
required string number = 1;
optional PhoneType type = 2 [default = HOME];
}
repeated PhoneNumber phone = 4;
}
Which, by means of ProtoBuf.Net, you can then use in your code.
The binary format of Google Protocol Buffers is compact enough to
be transmitted over GPRS connections.
I hope this gives you a few starting points,
first deside what you want, then look into the points we've mentioned
and feel free to post new (more specific) questions in the future
This is just a "Give me the code" question. I would say you should start your programming and ask questions about your concrete upcoming questions.
As starting point you should take a look into System.IO.Ports.SerialPort, System.Net.Sockets and Serialization (Binary, DataContract, ProtoBuf.Net)

Download when idle/low network utilization

I have an update service that needs to pull data down from remote, however like Microsoft's BITS I'd like to do this when the user is idle and/or when their network utilisation is low so as to not impact on their experience.
What do I need to do or look at? Can anyone point me in the right direction on where to start with this and get the information I need?
Use official BITS wrapper http://msdn.microsoft.com/en-us/library/ms997639.aspx
How about SharpBITS.NET?
If you cannot use BITS because you want to be cross-platform, you're going to have trouble. Each OS will have different ways to find the current network usage, so you will have to write an interface class with implementations for each supported OS.
In Linux it seems to be the special file /proc/net/snmp. In Windows, BSD or OSX I have no idea. The netstat -s shell command seems to work on all of them, but the output format is different for each one.
Have you looked at MSDN where it describes how to use the BITS COM interfaces?
Another article here describing how to use BITS with .Net

Categories

Resources