Windows MTP/WPD communication with Android device - c++

I'm developing a PC c++ application running on windows. The application shall communicate with an android phone connected thru USB, using MTP. The idée is to not mount the Storage Card. What I have found is that Windows have something they call WPD (Windows Portable Device ) which supports MTP. It looks pretty ok but it demands WMP11 to be installed. What I wondering:
Is there are any other alternatives libraries you can use?
Do any one have any tips or experience about using WPD?
Are there any "leaner" dependencies you can install instead of WMP11 for xp?
Any help would be greatly appreciated.

I here provide some answers to my question for the hope that it will help some one else.
Is there any alternatives/leaner libraries?
You can use WIA but that is only used for images. but a part from that I have not found any.
Any tips?
Check out the sample code provided by Microsoft, it is a good start point. I found it be searching for Portable Devices COM API Sample on MSDN
For Services you can check out this sample code. Which I found by googling for WpdServicesApiSample
The WPD api is pretty ok to use.
Not all devices support MTP and some only support part of it. This caused me some problem but the device we used released an update which supported more of MTP
I found the answer about XP-problems from this StackOverflow by pcbbc really helpful. I can also add that we mailed the supplier and asked for a custom .INF file to support XP and they were really helpful and provided us with it. But it took some time before we got it.

Related

Transfer files from iOS device to Windows PC via USB

In my C++ Windows application, my users can plug in their mobile device via USB and my application can transfer specific files to/from the device. For Android devices, I was able to use MTP. But iOS devices have me tripped up (I'm not an iOS user).
Immediately, I saw that MTP wasn't an option as I couldn't view the device's filesystem via Windows Explorer (wasn't expecting that). So now I'm stuck, and confused. Googled like crazy and all I discovered was that other 3rd party programs can do it, but I can't find any documentation or resources as to HOW.
Can someone point me in the right direction? What would I need to do in order to view the filesystem on a connected iOS device? Are there any libraries I may be unaware of that I can't find? I can see that iTunes has the functionality I'm looking for.
Thanks for your time!
Well, it looks like my comment was wrong. There is at least libimobiledevice http://www.libimobiledevice.org/ and https://github.com/libimobiledevice/ifuse that claims to still support access to the iOS device file system and even claims to be cross-platform. I haven't tried it though to verify if those claims are true.
See also https://www.theiphonewiki.com/wiki/MobileDevice_Library for some possible alternatives

Bluetooth in C++

I am looking to communicate via RFCOMM to another Bluetooth device. I want to use C++ (VS2008) for the application. I already know of the 32feet library, but was unsure if it would work for C++. Does anyone know of a good starting point for this kind of project? Or possibly 32feet samples written in C++? I want a simple, easy to use API for Bluetooth using C++.
This question is rather old, I know.
Just wanted to update, that Qt Framework has now Qt Bluetooth for C++ that looks very promising -- http://doc.qt.io/qt-5/qtbluetooth-module.html
You can do Bluetooth programming using BT sockets into the OS Bluetooth stack. This page discusses socket usage:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa362928(v=vs.85).aspx
This page has links to download Bluetooth SDK from Microsoft:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363058(v=vs.85).aspx
Building apps using the Microsoft stack works fairly well (XP and Vista work great, trying to run the same apps under Windows 7-64bit does not work so well...)
The real advantage to 32feet.net is that the Bluetooth support on Windows is heavily Balkanized - you never know on a given machine whether it is using the Microsoft, Broadcom, Toshiba, BlueSolei, or some other stack. While these are all mostly compatible over-the-air, the APIs are completely different for each. Building with 32feet.net lets your application run on a larger subset of machines... That said, I have not tried building it into a C++ application - sorry.

ActiveSync library

I am writing a cross-platform c++ application that needs to connect to Exchange servers and download mails using ActiveSync.
Is there any library available for ActiveSync (preferably open-source)?
I can't use Windows APIs as they won't run in Linux & Mac.
I used to work with the SynCE project on supporting Windows Mobile devices connected to desktop Linux machines so can offer a few pointers.
Do you mean ActiveSync or AirSync? AirSync is the protocol that used over the air and by ActiveSync to actually shift the data, ActiveSync is the whole stack for syncing a WinMo device connected to your computer. SynCE is the only open source "full stack" equivalent to ActiveSync that I know of, from driver to AirSync to GUI's and integration with OpenSync, and I don't know any open source projects that present themselves as a WinMo device to ActiveSync.
I don't know of any C or C++ implementations of AirSync, but I believe that the Samba and OpenChange teams have made good progress at supporting Exchange servers natively. About a year and a half ago I was told that even supporting the HTTP(s) transport wasn't far away in terms of work needed (but i'm not sure if its been a priority).
While not in C++ and while not even a client library, the SynCE project has open source python code which might be a useful reference if another library cannot be found.
Here is an example of a push mail server that was written by one of the SynCE developers: SynCE Airmail
And the main sync engine can be found here: SynCE SyncEngine
Within that code, I think SyncEngine/airsync.py will be most useful to you.
Digging around the SynCE wiki http://www.synce.org and their mailing list archive is a good way of finding out about problems encountered and surprising details about what the protocol is and isnt sensitive about.
You may find http://libwbxml.opensync.org useful - after the wbxml layer has been decoded AirSync is just XML passing.
And finally, Microsoft do provide documentation for the protocol:
ActiveSync HTTP Protocol Specification
Open Specification Support Team Blog: More ActiveSync
TechNet wiki Exchange ActiveSync Overview
Z-Push might provide you with the start you need.

Porting getifaddrs to Win XP

I'm trying to port a MacOSX app to windows and I've come up against a problem around getifaddrs. Basically windows does not support it. I'm trying to figure a way to re-implement it (for AF_INET and AF_INET6) but the "equivalent" functionality on windows appears to be nothing like the MacOSX support.
Has someone done this sort of conversion before? If so is there a nice way I can get windows to report me interface info like MacOSX does?
The closest functions on Windows are GetAdaptersInfo and GetAdaptersAddresses. The MSDN documentation is pretty comprehensive, so you should find everything you need.
getifaddrs() is not a portable solution, so if you need to support multiple platforms, you should consider using getaddrinfo, which is POSIX- and Windows-friendly. It is a little more complicated at first glance, but it really isn't that bad. This SO question has some good answers and links on the topic. (In particular, the showip.c example on Beej's page is quite helpful, and here is a Windows example; note that it is missing an #include <stdio.h> at the top, and be sure to link against Ws2_32.lib.)
I've done it here, including a separate version for Wine as the IP version agnostic routines don't current work as expected,
http://code.google.com/p/openpgm/source/browse/trunk/openpgm/pgm/getifaddrs.c
LGPL 2.1 license
edit: Wine 1.3 fixes the issues encountered with the IPv4 & IPv6 friendly API.
maybe win32 port of libpcap can help you?
(or port of libnet, if one exists)

Entrek CodeSnitch with Windows Mobile 5/6

I have emailed Entrek and they seem to be asleep.
Does anyone else here use Entrek CodeSnitch? If so, have you found a way to use it with Windows Mobile 5, 6, or 6.1 ?
I really need to verify my application doesn't have any memory leaks, etc. And CodeSnitch does a great job of it. But only with Windows Mobile 2003. :/
Thanks.
What's not working? Is it a client connectivity issue?
The older version used PlatMan for a communications layer, which is problematic from a Visual Studio standpoint (which ships with CoreCon), but if you have any tool installed that has Platman (eVC, Platform Builder) then that should still work fine since WinMo 5.x and 6.x are still based on CE 5.0.
I do know that Entrek has a newer version in beta (I have it) so you might try pinging them again. They tend to be pretty busy, but I've always gotten responses (though I know them well and personally, so that might not be any indicator for you).
I also see that they have their phone number posted on their web page. I'd give them a call. I do recall them saying the new version is supposed to address WinMo issues (I rarely use WinMo proper) so it's definitely worth a try.
I've not used CodeSnitch. But I have had success using the Application Verifier Tool to identify my leaks in WM5 and 6.
Getting it up and running can be a bit of a pain. But I find it to be a good tool and the price is right.
Here's a tutorial to get you started.
I've used CodeSnitch on windows mobile 5, 6 and 6.1 devices with no problems.
Make sure you have the v1.4 installed and applied the v1.4 patch which is referenced here.
Like ctackle says, you need an older communications layer called CoreCon. I've also found CETK has CoreCon in it as well and it's not as big as eVC or Platform builder.
You need to setup the device connection settings to use ActiveSync (both transport and startup server), it does not seem to matter what the connection is called so something like Pocket PC will work fine.
The other gotcha I found is that you need to edit the codesnitch and procman shortcuts and add "/targetcpu:armv4i" to the command line arguments for them to work on WM devices.
I have also found them recently to be non-responsive to support emails as well :(