http://blog.csdn.net/wei97081116/archive/2009/03/29/4
033196.aspx
红色的方法我也不太清楚哈哈,欢迎交流完善。
am_device_notification_callback
定义:
typedef void(*am_device_notification_callback)(struct
*);
am_device_notification_callback_info
描述:
回调函数,当设备状态改变时由 iTunesMobileDevice.dll 回调
参数:
am_device_notification_callback_info 返回设备信息
am_restore_device_notification_callback
定义:
typedef void (*am_restore_device_notification_callback)(struct
am_recovery_device *);
描述:
回调函数,当检测到 restore 模式设备时由 iTunesMobileDevice.dll 回调
参数:
am_recovery_device 返回设备信息
AMDeviceNotificationSubscribe
定义:
mach_error_t
typedef
callback, unsigned int unused0, unsigned int unused1, unsigned int
am_device_notification *notification);
(*AMDeviceNotificationSubscribe)(am_device_notification_callback
dn_unknown3, struct
描述:
订阅设备状态改变回调绑定函数
参数:
am_device_notification_callback
callback 指向回调函数指针
unsigned int unused0 未知 itunes 调用时设为0
unsigned int unused1未知 itunes 调用时设为0
unsigned int dn_unknown3未知
am_device_notification *notification 设备信息结构
返回值:
*
*
*
MDERR_OK
if successful
------0
MDERR_SYSCALL
if CFRunLoopAddSource() failed
MDERR_OUT_OF_MEMORY if we ran out of memory
AMDeviceConnect
定义:
typedef mach_error_t (*AMDeviceConnect)(struct am_device *device);
描述:
连接设备
参数:
am_device *device 回调函数返回的设备信息
返回值:
*
*
*
*
MDERR_OK
if successfully connected
MDERR_SYSCALL
if setsockopt() failed
MDERR_QUERY_FAILED
if the daemon query failed
MDERR_INVALID_ARGUMENT if USBMuxConnectByPort returned 0xffffffff
AMDeviceIsPaired
定义:
typedef int (*AMDeviceIsPaired)(struct am_device *device);
描述:
检测路径是否存在,初始化阶段路径是"/"
参数:
am_device *device 回调函数返回的设备信息
返回值:
*
*
0
1
if the path did not exist
if it did
AMDeviceValidatePairing
定义:
typedef mach_error_t (*AMDeviceValidatePairing)(struct am_device *device);
描述:
Itunes 在测试(AMDeviceIsPaired)完后立即调用这个函数,建立配对文件并设置到
lockdown 的连接
参数:
am_device *device 回调函数返回的设备信息
返回值:
*
*
*
MDERR_OK
if successful
MDERR_INVALID_ARGUMENT if the supplied device is null
MDERR_DICT_NOT_LOADED
if the load_dict() call failed
AMDeviceStartSession
定义:
typedef mach_error_t (*AMDeviceStartSession)(struct am_device *device);
描述:
创 建 lockdown session , 如 果 创 建 成 功 适 当 的 调 整 设 备 结 构 。 Itunes 在
AMDeviceValidatePairing 后立即调用此函数
参数:
am_device *device 回调函数返回的设备信息
返回值:
*
*
*
MDERR_OK
if successful
MDERR_INVALID_ARGUMENT if the Lockdown conn has not been established
MDERR_DICT_NOT_LOADED
if the load_dict() call failed
AMDeviceStartService
定义:
typedef mach_error_t (*AMDeviceStartService)(struct am_device *device, void*
service_name, afc_connection **handle, unsigned int *unknown);
描述:
启动服务并返回指向这个服务的句柄,使用返回的句柄可以进行后续的各种操作。在使
用服务之前你应该关闭 session 断开连接(并不是这样的),itunes 调用此函数在调用完
AMDeviceStartSession 函数之后。
参数:
am_device *device 回调函数返回的设备信息
void*
service_name 要启动的服务名称,注意 MAC OS CFString 格式
afc_connection **handle 返回连接结构
unsigned int *unknown 未知 itunes 设为0
返回值:
*
*
*
MDERR_OK
if successful
MDERR_SYSCALL
if the setsockopt() call failed
MDERR_INVALID_ARGUMENT if the Lockdown conn has not been established
AMDeviceStopSession
定义:
typedef mach_error_t (*AMDeviceStopSession)(struct am_device *device);
描述:
关闭 session,在访问服务之前需要关闭 session(好像不用)。
参数:
am_device *device 回调函数返回的设备信息
返回值:
*
*
MDERR_OK
if successful
MDERR_INVALID_ARGUMENT if the Lockdown conn has not been established
AFCConnectionOpen
定义:
typedef
afc_error_t
(*AFCConnectionOpen)(afc_connection
*handle,
unsigned
int
io_timeout,struct afc_connection **conn);
描述:
打开 apple 文件系统的连接,在这之前你必须通过 AMDeviceStartService 打开了适当的
服务。
参数:
afc_connection *handle AMDeviceStartService 函数返回的连接信息
unsigned int io_timeout 超时设置为0
afc_connection **conn 返回的连接信息,可以和 afc_connection *handle 使用相同的对象
返回值:
*
*
MDERR_OK
if successful
MDERR_AFC_OUT_OF_MEMORY if malloc() failed
AFCDeviceInfoOpen
定义:
typedef afc_error_t (*AFCDeviceInfoOpen)(struct afc_connection *conn, struct afc_dictionary
**info);
描述:
获得设备的信息。
参数:
afc_connection *handle AMDeviceStartService 函数返回的连接信息
afc_dictionary **info 返回的设备信息
返回值:
*
*
MDERR_OK
if successful
MDERR_AFC_OUT_OF_MEMORY if malloc() failed
返回实例:
Model iPhone1,2
FSTotalBytes 524288000
FSFreeBytes 55099392
FSBlockSize 4096
AFCDirectoryOpen
定义:
typedef
/*afc_directory*/afc_directory **dir);
afc_error_t
(*AFCDirectoryOpen)(afc_connection
*conn,
char
*path,
描述:
打开一个目录。注,没有越狱的系统默认的"/"目录是"/var/root/Media"这是 itunes 的
sandbox 行为。
参数:
afc_connection * conn AMDeviceStartService 函数返回的连接信息
char *path 路径信息
afc_directory **dir 返回的路径句柄
返回值:
*
MDERR_OK
AFCDirectoryRead
if successful
afc_error_t
(*AFCDirectoryRead)(afc_connection
*conn,afc_directory
*dir,char
定义:
typedef
**dirent);
描述:
读取路径下的下一个节点,当到达最后一个节点后将返回 NULL。返回的前两个节点将
是"."和".."。
参数:
afc_connection * conn AMDeviceStartService 函数返回的连接信息
afc_directory *dir AFCDirectoryOpen 返回的目录句柄
char **dirent 返回的节点名字
返回值:
*
MDERR_OK
AFCDirectoryClose
定义:
if successful
typedef afc_error_t (*AFCDirectoryClose)(afc_connection *conn, struct afc_directory *dir);
描述:
关闭路径。
参数:
afc_connection * conn AMDeviceStartService 函数返回的连接信息
afc_directory *dir AFCDirectoryOpen 返回的目录句柄
返回值:
*
MDERR_OK
AFCDirectoryCreate
定义:
if successful
typedef afc_error_t (*AFCDirectoryCreate)(afc_connection *conn, char *dirname);
描述:
创建路径。注,创建的目录父路径必须存在。
参数:
afc_connection * conn AMDeviceStartService 函数返回的连接信息
char *dirname 完整的目录名字包括 path
返回值:
*
MDERR_OK
AFCRemovePath
定义:
if successful
typedef afc_error_t (*AFCRemovePath)(afc_connection *conn, char *dirname);
描述:
删除路径。注,路径为空。
参数:
afc_connection * conn AMDeviceStartService 函数返回的连接信息
char *dirname 完整的目录名字包括 path
返回值:
*
MDERR_OK
if successful
AFCRenamePath
定义:
typedef afc_error_t (*AFCRenamePath)(afc_connection *conn, char *oldpath, char *newpath);
描述:
路径改名。
参数:
afc_connection * conn AMDeviceStartService 函数返回的连接信息
char * oldpath 老得目录名
char *newpath 新的目录名
返回值:
*
MDERR_OK
if successful
AFCConnectionGetContext
定义:
typedef unsigned int (*AFCConnectionGetContext)(struct afc_connection *conn);
描述:
返回连接上下文。
参数:
afc_connection * conn AMDeviceStartService 函数返回的连接信息
返回值:
上下文编号
AFCConnectionGetFSBlockSize
定义:
typedef unsigned int (*AFCConnectionGetFSBlockSize)(struct afc_connection *conn);
描述:
返回文件系统 blocks 大小。
参数:
afc_connection * conn AMDeviceStartService 函数返回的连接信息