Print Using Modem and Printer Through BTS - c#

In my scenario to print something, I don't want the printer has to be connected with a computer. Rather I am trying to connect that with a Modem(GSM or any other). when a sms arrives to the modem, the print command will fire and the sms will be printed.My question is, is it possible to implement the diagram with our existing technology? If not, i will be delighted if you provide some alternatives.

Unless you can customize the firmware of the GSM modem or the printer, it is likely you will need a small computer in between. If both can talk over serial ports, this can be really tiny - PIC, AVR (including packaged version such as Arduino), etc. If at least one needs USB you may be better off with a bare-metal Arm board. This is going to range from $2 at the low end to maybe $70 at the high. (There are also a few Arm boards that run an embedded .NET framework if that is your background... how well they run it I'm not sure)
If you need to do formatting, or the printer depends on the computer to do a lot of the work, or your engineers aren't familiar with the mindset of tiny embedded systems, you probably want something capable of running an operating system - ie, a faster Arm chip with hundreds of megabytes of memory - think Beagleboard, plugputer, Chumby Hacker Board, etc or one of those micro-servers that are basically x86 netbooks refactored for better cooling. Depending on how careful you are, this puts you anywhere from $50-$250.
You could also use an android phone (pick one with known USB host capability) and fold in the GSM capability, but may spend a lot of time tripping over the android components when all you really want is an embedded linux with a full libc. A more "linux-y" linux smartphone might be preferable if you can find one you expect will continue to be available.

Related

Accessing Xbox Controller From Mono on ARM Linux

I'm writing a program in C#/Mono to be run on an ARM computer. It needs to be able to get the state of an Xbox controller plugged in to the system. I have tried a number of various libraries (XInputDotNet, for one), but they have all had various issues (like trying to use incompatible native C++ DLLs).
How can I read the state of an Xbox controller on an ARM machine?
P.S. Although there are similar questions, this is not a duplicate. All the solutions for previous questions fail for one reason or another on ARM.
To speak more directly to your task - you need to interface with a USB device. Typically this means opening up a handle to the USB driver, giving you a pipe through which you can read and write data to the USB device. libusb is a great way to do that in Linux userspace applications.
Given that you're going to be doing this in C# on mono, you're going to need to do pinvokes to libusb. If you're not familiar with pinvokes yet, I'd recommend practicing on something small, since they can get complicated very fast; particularly, read about SafeHandles.
There is at least one existing project you could use to base your work off of - xboxdrv, which is a userland C++ application, built on top of libusb, that reads and writes the controller's data and presents it as a standard joystick so that any joystick-aware program can utilize it.
The libusb library, which can be compiled on any Linux platform, including ARM, actually has a sample program (xusb) that can report the status of an XBox Controller.
See https://github.com/libusb/libusb/blob/master/examples/xusb.c#L945.

Printer Communication Capture

If I need to post this elsewhere let me know.
We have some old software thats being re-written, that uses a printerdriver to a propriatery printer.
I need to rewrite the software bypassing the print driver and go directly to the printer. I do have the specs for the printer communication, thats fine, but what Id like to do is monitor the communications to the printer to view its contents (from the existing software that Im re-writing) and compare it to the specs, and what I will be sending it for validation.
I have to make sure Im not missing anything.
Any ideas on how I might be able to accomplish this?
Thanks
To capture the traffic you have to basic options.
1. Use software
If you are using ethernet, you can use a program like WireShark or USBTrace to capture the packets that are being sent out. There are similar programs for USB.
2. Use hardware
Another option would be to use an external logic analyzer. It's basically a box that sits in-between the computer and the printer that captures all the data, then uses software to decode it. There are some inexpensive options available (USBEE, Bus Pirate, and Total Phase Beagle.
I own a USBEE and I've used it to debug a simple USB device. It works well enough for that. The software is a little clunky though.

Open and close an electrical circuit

I have an application that one of it's features needs to control an electrical circuit of some device (open and close a circuit). Since i have no background in electronics i really don't know where to start.
I looked at some articles and found that i might need some kind of an RS232 relay device but i really don't have a clue if this is the right approach.
any help or guidance would be appreciated.
I will assume that this is a low-budget project - something like this would work :
http://www.easydaq.biz/PagesUSB/USBRelayCardProductsFRAME2.htm
Relay cards are available in USB, PCI, etc. Google will help you find something in your price range, deliverable in your region, and with a suitable number of outputs.
There are DIY ultra-cheap options, however. This would generally involve using the LPT printer port as a DIO port. The 5V lines can be used to activate power transistors that drive coils in similar relays. Have to solder your own for this kind of project. LPT bits can be set with very simple low-level memory writes.
For commercial or industrial application the prices go up (as does reliability) and the correct unit would depend heavily on the specific application and environment.

How to detect incoming network transfers in windows (preferably in c#)

I was wondering if anyone knows how (or even if it is possible) to monitor and trigger an action when a computer running windows (7-8) starts reciving a file transfer from over the network onto one of its drives.
Bonus points if I can find out how big the file is that the other guy is placing on my machine and how much is done etc...
I want to know if there is any API in windows, or snippit of code, or some other API that provides any of this functionality.
I still want to be able to recive files, I just want to manage them better. I am on a network with over 90 computers and this software that I wish to write would be running on most of them.
Of course you can (after all it's what an Antivirus program does) but it's NOT easy and probably you'll see it's more comfortable to do in C than in C#. I'm sure there's a .NET porting of WinPCap anyway you can always P/Invoke.
Start reading about Network Monitor SDK on MSDN. It's not an easy task, you have to capture a specific set of frames, you may use a Network Packet Monitor to inspect the content and the type of the packets you have to capture and parse.
I'm not sure but you may take a look to QoS API (start reading this article), it should provide something you can use.

How can I determine the speed of a USB port?

Is there an easy way to programmatically determine the speed (or version) of a USB port? I'm looking to control the speed of data sent to a usb port based its maximum bandwidth.
If you need a solution for Windows this should be a good start:
http://msdn.microsoft.com/en-us/library/ms793313.aspx
Basically you should try this:
Enumerate the USB devices and the symbolic names to their drivers
Open a handle to the USB device driver through its symbolic name via CreateFile
Perform a DeviceIoControl on the driver handle with the control code IOCTL_USB_GET_NODE_CONNECTION_INFORMATION_EX. This will have you returned the structure USB_NODE_CONNECTION_INFORMATION_EX. There you have a member there called Speed of the type USB_DEVICE_SPEED.
(Close the driver handle)
This could also be interesting for you: CodeProject: Enumerate Properties of an Installed Device
To answer your question, I'm sure that there are ways of getting the information you need. I don't know the answer for windows, but Linux has files you can read within the sysfs directory structure.
Speed control is usually taken care of by the drivers and the hardware controlling the bus. Most modern USB controllers really have 2 controllers per port connected. 1 for the slower speed 12Mbps USB 1.0, and another for the higher pseed 480Mbps USB 2.0. There is a magic switch inside that connects it properly. The driver itself makes sure that everything is enumerated properly, controls the flow, etc. A higher level "user-space" application typically doesn't need to worry about these things.
Also, if you have a device that is capable of running at faster than 12Mbps, and you plug it into a 12Mbps port, it'll get dragged down to 12Mbps whether you like it or not. Is it that you want to know that is got dragged down?

Categories

Resources