How to access the picture file on iPod/iPhone? - c++

When I connect the iPod (or iPhone) to the Windows PC,
it look like an USB drive, but I can't open a file on it because I can't know the correct file path.
I was also unable to drop the file to my application because the drag source does not have CF_HDROP.
Some applications can open a file on iPod, but it was a copy on the local temp folder.
screenshot http://img862.imageshack.us/img862/5396/ipodx.png
My question is ..
How can I directly (programmatically) open and read the picture file on iPod?
If I double click on it (or right click and select Preview menu),
it launches Windows Photo Viewer -- it is not my default picture viewer.
Can I change the file (.PNG) association to other application?
What's the viewer application's requirement to be a default viewer for files on ipod?

Applications that do that use Picture Transfer Protocol (PTP). On Windows Microsoft implements many interfaces as part of Windows Image Acquisition (WIA). Read more here: http://msdn.microsoft.com/en-us/library/ms630344(v=VS.85).aspx
http://support.microsoft.com/kb/307859 or manually edit registry at HKEY_CLASSES_ROOT\.png

Try the iPhoneBrowser program. It should give you a fair idea of the path.

From everything I've read I don't think Apple gives you access to the file system on the iPhone / iTouch / iPad; they want you to use iTunes to transfer files back and forth. I believe the Android and Windows Phone environments have similar restrictions. (If you "jailbreak" or "root" your device that's obviously a different story, which is why many such utilities explicitly state they only work on rooted devices.)
In part, this is a security precaution: if it were possible to directly access the file system on the mobile device it would be that much easier for someone to plant malware on your phone or PDA.
For this reason, updates to the various mobile OSes frequently include changes to (1) make jailbreaking more difficult and/or (2) close the loopholes that allow software like the iPhoneBrowser to work.
Some of the portable music players that use (Windows) Media Player have similar limitations. For example, I had a Sansa m100 (I think) where I could just drag files to the device and the playlist would automatically get updated; on at least some of the newer models (eg the c200) you have to use Media Player to download content. Which to me is annoying since there doesn't seem to be a way to use Media Player to delete content from the device.
There probably are APIs to do this sort of thing, but I would guess they're somewhat specific to the platform you're using -- ie I don't think you're going to be able to just use CreateFile() or something like that.

Related

linux application to control optical media

I want a graphical application for Linux that displays the contents of CD/DVD/blu-ray drives and allows play or eject, and I'd like the solution to be general, so that I can donate it to Linux Mint, that is any drive type and any number of drives. In my system I have three dvd drives and a blu-ray drive.
I'd like to write it in bash using the dialog functions inside a terminal window but I need to have the dialog displayed in perpitude therefore, I need an interrupt to signal when the drive is opened or closed - what signal could I trap? Also, how can I include logic to select a program to play the media depending on the media type.
Also, should I consider writing it in java, python, C++, or other language and if so how to get hardware information (such as the number and capability of drives, and the type and title of optical media in drive)?
Ignoring the side of "I want to donate this to Linux Mint", which I believe is a bit pretentious, there is a eject utility in Linux.
The source code of that can be found here:
https://git.kernel.org/cgit/utils/util-linux/util-linux.git/tree/sys-utils/eject.c
In that code, there is also code to sense if the drive is open, closed, has no disk, etc.
To do CD or DVD playback is a whole other kettle of fish. To write a audio-player is not entirely trivial (even in the simple case of a straightforward PCM encoding, obviously MP3 is a fair bit more complex again), and a video-player is a lot more than that.
To "select a program", you'd have to know what the available players may be called, and, if you want to be fancy, check which ones are actually installed. I'm not aware of any really clever way of achieving that, beyond having a list of players in your code (which needs to be updated). In fact, I know that is how the photo viewer geeqie works when you want to edit a shot: it has a list of "known editors", and it scans the PATH to find which ones are available.

Can't access USB device inside Windows Store App

OK, first I shall point that I am completely new to Windows Apps Development, which is good, since I am trying to develop a Windows Store App for PC to use a PrimeSense Scanner connected via USB. I have asked a more specific question about this here.
This time I have a more generic question, which is more related to Windows Store app development. I am using VS2013 Express and compiling for Win32.
When I compile my application for VS2012 and run it as an execcutable file, I can connect to the scanner perfectly. But I can't do the same with VS2013 and running it as a Store app.
I know the device is connected and the drivers are updated and all dlls file placed in the Widnows System 32 directory.
I have also added all Capabilities to the App Manifest and also added the following Device Capability
<m2:DeviceCapability Name="usb">
<!--OSRFX2 Device-->
<m2:Device Id="vidpid:1d27 0609">
<m2:Function Type="classId:ff * *" />
<m2:Function Type="name:vendorSpecific" />
</m2:Device>
</m2:DeviceCapability>
The vid and pid, obviously match the corresponding codes of the device.
One of the errors I recieve when trying to conenct to the scanner using OpenNI is:
Could not open to "\\?\usb#vid_1d27&pid_0609&mi_00#7&1601586a&0&0000#{c3b5f022-5a42-1980-1909-ea72095601b1}" USB Device not found
This error is quite frustrating since I know the device is connected. So I tend to think that there is some level os specificity on the Windows Store App side of the game that is not enabling my to connect to the device. As I said, I am compiling for Win32.
Is there a chance that the drivers will not work for a Windows Store App. Is there some extra stuff I should do inside the Windows Store App logic that I am not doing and that is necessary to connect the USB device? I am sorry, but I am completely new to Windows Store App development.
Thank you.
You can't do that from metro apps.
You typically create a handle to that usb device by calling CreateFile with that object mananger path as the file to 'create'. CreateFile is not allowed in metro apps - "desktop apps only" - and its 'replacement', CreateFile2, specifically doesn't allow opening object manager objects.
Furthermore, the documentation for CreateFile2 states that in metro apps this function can only open files and directories (and not things like pipes, mailslots, consoles, etc.).
See also this post on social.msdn
Unless I missed something, I don't think this is possible.

Enabling sound with Xcode 'sandbox'ed application

I have an application which plays a midi sound.
The application works fine without sandboxing, and plays the sound it is supposed to play, but I cannot here the sound when I enable sandboxing.
I need to upload the application to mac app store, but i cannot do it, because i cannot get sound.
I also cannot open the file dialog box, when I enable sandboxing.
Is there any way I can at least enable the sound in the app?
As Petesh said in above comments, I had to add some more entries in the entitlements file,
the link which was given by him above, contained following. You add them to your entitlement file, and everything will start working like a charm.
This one allows your application to access the microphone.
com.apple.security.device.microphone
This allows talking to the MIDI Server which coordinates all the Midi functionality across applications.
com.apple.security.temporary-exception.mach-lookup.global-name
This allows talking to audio components which are not itself sandboxed.
com.apple.security.temporary-exception.audio-unit-host
They worked for me.

Drag-and-drop onto the desktop or into a specific folder, without temporary storage.

I've written a little file-transfer application written in C++ using Qt 4.x. It logs into a server, shows the user a list of files available on the server, and lets the user upload or download files.
This all works fine; you can even drag a file in from the desktop (or from an open folder), and when you drop the file icon into the server-files-list-view, the dropped file gets uploaded to the server.
Now I have a request for the opposite action as well. My users would like to be able to drag a file out of the server-files-list-view and onto the desktop, or into an open folder window, and have that file get downloaded into that location.
That seems like a reasonable request, but I don't know how to implement it. Is there a way for a Qt application to find out the directory corresponding to where "drop event" occurred, when the icon was dropped onto the desktop or into an open folder window? Ideally this would be a Qt-based platform-neutral mechanism, but if that doesn't exist, then platform-specific mechanisms for MacOS/X and Windows (XP or higher) would suffice.
Even though I have never done exactly what you intend, I reckon this is doable with Qt.
You first have to deal with the drag event. This depends on the view you are using to see the files heirarchy in your server. Anyway here is a link to help you enable drag files from your view: http://www.trinitydesktop.org/docs/qt4/model-view-dnd.html In short it's just a couple a virtual functions to reimplement. The doc is here to help.
You may also see this link about how Drag/Drop events are handled in Qt: http://www.trinitydesktop.org/docs/qt4/dnd.html
I was about to answer about the drop event, when I noticed that the same question was asked word for word 3 years ago...
Qt 4.x: how to implement drag-and-drop onto the desktop or into a folder?

Spooling Thermal Shipping Label Data From Web Site

I need help trying to get thermal shipping label data from a Web site to a local Zebra printer. The data itself is just plain text but spooling it from a Web site seems to be very difficult for some reason. Does anyone have any experience with this? I am using ColdFusion 8 and Windows Server 2008.
Your print data could be sent with a MIME type (there probably is one for it, but you could make one up too)
On the client's PC, they could have that MIME type mapped to a program that simply prints whatever it receives.
Setting the MIME type on a PC can be done with code or a .REG file. If you control the user's environment, that's pretty simple. Making a program that dumps whatever it receives is also easy. That would be a nice task for Visual C or good, old VB6. Very little code. As long as the user has the .EXE and the .REG file, they'll print reliably, every time, without the browser's crap getting in the way. (think of this as what happens when you click a link to a PDF - Acrobat opens. Well, have the little printing EXE open for your file type - easy).
This is familiar to me... I think I did this with a proprietary font set... AH! Yes, I had to do this to generate mortgage documents that used proprietary fonts for drawing the pretty lines. I was able to take a proprietary, stand-alone mortgage origination server, share the folder where the mortgage .PRN files had been created. A Web server with access to that share enumerate the files in the share to a Web page, then, when users clicked on a file, the .PRN would stream to their PCs where a corresponding .EXE would see it as one of its own and send it to the correct output device (a designated printer at their location). That dumb little piece of code eliminated 126 document servers (and their maintenance and licensing costs) instantly and mortgage documents were never lost or sent to the wrong branch by mistake again. I think it took 3 hours to get it all working from inception to testing at the branches.
Yeah, same thing here. It'll work. Trust me. It'll work.
I was unclear by your question as if the Zebra printer is connected to the web server and what software the server is running. If you are trying to send the data to a printer connected to the web server, I used the following information to send label data to a Zebra thermal printer in an Intranet solution and it worked great:
How to send raw data to a printer by using Visual C# .NET
Perhaps you can adapt this solution to your environment.
I fiddled about with this problem for ages. In the end I had to create downloadable printfiles. The user downloads them and then copy (MSDOS) them to the printer.
There were two main issues:
generally speaking, you can't print
from a website unless you open the
file (ie the file becomes local)
the print drivers on the user's (Windows)
machine add non-printing characters
to the barcode file as it is sent to
the printer
We installed a batch file (which runs copy instead of print) on all client machines that need to print barcodes and we added a right-click menu item to run the batch on files named *.barcode.
I'll be watching this thread to see if anyone has found a more direct solution. But this was the only thing we could do given the parameters of our situation.
I don't know if I have fully understood your problem or the exact environment but I have answered a similar question here with an example for ASP.NET (C#). That solution is mainly for a known printer (specific IP and port). If you have several clients with their own label printers the solution could be used for that as well. But then you have to make a solution where the clients are able to set their own IP and port of their label printer. They also might need to make a port forward for the traffic in their firewall. The webpage then just prints to the specified IP and port. You can also use a domain name instead of IP.
Perhaps you could try this:
http://code.google.com/p/jzebra/
This project allows the ZPL commands to be sent to the printer via a web browser.