
是否有Apple提供的协议或API?
我一直在挖掘互联网,发现此链接Layered communication for iPhone.
我也使用libUsbDotNet库与USB设备进行通信(Example).任何人都可以建议应该使用哪个EndPoints.
在我看来,我必须在windows应用程序中实现usbmuxd.它是一种多层协议.必须有一些库实现usbmuxd(我不认为我必须自己实现协议)
我对iTunes通信以及USB通信都不太了解.我正在尽可能多地添加信息(当然还有我在R& D中提出的内容).任何帮助都非常感谢.
public static DateTime LastDataEventDate = DateTime.Now; public static UsbDevice MyUsbDevice; #region SET YOUR USB @R_502_6658@or and Product ID! public static UsbDeviceFinder MyUsbFinder = new UsbDeviceFinder(1452,4768); #endregion private voID libUSB() { ErrorCode ec = ErrorCode.None; try { // Find and open the usb device. MyUsbDevice = UsbDevice.OpenUsbDevice(MyUsbFinder); // If the device is open and ready if (MyUsbDevice == null) throw new Exception("Device Not Found."); // If this is a "whole" usb device (libusb-win32,linux libusb) // it will have an IUsbDevice interface. If not (WinUSB) the // variable will be null indicating this is an interface of a // device. IUsbDevice wholeUsbDevice = MyUsbDevice as IUsbDevice; if (!ReferenceEquals(wholeUsbDevice,null)) { // This is a "whole" USB device. Before it can be used,// the desired configuration and interface must be selected. // Select config #1 wholeUsbDevice.SetConfiguration(1); // Claim interface #0. wholeUsbDevice.ClaimInterface(0); } // open read endpoint 1. UsbEndpointReader reader = MyUsbDevice.OpenEndpointReader(ReadEndpointID.Ep03); // open write endpoint 1. UsbEndpointWriter writer = MyUsbDevice.OpenEndpointWriter(WriteEndpointID.Ep02); int bytesWritten; ec = writer.Write(usbmux_header.GetBytes(),2000,out bytesWritten); if (ec != ErrorCode.None) throw new Exception(UsbDevice.LastErrorString); byte[] readBuffer = new byte[1024]; while (ec == ErrorCode.None) { int bytesRead; // If the device hasn't sent data in the last 100 milliseconds,// a timeout error (ec = IoTimedOut) will occur. ec = reader.Read(readBuffer,10000,out bytesRead); if (ec == ErrorCode.Win32Error) throw new Exception("port not open"); if (bytesRead == 0) throw new Exception("No more bytes!"); // Write that output to the console. Console.Write(EnCoding.Default.GetString(readBuffer,bytesRead)); } } catch (Exception ex) { Console.Writeline(); Console.Writeline((ec != ErrorCode.None ? ec + ":" : String.Empty) + ex.Message); } finally { if (MyUsbDevice != null) { if (MyUsbDevice.IsOpen) { // If this is a "whole" usb device (libusb-win32,linux libusb-1.0) // it exposes an IUsbDevice interface. If not (WinUSB) the // 'wholeUsbDevice' variable will be null indicating this is // an interface of a device; it does not require or support // configuration and interface selection. IUsbDevice wholeUsbDevice = MyUsbDevice as IUsbDevice; if (!ReferenceEquals(wholeUsbDevice,null)) { // Release interface #0. wholeUsbDevice.ReleaseInterface(0); } MyUsbDevice.Close(); } MyUsbDevice = null; // Free usb resources UsbDevice.Exit(); } } }class usbmux_header{ public static UInt32 length = 10; // length of message,including header public static UInt32 reserved = 0; // always zero public static UInt32 type = 3; // message type public static UInt32 tag = 2; // responses to this query will echo back this tag public static byte[] GetBytes() { byte[] lgth = BitConverter.GetBytes(length); byte[] res = BitConverter.GetBytes(reserved); byte[] tpe = BitConverter.GetBytes(type); byte[] tg = BitConverter.GetBytes(tag); byte[] retArray = new byte[16]; lgth.copyTo(retArray,0); res.copyTo(retArray,4); tpe.copyTo(retArray,8); tg.copyTo(retArray,12); return retArray; }}; 我一直在尝试向iPhone发送hello数据包字节,但我无法从手机中读取任何响应.
解决方法 要使用ipod,您可以使用 SharePodLib 总结以上是内存溢出为你收集整理的xcode – 在c#中开发类似应用程序的iTunes全部内容,希望文章能够帮你解决xcode – 在c#中开发类似应用程序的iTunes所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)