本文整理汇总了C++中plist_dict_set_item函数的典型用法代码示例。如果您正苦于以下问题:C++ plist_dict_set_item函数的具体用法?C++ plist_dict_set_item怎么用?C++ plist_dict_set_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了plist_dict_set_item函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: lockdownd_get_value
LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_get_value(lockdownd_client_t client, const char *domain, const char *key, plist_t *value)
{
if (!client)
return LOCKDOWN_E_INVALID_ARG;
plist_t dict = NULL;
lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR;
/* setup request plist */
dict = plist_new_dict();
plist_dict_add_label(dict, client->label);
if (domain) {
plist_dict_set_item(dict,"Domain", plist_new_string(domain));
}
if (key) {
plist_dict_set_item(dict,"Key", plist_new_string(key));
}
plist_dict_set_item(dict,"Request", plist_new_string("GetValue"));
/* send to device */
ret = lockdownd_send(client, dict);
plist_free(dict);
dict = NULL;
if (ret != LOCKDOWN_E_SUCCESS)
return ret;
/* Now get device's answer */
ret = lockdownd_receive(client, &dict);
if (ret != LOCKDOWN_E_SUCCESS)
return ret;
ret = lockdown_check_result(dict, "GetValue");
if (ret == LOCKDOWN_E_SUCCESS) {
debug_info("success");
}
if (ret != LOCKDOWN_E_SUCCESS) {
plist_free(dict);
return ret;
}
plist_t value_node = plist_dict_get_item(dict, "Value");
if (value_node) {
debug_info("has a value");
*value = plist_copy(value_node);
}
plist_free(dict);
return ret;
}
开发者ID:skposs,项目名称:WinLibmobiledevice,代码行数:53,代码来源:lockdown.c
示例2: lockdownd_stop_session
LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_stop_session(lockdownd_client_t client, const char *session_id)
{
if (!client)
return LOCKDOWN_E_INVALID_ARG;
if (!session_id) {
debug_info("no session_id given, cannot stop session");
return LOCKDOWN_E_INVALID_ARG;
}
lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR;
plist_t dict = plist_new_dict();
plist_dict_add_label(dict, client->label);
plist_dict_set_item(dict,"Request", plist_new_string("StopSession"));
plist_dict_set_item(dict,"SessionID", plist_new_string(session_id));
debug_info("stopping session %s", session_id);
ret = lockdownd_send(client, dict);
plist_free(dict);
dict = NULL;
ret = lockdownd_receive(client, &dict);
if (!dict) {
debug_info("LOCKDOWN_E_PLIST_ERROR");
return LOCKDOWN_E_PLIST_ERROR;
}
ret = LOCKDOWN_E_UNKNOWN_ERROR;
if (lockdown_check_result(dict, "StopSession") == RESULT_SUCCESS) {
debug_info("success");
ret = LOCKDOWN_E_SUCCESS;
}
plist_free(dict);
dict = NULL;
if (client->session_id) {
free(client->session_id);
client->session_id = NULL;
}
if (client->ssl_enabled) {
property_list_service_disable_ssl(client->parent);
client->ssl_enabled = 0;
}
return ret;
}
开发者ID:cachua1979,项目名称:libimobiledevice,代码行数:52,代码来源:lockdown.c
示例3: lockdownd_activate
LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_activate(lockdownd_client_t client, plist_t activation_record)
{
if (!client)
return LOCKDOWN_E_INVALID_ARG;
if (!client->session_id)
return LOCKDOWN_E_NO_RUNNING_SESSION;
if (!activation_record)
return LOCKDOWN_E_INVALID_ARG;
lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR;
plist_t dict = plist_new_dict();
plist_dict_add_label(dict, client->label);
plist_dict_set_item(dict,"Request", plist_new_string("Activate"));
plist_dict_set_item(dict,"ActivationRecord", plist_copy(activation_record));
ret = lockdownd_send(client, dict);
plist_free(dict);
dict = NULL;
ret = lockdownd_receive(client, &dict);
if (!dict) {
debug_info("LOCKDOWN_E_PLIST_ERROR");
return LOCKDOWN_E_PLIST_ERROR;
}
ret = LOCKDOWN_E_ACTIVATION_FAILED;
if (lockdown_check_result(dict, "Activate") == RESULT_SUCCESS) {
debug_info("success");
ret = LOCKDOWN_E_SUCCESS;
} else {
plist_t error_node = plist_dict_get_item(dict, "Error");
if (error_node && PLIST_STRING == plist_get_node_type(error_node)) {
char *error = NULL;
plist_get_string_val(error_node, &error);
if (!strcmp(error, "InvalidActivationRecord")) {
ret = LOCKDOWN_E_INVALID_ACTIVATION_RECORD;
}
free(error);
}
}
plist_free(dict);
dict = NULL;
return ret;
}
开发者ID:cachua1979,项目名称:libimobiledevice,代码行数:50,代码来源:lockdown.c
示例4: np_post_notification
/**
* Sends a notification to the device's notification_proxy.
*
* @param client The client to send to
* @param notification The notification message to send
*
* @return NP_E_SUCCESS on success, or an error returned by np_plist_send
*/
np_error_t np_post_notification(np_client_t client, const char *notification)
{
if (!client || !notification) {
return NP_E_INVALID_ARG;
}
np_lock(client);
plist_t dict = plist_new_dict();
plist_dict_set_item(dict,"Command", plist_new_string("PostNotification"));
plist_dict_set_item(dict,"Name", plist_new_string(notification));
np_error_t res = np_error(property_list_service_send_xml_plist(client->parent, dict));
plist_free(dict);
dict = plist_new_dict();
plist_dict_set_item(dict,"Command", plist_new_string("Shutdown"));
res = np_error(property_list_service_send_xml_plist(client->parent, dict));
plist_free(dict);
if (res != NP_E_SUCCESS) {
debug_info("Error sending XML plist to device!");
}
// try to read an answer, we just ignore errors here
dict = NULL;
property_list_service_receive_plist(client->parent, &dict);
if (dict) {
#ifndef STRIP_DEBUG_CODE
char *cmd_value = NULL;
plist_t cmd_value_node = plist_dict_get_item(dict, "Command");
if (plist_get_node_type(cmd_value_node) == PLIST_STRING) {
plist_get_string_val(cmd_value_node, &cmd_value);
}
if (cmd_value && !strcmp(cmd_value, "ProxyDeath")) {
// this is the expected answer
} else {
debug_plist(dict);
}
if (cmd_value) {
free(cmd_value);
}
#endif
plist_free(dict);
}
np_unlock(client);
return res;
}
开发者ID:KobyBo,项目名称:libimobiledevice,代码行数:58,代码来源:notification_proxy.c
示例5: instproxy_lookup_archives
LIBIMOBILEDEVICE_API instproxy_error_t instproxy_lookup_archives(instproxy_client_t client, plist_t client_options, plist_t *result)
{
instproxy_error_t res = INSTPROXY_E_UNKNOWN_ERROR;
plist_t command = plist_new_dict();
plist_dict_set_item(command, "Command", plist_new_string("LookupArchives"));
if (client_options)
plist_dict_set_item(command, "ClientOptions", plist_copy(client_options));
res = instproxy_perform_command(client, command, INSTPROXY_COMMAND_TYPE_SYNC, instproxy_copy_lookup_result_cb, (void*)result);
plist_free(command);
return res;
}
开发者ID:pyraman,项目名称:DeviceCenter,代码行数:15,代码来源:installation_proxy.c
示例6: lockdownd_pair_record_to_plist
/**
* Returns a new plist from the supplied lockdownd pair record. The caller is
* responsible for freeing the plist.
*
* @param pair_record The pair record to create a plist from.
*
* @return A pair record plist from the device, NULL if pair_record is not set
*/
static plist_t lockdownd_pair_record_to_plist(lockdownd_pair_record_t pair_record)
{
if (!pair_record)
return NULL;
/* setup request plist */
plist_t dict = plist_new_dict();
plist_dict_set_item(dict, "DeviceCertificate", plist_new_data(pair_record->device_certificate, strlen(pair_record->device_certificate)));
plist_dict_set_item(dict, "HostCertificate", plist_new_data(pair_record->host_certificate, strlen(pair_record->host_certificate)));
plist_dict_set_item(dict, "HostID", plist_new_string(pair_record->host_id));
plist_dict_set_item(dict, "RootCertificate", plist_new_data(pair_record->root_certificate, strlen(pair_record->root_certificate)));
plist_dict_set_item(dict, "SystemBUID", plist_new_string(pair_record->system_buid));
return dict;
}
开发者ID:Polyfun,项目名称:libimobiledevice,代码行数:23,代码来源:lockdown.c
示例7: diagnostics_relay_sleep
LIBIMOBILEDEVICE_API diagnostics_relay_error_t diagnostics_relay_sleep(diagnostics_relay_client_t client)
{
if (!client)
return DIAGNOSTICS_RELAY_E_INVALID_ARG;
diagnostics_relay_error_t ret = DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR;
plist_t dict = plist_new_dict();
plist_dict_set_item(dict,"Request", plist_new_string("Sleep"));
ret = diagnostics_relay_send(client, dict);
plist_free(dict);
dict = NULL;
ret = diagnostics_relay_receive(client, &dict);
if (!dict) {
return DIAGNOSTICS_RELAY_E_PLIST_ERROR;
}
int check = diagnostics_relay_check_result(dict);
if (check == RESULT_SUCCESS) {
ret = DIAGNOSTICS_RELAY_E_SUCCESS;
} else if (check == RESULT_UNKNOWN_REQUEST) {
ret = DIAGNOSTICS_RELAY_E_UNKNOWN_REQUEST;
} else {
ret = DIAGNOSTICS_RELAY_E_UNKNOWN_ERROR;
}
plist_free(dict);
return ret;
}
开发者ID:Polyfun,项目名称:libimobiledevice,代码行数:31,代码来源:diagnostics_relay.c
示例8: lockdownd_enter_recovery
LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_enter_recovery(lockdownd_client_t client)
{
if (!client)
return LOCKDOWN_E_INVALID_ARG;
lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR;
plist_t dict = plist_new_dict();
plist_dict_add_label(dict, client->label);
plist_dict_set_item(dict,"Request", plist_new_string("EnterRecovery"));
debug_info("telling device to enter recovery mode");
ret = lockdownd_send(client, dict);
plist_free(dict);
dict = NULL;
ret = lockdownd_receive(client, &dict);
if (lockdown_check_result(dict, "EnterRecovery") == RESULT_SUCCESS) {
debug_info("success");
ret = LOCKDOWN_E_SUCCESS;
}
plist_free(dict);
dict = NULL;
return ret;
}
开发者ID:cachua1979,项目名称:libimobiledevice,代码行数:27,代码来源:lockdown.c
示例9: mobile_image_mounter_hangup
/**
* Hangs up the connection to the mobile_image_mounter service.
* This functions has to be called before freeing up a mobile_image_mounter
* instance. If not, errors appear in the device's syslog.
*
* @param client The client to hang up
*
* @return MOBILE_IMAGE_MOUNTER_E_SUCCESS on success,
* MOBILE_IMAGE_MOUNTER_E_INVALID_ARG if client is invalid,
* or another error code otherwise.
*/
mobile_image_mounter_error_t mobile_image_mounter_hangup(mobile_image_mounter_client_t client)
{
if (!client) {
return MOBILE_IMAGE_MOUNTER_E_INVALID_ARG;
}
mobile_image_mounter_lock(client);
plist_t dict = plist_new_dict();
plist_dict_set_item(dict, "Command", plist_new_string("Hangup"));
mobile_image_mounter_error_t res = mobile_image_mounter_error(property_list_service_send_xml_plist(client->parent, dict));
plist_free(dict);
if (res != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {
debug_info("%s: Error sending XML plist to device!", __func__);
goto leave_unlock;
}
dict = NULL;
res = mobile_image_mounter_error(property_list_service_receive_plist(client->parent, &dict));
if (res != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {
debug_info("%s: Error receiving response from device!", __func__);
}
if (dict) {
debug_plist(dict);
plist_free(dict);
}
leave_unlock:
mobile_image_mounter_unlock(client);
return res;
}
开发者ID:KobyBo,项目名称:libimobiledevice,代码行数:43,代码来源:mobile_image_mounter.c
示例10: sbservices_get_home_screen_wallpaper_pngdata
LIBIMOBILEDEVICE_API sbservices_error_t sbservices_get_home_screen_wallpaper_pngdata(sbservices_client_t client, char **pngdata, uint64_t *pngsize)
{
if (!client || !client->parent || !pngdata)
return SBSERVICES_E_INVALID_ARG;
sbservices_error_t res = SBSERVICES_E_UNKNOWN_ERROR;
plist_t dict = plist_new_dict();
plist_dict_set_item(dict, "command", plist_new_string("getHomeScreenWallpaperPNGData"));
sbservices_lock(client);
res = sbservices_error(property_list_service_send_binary_plist(client->parent, dict));
if (res != SBSERVICES_E_SUCCESS) {
debug_info("could not send plist, error %d", res);
goto leave_unlock;
}
plist_free(dict);
dict = NULL;
res = sbservices_error(property_list_service_receive_plist(client->parent, &dict));
if (res == SBSERVICES_E_SUCCESS) {
plist_t node = plist_dict_get_item(dict, "pngData");
if (node) {
plist_get_data_val(node, pngdata, pngsize);
}
}
leave_unlock:
if (dict) {
plist_free(dict);
}
sbservices_unlock(client);
return res;
}
开发者ID:skposs,项目名称:WinLibmobiledevice,代码行数:35,代码来源:sbservices.c
示例11: restored_goodbye
LIBIMOBILEDEVICE_API restored_error_t restored_goodbye(restored_client_t client)
{
if (!client)
return RESTORE_E_INVALID_ARG;
restored_error_t ret = RESTORE_E_UNKNOWN_ERROR;
plist_t dict = plist_new_dict();
plist_dict_add_label(dict, client->label);
plist_dict_set_item(dict,"Request", plist_new_string("Goodbye"));
debug_info("called");
ret = restored_send(client, dict);
plist_free(dict);
dict = NULL;
ret = restored_receive(client, &dict);
if (!dict) {
debug_info("did not get goodbye response back");
return RESTORE_E_PLIST_ERROR;
}
if (restored_check_result(dict) == RESULT_SUCCESS) {
debug_info("success");
ret = RESTORE_E_SUCCESS;
}
plist_free(dict);
dict = NULL;
return ret;
}
开发者ID:skposs,项目名称:WinLibmobiledevice,代码行数:31,代码来源:restore.c
示例12: restored_reboot
LIBIMOBILEDEVICE_API restored_error_t restored_reboot(restored_client_t client)
{
if (!client)
return RESTORE_E_INVALID_ARG;
plist_t dict = NULL;
restored_error_t ret = RESTORE_E_UNKNOWN_ERROR;
dict = plist_new_dict();
plist_dict_add_label(dict, client->label);
plist_dict_set_item(dict,"Request", plist_new_string("Reboot"));
/* send to device */
ret = restored_send(client, dict);
plist_free(dict);
dict = NULL;
if (RESTORE_E_SUCCESS != ret)
return ret;
ret = restored_receive(client, &dict);
if (RESTORE_E_SUCCESS != ret)
return ret;
if (!dict)
return RESTORE_E_PLIST_ERROR;
plist_free(dict);
dict = NULL;
return ret;
}
开发者ID:skposs,项目名称:WinLibmobiledevice,代码行数:31,代码来源:restore.c
示例13: send_result
static int send_result(struct mux_client *client, uint32_t tag, uint32_t result)
{
int res = -1;
if (client->proto_version == 1) {
/* XML plist packet */
plist_t dict = plist_new_dict();
plist_dict_set_item(dict, "MessageType", plist_new_string("Result"));
plist_dict_set_item(dict, "Number", plist_new_uint(result));
res = send_plist_pkt(client, tag, dict);
plist_free(dict);
} else {
/* binary packet */
res = send_pkt(client, tag, MESSAGE_RESULT, &result, sizeof(uint32_t));
}
return res;
}
开发者ID:piaoyunsoft,项目名称:usbmuxd,代码行数:16,代码来源:client.c
示例14: instproxy_upgrade
LIBIMOBILEDEVICE_API instproxy_error_t instproxy_upgrade(instproxy_client_t client, const char *pkg_path, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data)
{
instproxy_error_t res = INSTPROXY_E_UNKNOWN_ERROR;
plist_t command = plist_new_dict();
plist_dict_set_item(command, "Command", plist_new_string("Upgrade"));
if (client_options)
plist_dict_set_item(command, "ClientOptions", plist_copy(client_options));
plist_dict_set_item(command, "PackagePath", plist_new_string(pkg_path));
res = instproxy_perform_command(client, command, INSTPROXY_COMMAND_TYPE_ASYNC, status_cb, user_data);
plist_free(command);
return res;
}
开发者ID:pyraman,项目名称:DeviceCenter,代码行数:16,代码来源:installation_proxy.c
示例15: plist_dict_add_label
/**
* Adds a label key with the passed value to a plist dict node.
*
* @param plist The plist to add the key to
* @param label The value for the label key
*
*/
static void plist_dict_add_label(plist_t plist, const char *label)
{
if (plist && label) {
if (plist_get_node_type(plist) == PLIST_DICT)
plist_dict_set_item(plist, "Label", plist_new_string(label));
}
}
开发者ID:skposs,项目名称:WinLibmobiledevice,代码行数:14,代码来源:restore.c
示例16: mobilebackup_send_message
/**
* Sends a backup message plist.
*
* @param client The connected MobileBackup client to use.
* @param message The message to send. This will be inserted into the request
* plist as value for BackupMessageTypeKey. If this parameter is NULL,
* the plist passed in the options parameter will be sent directly.
* @param options Additional options as PLIST_DICT to add to the request.
* The BackupMessageTypeKey with the value passed in the message parameter
* will be inserted into this plist before sending it. This parameter
* can be NULL if message is not NULL.
*/
static mobilebackup_error_t mobilebackup_send_message(mobilebackup_client_t client, const char *message, plist_t options)
{
if (!client || !client->parent || (!message && !options))
return MOBILEBACKUP_E_INVALID_ARG;
if (options && (plist_get_node_type(options) != PLIST_DICT)) {
return MOBILEBACKUP_E_INVALID_ARG;
}
mobilebackup_error_t err;
if (message) {
plist_t dict = NULL;
if (options) {
dict = plist_copy(options);
} else {
dict = plist_new_dict();
}
plist_dict_set_item(dict, "BackupMessageTypeKey", plist_new_string(message));
/* send it as DLMessageProcessMessage */
err = mobilebackup_error(device_link_service_send_process_message(client->parent, dict));
plist_free(dict);
} else {
err = mobilebackup_error(device_link_service_send_process_message(client->parent, options));
}
if (err != MOBILEBACKUP_E_SUCCESS) {
debug_info("ERROR: Could not send message '%s' (%d)!", message, err);
}
return err;
}
开发者ID:Iancurtis,项目名称:libimobiledevice,代码行数:43,代码来源:mobilebackup.c
示例17: notify_device_remove
static int notify_device_remove(struct mux_client *client, uint32_t device_id)
{
int res = -1;
if (client->proto_version == 1) {
/* XML plist packet */
plist_t dict = plist_new_dict();
plist_dict_set_item(dict, "MessageType", plist_new_string("Detached"));
plist_dict_set_item(dict, "DeviceID", plist_new_uint(device_id));
res = send_plist_pkt(client, 0, dict);
plist_free(dict);
} else {
/* binary packet */
res = send_pkt(client, 0, MESSAGE_DEVICE_REMOVE, &device_id, sizeof(uint32_t));
}
return res;
}
开发者ID:piaoyunsoft,项目名称:usbmuxd,代码行数:16,代码来源:client.c
示例18: send_device_list
static int send_device_list(struct mux_client *client, uint32_t tag)
{
int res = -1;
plist_t dict = plist_new_dict();
plist_t devices = plist_new_array();
struct device_info *devs = NULL;
struct device_info *dev;
int i;
int count = device_get_list(0, &devs);
dev = devs;
for (i = 0; devs && i < count; i++) {
plist_t device = create_device_attached_plist(dev++);
if (device) {
plist_array_append_item(devices, device);
}
}
if (devs)
free(devs);
plist_dict_set_item(dict, "DeviceList", devices);
res = send_plist_pkt(client, tag, dict);
plist_free(dict);
return res;
}
开发者ID:piaoyunsoft,项目名称:usbmuxd,代码行数:26,代码来源:client.c
示例19: lockdownd_deactivate
LIBIMOBILEDEVICE_API lockdownd_error_t lockdownd_deactivate(lockdownd_client_t client)
{
if (!client)
return LOCKDOWN_E_INVALID_ARG;
if (!client->session_id)
return LOCKDOWN_E_NO_RUNNING_SESSION;
lockdownd_error_t ret = LOCKDOWN_E_UNKNOWN_ERROR;
plist_t dict = plist_new_dict();
plist_dict_add_label(dict, client->label);
plist_dict_set_item(dict,"Request", plist_new_string("Deactivate"));
ret = lockdownd_send(client, dict);
plist_free(dict);
dict = NULL;
ret = lockdownd_receive(client, &dict);
if (!dict) {
debug_info("LOCKDOWN_E_PLIST_ERROR");
return LOCKDOWN_E_PLIST_ERROR;
}
ret = LOCKDOWN_E_UNKNOWN_ERROR;
if (lockdown_check_result(dict, "Deactivate") == RESULT_SUCCESS) {
debug_info("success");
ret = LOCKDOWN_E_SUCCESS;
}
plist_free(dict);
dict = NULL;
return ret;
}
开发者ID:cachua1979,项目名称:libimobiledevice,代码行数:34,代码来源:lockdown.c
示例20: instproxy_remove_archive
LIBIMOBILEDEVICE_API instproxy_error_t instproxy_remove_archive(instproxy_client_t client, const char *appid, plist_t client_options, instproxy_status_cb_t status_cb, void *user_data)
{
instproxy_error_t res = INSTPROXY_E_UNKNOWN_ERROR;
plist_t command = plist_new_dict();
plist_dict_set_item(command, "Command", plist_new_string("RemoveArchive"));
if (client_options)
plist_dict_set_item(command, "ClientOptions", plist_copy(client_options));
plist_dict_set_item(command, "ApplicationIdentifier", plist_new_string(appid));
res = instproxy_perform_command(client, command, INSTPROXY_COMMAND_TYPE_ASYNC, status_cb, user_data);
plist_free(command);
return res;
}
开发者ID:pyraman,项目名称:DeviceCenter,代码行数:16,代码来源:installation_proxy.c
注:本文中的plist_dict_set_item函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论