Selecting Camera - c#

Is it possible to enlist all the camera's connected to the System along with their physical address?
I am not inclined to any particular language, though I prefer C#.
Thanks for help.

Since you mention C#, I'm going to assume you mean on Windows.
From Windows viewpoint, still cameras are almost completely different sorts of things from video cameras (but, interestingly enough, still cameras and scanners are almost the same).
Since you don't mention video, I'm going to also guess you mean still cameras. You normally deal with still cameras (and scanners) via Windows Image Acquisition (WIA). To list cameras, you'd normally use IStillImage::GetDeviceList. This will return a STI_DEVICE_INFORMATION structure, which includes a dwHardwareConfiguration member to tell you the type of interface used (e.g., USB) and pszPortName to identify the specific port to which the camera is attached.
If you want to trace back from that port name to something more "physical", such as the bus number and such, you should (probably) be able to use WMI_USBControllerDevice to map from the device back to the controller.
If you want to deal with video cameras, you'd use capGetDriverDescription to get a description of each video capture device that's installed. In this case, getting something closer to a "physical" address is considerably more difficult. capGetDriverDescription will give you a driver name. I suppose you can do the usual Windows "stuff" to enumerate drivers and match up names to find out something about the driver in question, but I haven't played with that to be sure (for example) which name it gives you (the internal driver name, the display name, or what).
Also note that MS has developed about a half dozen different multimedia interfaces over time, so almost any multimedia cat can be skinned at least a half dozen different ways.

Related

Is it possible to determine the microphone type?

I have an application that needs different hotkeys depending on the microphone type (handheld vs headset). Right now I am checking display name, but sometimes a handheld is registered under a generic name. So, I need something more definitive, but I have searched and cannot find any way to determine this difference from Windows. Is there any API that will let me know this difference or not?
No, it's not. Consider the case that you have a mic plugged in via the 3.5mm mic port on the front of the computer, instead of a USB mic. The only thing that goes over that wire is the audio data; no metadata. It could be a headset, a handheld mic, or a line in from a record player.
You can make your best guess first (e.g. might be your current method, or just assume "headset" if that's the most common), but then you should let your user configure it to work how they want it to work. This is the only definitive way to do this "correctly".

Print Using Modem and Printer Through BTS

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.

Audio capturing in C#

I have a MAYA 44 USB sound card and would like to interface it with C#. I want to record from the provided microphones and produce a data array.
I have found examples when using the internal sound card from my laptop but when it comes to external it does not quite work.
Has anyone every connected the above sound card with C# please?
Have you had a look at the DirectSound API (Windows only though, I think). Might provide what you're after.
On how to record audio with C# in general there are already multiple threads on SO, so I won't talk about that.
I see two possible causes for your program which have different solutions:
You need to change which audio sources are muted in the windows volume control ("sndvol32.exe /R")
When opening the audio device there are multiple devices. And you're simply opening device 0 instead of enumerating them and perhaps choosing another one. The external sound-card might appear as a second device.

Expose my program to other programs

I'm messing with the idea of writing a small program to mirror output of a video capture device. If you buy a video capture device you can only use it with one program at a time because the device gets locked. Instead of buying a second capture card id like to write a program to accept input from my capture device and expose the output to other applications.
Capture Device----->Program---->Flash Media Encoder
I've never done this type of thing before. Is it device driver related? Can I make my program look like a capture device to other programs without digging in device driver dev?
If someone could point me in the right direction that would be great.
Can I make my program look like a capture device to other programs without digging in device driver dev?
-No, I'm afraid not. You'd need to do exactly that, write a driver or capture source of your own. You could make some interface to serve up image to multiple apps (what a great idea!) but then it would need to be standardised, and you'd need other companies or developers to use that interface. Again a great idea but you'd need to agree on the feature set - and each developer would likely want something new or different.
(If you are talking about particular/specific other programs, they might have a particular interface you can work with already..)
(I was also assuming you were talking about realtime video capture: if you're talking about photo capture etc, you could write an image file to disk, and then import into the other apps ... not as joined up or integrated as ideal though)
Hope that helps - not an ideal situation though!
I will not say it is impossible, but I will say it is impossible in C# because this will require you to write a device driver software which can emulate virtual capture devices which your other program can use and your program can capture actual capture device and mirror or split the data to virtual capture devices that your device driver will create.
Very much same to Virtual CD Rom Drives that we can create with some software, you will need windows device driver kit for that.
You can write combination of application, one device driver and you can have some sort of C# api or program to control the operation.

Using data from Google Maps in a C# Program for Windows Mobile

I'm making a charity Windows Mobile 6 app in C# to help those affected by Alzheimer's.
The aim is for this app to let the carer set a boundary by tapping in Google maps to set points. The carer would then put the windows mobile device in the patient's hand bag or coat, so that when the patient walks out on their own, thinking that they are "going home", the carer receives an SMS text with their position, heading and speed.
However, I don't know how to...
Switch from app to google maps for mobile
tap to select points
import the coordinates of that point to my C# program
use the coordinates to Calculate the boundary
Send the text with the position information
Switch back to my C# program
HTC's HD2 comes with a compass that uses this "tap to select a point then return to app" functionality, so surely it's possible for us too?
If anyone would be able to give me a hand my out I would be EXTREMELY grateful as this will help all those affected by Alzheimer's and other similar conditions. My Gran, for example, recently started trying to walk back to the property she lived in 20 years ago...
Thanks everyone! This means sooo much! I'll even come and buy you a drink to say thanks!
James
Whatever technical issues you're considering, I think you should realize that this type of usage is, AFAICS, contrary to the terms of service of google maps. See:
http://code.google.com/apis/maps/terms.html
That is, you may only use the google maps content if its accessible for everybody, not just whomever you hand out your program to:
Your Maps API Implementation must be generally accessible to users without charge.
If you're building it as a web app, it must be accessible through the internet, not intranet:
[your Maps API Implementation must not:] operate only behind a firewall or only on an internal network (except during the development and testing phase).
Some of the terms in header 10 also seem applicable:
[you must not (nor may you permit anyone else to):]
10.8 use the Static Maps API other than in an implementation in a web browser;
10.9 use the Service or Content with any products, systems, or applications for or in connection with:
(a) real time navigation or route guidance, including but not limited to turn-by-turn route guidance that is synchronized to the position of a user's sensor-enabled device;
Why would you want to kludge something together like that? Trying to have your app interface with another application for which you don't have source, whether it's Google Maps fopr Mobile or anything else, is difficult and should only be used as a last resort.
If this app is going to be free and not require users to log in, you can use the Bing Maps Web Service API directly from your application without cost. You could then use built-in GPS through the GPSID APIs as well, and you'd have control over what data goes where, what maps to draw, etc.
This seems like a much easier path to achieve what you're after.
As a side note, I gave a link above for the GPSID sample from Microsoft. I'd recommend looking at it and the native GPSID APIs but the managed wrapper Microsoft provided is, IMO, pure garbage, so you might consider wrapping the lower APIs yourself.
To restate the problem I believe you're trying to solve:
You've a use case when a carer will sent up a "virtual boundary" on a device. If that device leaves the bounded area, you'd like an alert sent via SMS sent to a predefined recipient, saying where that device is.
My suggestion would be to use something like OpenStreetMap maps (as they're free) for when you're setting up the virtual boundary. For their tiles (each 256px square), there is a relatively trivial method for converting between lat/long and pixel co-ordinates.
You might also be able to do what you want by cannibalising one of their existing Windows Mobile applications intended for surveying, such as OSMtracker, which already includes the map controls, downloads and the like, just leaving point 5 and part of point 4 on your list to tackle.

Categories

Resources