3

I'm trying to get started on a side project using a mobile device (tablet or smartphone) as an input device to a PC. In its most simplest form, I envision using the mobile device touchscreen to control cursor movement and clicks on the PC. So far I'm targeting Windows machines and either Android or iOS devices (using Xamarin).

The plan so far is to use Xamarin to build the mobile app while a SignalR middleware resides on the PC as a TCP IP server in order to facilitate communication between device and PC. Up to this point, everything's rosy and I know what I'm doing.

My problem is in regard to what to do between the middleware and the PC. I have no experience with this portion of the problem, so I've been doing research and looking into various things like HID, 1394 virtual devices, custom device drivers, etc. All of these topics are currently beyond my comprehension and I can't figure out which of these (if any) are the correct approach.

Can anyone provide some insight into how to bridge the gap between receiving data via TCP IP and translating that into a keypress/mouse interaction in windows?

dshapiro
  • 131
  • 1
  • The most reliable method is IIRC to install drivers for virtual keyboard and mouse devices, as you seem to suggest. Send messages to those drivers which they translate to keyboard/mouse events. As far as Windows is concerned, these events are coming from a genuine keyboard/mouse. But that could easily be overkill, might get you in trouble with the windows app store if that's relevant, and means getting the Driver Development Kit. It may be easier to send fake messages via the Win32 API or .NET. See e.g. [here](http://msdn.microsoft.com/en-us/library/ms171548%28v=vs.110%29.aspx) –  Dec 01 '14 at 03:39
  • What if, however, we wanted to break away from the simplistic example of mouse + keyboard and emulate something such as a joystick with throttle? Joysticks have additional buttons that map beyond those recognized on a keyboard and the throttle itself probably needs something that would interpret a numeric value and perform some manner of "magic" with it. Would I then need some other driver (custom or prebuilt) that I wrap using my chosen development language? Could you also please elaborate on why this might cause issues with the windows app store? – dshapiro Dec 01 '14 at 19:01
  • I'm not sure why doing "some manner of magic" is a problem. Drivers, background services and applications are all software - they can all do calculations and make decisions. For joysticks, Windows has its own model of game controllers. You can fake that at the driver level certainly, but I can't see why you can't fake it at the Win32 API level by sending fake messages as well. That's not strong evidence that it can be, of course. –  Dec 02 '14 at 04:41
  • For the windows store issue - I don't know for sure, I've never considered writing software to sell there, but drivers have special privileges and have an ability to crash the whole operating system that other software shouldn't have. If you remember Windows 98, almost all of the crashing issues with that were due to bad drivers - partly because Microsoft didn't control their development (e.g. the DDK back then was IIRC a free or cheap download) and partly because even the DDK examples had errors and there were few tools to catch them. –  Dec 02 '14 at 04:44
  • That's why Microsoft decided that all drivers should be checked by them (at a price) and should be signed - you still get unsigned drivers on occasion, but the user gets an alert and has to give specific permission to install them. So Microsoft has been systematically testing drivers and charging for that for quite a while. I'm not sure how far they are following the Apple model and checking and controlling Apps in the app store, but drivers were controlled for a long time before, there's good reasons for that, and Microsoft are unlikely to get complacent about them. –  Dec 02 '14 at 04:52
  • Of course I could be making some obsolete assumptions. For example, when you think about it, a USB game controller driver doesn't own a particular USB port. The port its currently dealing with may host multiple devices via a hub. IOW a game controller driver isn't really communicating directly with the hardware - there's other drivers in-between. And I'm sure I've heard about user-mode drivers or something like that. –  Dec 02 '14 at 05:03
  • Out of curiosity, have you ever checked out how [Synergy](http://synergy-project.org/) does it? Their Github link is posted on their page... – J Trana Dec 29 '14 at 08:01

0 Answers0