static void set_property_cb(DBusPendingCall *pending, void *user_data) { struct property_setting *set = user_data; struct connman_service *service; struct property_change *property; DBusMessage *reply; DBusError error; if (dbus_pending_call_get_completed(pending) == FALSE) return; if (set == NULL) return; service = set->data; service->call_modify[set->index] = NULL; if (service->property_set_error_cb == NULL) return; property = g_try_malloc0(sizeof(struct property_change)); if (property == NULL) return; reply = dbus_pending_call_steal_reply(pending); if (reply == NULL) return; if (dbus_set_error_from_message(&error, reply) == FALSE) goto done; printf("SetProperty Error: %s\n", error.message); dbus_error_free(&error); if (service->property_set_error_cb == NULL) goto done; property = g_try_malloc0(sizeof(struct property_change)); if (property == NULL) goto done; property->path = service->path; property->name = PROPERTY(set->index); property->error = -1; if (service->to_error[set->index] != 0) g_source_remove(service->to_error[set->index]); service->to_error[set->index] = g_timeout_add_full( G_PRIORITY_DEFAULT, 0, property_changed_or_error, property, destroy_property); done: dbus_message_unref(reply); }
static void property_finalize (GObject *item) { Property *ret; ret = PROPERTY (item); if (ret->priv->name != NULL) g_free (ret->priv->name); if (ret->priv->uri != NULL) g_free (ret->priv->uri); }
static void property_update(struct connman_service *service, int index) { struct property_change *property; if (service->property_changed_cb == NULL) return; property = g_try_malloc0(sizeof(struct property_change)); if (property == NULL) return; property->index = index; property->name = PROPERTY(index); property->path = service->path; if (service->to_update[index] != 0) g_source_remove(service->to_update[index]); service->to_update[index] = g_timeout_add_full(G_PRIORITY_DEFAULT, 0, property_changed_or_error, property, destroy_property); }
void s_XSL_FO_Listener::_openSpan(PT_AttrPropIndex api) { if (!m_iBlockDepth && !m_iListBlockDepth) return; _closeSpan(); if(_tagTop() == TT_LISTBLOCK) { _openListItem(); } const PP_AttrProp* pAP = 0; bool bHaveProp = m_pDocument->getAttrProp(api, &pAP); UT_UTF8String buf = "inline"; // query and output properties if (bHaveProp && pAP) { const gchar * szValue = NULL; if (pAP->getProperty("bgcolor", szValue) && szValue) { buf += " background-color=\""; if ((*szValue >= '0') && (*szValue <= '9')) buf += "#"; buf += static_cast<const char *>(szValue); buf += "\""; } if (pAP->getProperty("color", szValue) && szValue) { buf += " color=\""; if ((*szValue >= '0') && (*szValue <= '9')) buf += "#"; buf += static_cast<const char *>(szValue); buf += "\""; } if (pAP->getProperty("lang", szValue) && szValue) { buf += " language=\""; buf += static_cast<const char *>(szValue); buf += "\""; } if (pAP->getProperty("font-size", szValue) && szValue) { buf += " font-size=\""; buf += purgeSpaces(static_cast<const char *>(szValue)).utf8_str(); buf += "\""; } PROPERTY("font-family"); PROPERTY("font-weight"); PROPERTY("font-style"); PROPERTY("font-stretch"); PROPERTY("keep-together"); PROPERTY("keep-with-next"); PROPERTY("text-decoration"); PROPERTY("text-transform"); } _tagOpen(TT_INLINE, buf, false); m_bInSpan = true; }
void s_XSL_FO_Listener::_openBlock(PT_AttrPropIndex api) { if (!m_bInSection) return; _closeLink(); UT_UTF8String buf; const PP_AttrProp* pAP = 0; bool bHaveProp = m_pDocument->getAttrProp(api, &pAP), bList = false; const gchar* szValue = NULL; if(bHaveProp && pAP && pAP->getAttribute("level", szValue) && szValue) { _popListToDepth(atoi(szValue)); } if(bHaveProp && pAP && pAP->getAttribute("listid", szValue) && szValue) { m_iListID = static_cast<UT_uint32>(atoi(static_cast<const char*>(szValue))); if(_tagTop() == TT_LISTBLOCK) _openListItem(); buf = "list-block"; m_iListBlockDepth++; bList = true; } else { if(_tagTop() == TT_LISTBLOCK) _openListItem(); buf = "block"; m_iBlockDepth++; } // query and output properties // todo - validate these and make sure they all make sense if (bHaveProp && pAP) { if (pAP->getProperty("bgcolor", szValue) && szValue) { buf += " background-color=\""; if (*szValue >= '0' && *szValue <= '9') buf += '#'; buf += szValue; buf += "\""; } if (pAP->getProperty("color", szValue) && szValue) { buf += " color=\""; if (*szValue >= '0' && *szValue <= '9') buf += '#'; buf += szValue; buf += "\""; } if (pAP->getProperty("lang", szValue) && szValue) { buf += " language=\""; buf += szValue; buf += "\""; } if (pAP->getProperty("font-size", szValue) && szValue) { buf += " font-size=\""; buf += purgeSpaces(static_cast<const char *>(szValue)).utf8_str(); buf += "\""; } PROPERTY("font-family"); PROPERTY("font-weight"); PROPERTY("font-style"); PROPERTY("font-stretch"); PROPERTY("keep-together"); PROPERTY("keep-with-next"); PROPERTY("line-height"); PROPERTY("margin-bottom"); PROPERTY("margin-top"); PROPERTY("margin-left"); PROPERTY("margin-right"); PROPERTY("text-align"); PROPERTY("widows"); } _tagOpen(bList ? TT_LISTBLOCK : TT_BLOCK, buf, false); }
TextProperty* GetSMSProperties(GroupPropertiesHandle _Group) { static TextProperty mRoot; { for (uint32 i = 0; i < sizeof(pDeptGroup) / sizeof(pDeptGroup[0]); ++i) pDeptGroup[i] = NULL; pDeptGroup[0] = &mRoot; uiDeptGroup = 0; } if (_Group == &GroupHandleSMS[kGroupSMS_VDP]) { BEGIN_PROPERTY_GROUP(("Register $00 - Mode Control No. 1"), ("0x%02x", reg[0x00])); PROPERTY(("Bit 0 : Synch enable"), ("%s", (reg[0x00] >> 0) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 1 : Extra height enable/TMS9918 mode select"), ("%s", (reg[0x00] >> 1) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 2 : Mode 4 enable"), ("%s", (reg[0x00] >> 2) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 3 : Shift sprites left 8 pixels"), ("%s", (reg[0x00] >> 3) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 4 : Enable line interrupts"), ("%s", (reg[0x00] >> 4) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 5 : Hide leftmost 8 pixels"), ("%s", (reg[0x00] >> 5) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 6 : Horizontal scroll lock"), ("%s", (reg[0x00] >> 6) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 7 : Vertical scroll lock"), ("%s", (reg[0x00] >> 7) & 0x1 ? "Enable" : "Disable")); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $01 - Mode Control No. 2"), ("0x%02x", reg[0x01])); PROPERTY(("Bit 0 : Doubled (stretched) sprites"), ("%s", (reg[0x01] >> 0) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 1 : Large (tiled) sprites"), ("%s", (reg[0x01] >> 1) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 3 : 240-line mode/TMS9918 mode select"), ("%s", (reg[0x01] >> 3) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 4 : 224-line mode/TMS9918 mode select"), ("%s", (reg[0x01] >> 4) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 5 : Enable frame interrupts"), ("%s", (reg[0x01] >> 5) & 0x1 ? "Enable" : "Disable")); PROPERTY(("Bit 6 : Enable display"), ("%s", (reg[0x01] >> 6) & 0x1 ? "Enable" : "Disable")); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $02 - Name Table Base Address"), ("0x%02x", reg[0x02])); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $03 - Color Table Base Address"), ("0x%02x", reg[0x03])); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $04 - Pattern Generator Table Base Address"), ("0x%02x", reg[0x04])); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $05 - Sprite Attribute Table Base Address"), ("0x%02x", reg[0x05])); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $06 - Sprite Pattern Generator Table Base Address"), ("0x%02x", reg[0x06])); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $07 - Overscan/Backdrop Color"), ("0x%02x", reg[0x07])); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $08 - Background X Scroll"), ("0x%02x", reg[0x08])); PROPERTY(("Bit 0-7 : Horizontal scroll value"), ("%d", reg[0x08])); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $09 - Background Y Scroll"), ("0x%02x", reg[0x09])); PROPERTY(("Bit 0-7 : Vertical scroll value"), ("%d", reg[0x09])); END_PROPERTY_GROUP(); BEGIN_PROPERTY_GROUP(("Register $0A - Line counter"), ("0x%02x", reg[0x0a])); END_PROPERTY_GROUP(); }
/* dumps the current system state to stdout */ static void dumpstate(int full) { if (full) { PRINT("========================================================"); PRINT("== dumpstate"); PRINT("========================================================"); PRINT("------ MEMORY INFO ------"); DUMP("/proc/meminfo"); PRINT("------ CPU INFO ------"); EXEC7("top", "-n", "1", "-d", "1", "-m", "30", "-t"); PRINT("------ PROCRANK ------"); EXEC_XBIN("procrank"); PRINT("------ VIRTUAL MEMORY STATS ------"); DUMP("/proc/vmstat"); PRINT("------ SLAB INFO ------"); DUMP("/proc/slabinfo"); PRINT("------ ZONEINFO ------"); DUMP("/proc/zoneinfo"); PRINT("------ SYSTEM LOG ------"); EXEC4("logcat", "-v", "time", "-d", "*:v"); PRINT("------ VM TRACES ------"); DUMP("/data/anr/traces.txt"); PRINT("------ EVENT LOG TAGS ------"); DUMP("/etc/event-log-tags"); PRINT("------ EVENT LOG ------"); EXEC6("logcat", "-b", "events", "-v", "time", "-d", "*:v"); PRINT("------ RADIO LOG ------"); EXEC6("logcat", "-b", "radio", "-v", "time", "-d", "*:v"); PRINT("------ NETWORK STATE ------"); PRINT("Interfaces:"); EXEC("netcfg"); PRINT(""); PRINT("Routes:"); DUMP("/proc/net/route"); PRINT("------ SYSTEM PROPERTIES ------"); print_properties(); PRINT("------ KERNEL LOG ------"); EXEC("dmesg"); PRINT("------ KERNEL WAKELOCKS ------"); DUMP("/proc/wakelocks"); PRINT(""); PRINT("------ PROCESSES ------"); EXEC("ps"); PRINT("------ PROCESSES AND THREADS ------"); EXEC2("ps", "-t", "-p"); PRINT("------ LIBRANK ------"); EXEC_XBIN("librank"); PRINT("------ BINDER FAILED TRANSACTION LOG ------"); DUMP("/proc/binder/failed_transaction_log"); PRINT(""); PRINT("------ BINDER TRANSACTION LOG ------"); DUMP("/proc/binder/transaction_log"); PRINT(""); PRINT("------ BINDER TRANSACTIONS ------"); DUMP("/proc/binder/transactions"); PRINT(""); PRINT("------ BINDER STATS ------"); DUMP("/proc/binder/stats"); PRINT(""); PRINT("------ BINDER PROCESS STATE: $i ------"); DUMP_FILES("/proc/binder/proc"); PRINT("------ FILESYSTEMS ------"); EXEC("df"); PRINT("------ PACKAGE SETTINGS ------"); DUMP("/data/system/packages.xml"); PRINT("------ PACKAGE UID ERRORS ------"); DUMP("/data/system/uiderrors.txt"); PRINT("------ LAST KERNEL LOG ------"); DUMP("/proc/last_kmsg"); } PRINT("========================================================"); PRINT("== build.prop"); PRINT("========================================================"); /* the crash server parses key-value pairs between the VERSION INFO and * END lines so we can aggregate crash reports based on this data. */ PRINT("------ VERSION INFO ------"); print_date("currenttime=", &now); DUMP_PROMPT("kernel.version=", "/proc/version"); DUMP_PROMPT("kernel.cmdline=", "/proc/cmdline"); DUMP("/system/build.prop"); PROPERTY("gsm.version.ril-impl"); PROPERTY("gsm.version.baseband"); PROPERTY("gsm.imei"); PROPERTY("gsm.sim.operator.numeric"); PROPERTY("gsm.operator.alpha"); PRINT("------ END ------"); if (full) { PRINT("========================================================"); PRINT("== dumpsys"); PRINT("========================================================"); /* the full dumpsys is starting to take a long time, so we need to increase its timeout. we really need to do the timeouts in dumpsys itself... */ EXEC_TIMEOUT("dumpsys", 60); } }
static bool update_service_property(DBusMessageIter *arg, void *user_data) { struct connman_service *service = user_data; const char *name, *value; gboolean boolean_value; char **array; int length; if (cui_dbus_get_basic(arg, DBUS_TYPE_STRING, &name) != 0) return FALSE; dbus_message_iter_next(arg); if (g_strcmp0(name, "Name") == 0) { cui_dbus_get_basic_variant(arg, DBUS_TYPE_STRING, &value); service->name = g_strdup(value); } else if (g_strcmp0(name, "Type") == 0) { cui_dbus_get_basic_variant(arg, DBUS_TYPE_STRING, &value); service->type = g_strdup(value); } else if (g_strcmp0(name, "Security") == 0) { cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array); g_free(service->security); if (array != NULL) { service->security = g_strjoinv(";", array); g_free(array); } else service->security = NULL; } else if (g_strcmp0(name, "Immutable") == 0) { cui_dbus_get_basic_variant(arg, DBUS_TYPE_BOOLEAN, &boolean_value); service->immutable = boolean_value; } else if (g_strcmp0(name, PROPERTY(SERVICE_STATE)) == 0) { cui_dbus_get_basic_variant(arg, DBUS_TYPE_STRING, &value); service->state = string2enum_state(value); service->update_index = SERVICE_STATE; } else if (g_strcmp0(name, PROPERTY(SERVICE_ERROR)) == 0) { cui_dbus_get_basic_variant(arg, DBUS_TYPE_STRING, &value); g_free(service->error); service->error = g_strdup(value); service->update_index = SERVICE_ERROR; } else if (g_strcmp0(name, PROPERTY(SERVICE_STRENGTH)) == 0) { uint8_t uint8_value; cui_dbus_get_basic_variant(arg, DBUS_TYPE_BYTE, &uint8_value); service->strength = uint8_value; service->update_index = SERVICE_STRENGTH; } else if (g_strcmp0(name, PROPERTY(SERVICE_FAVORITE)) == 0) { cui_dbus_get_basic_variant(arg, DBUS_TYPE_BOOLEAN, &boolean_value); service->favorite = boolean_value; service->update_index = SERVICE_FAVORITE; } else if (g_strcmp0(name, PROPERTY(SERVICE_AUTOCONNECT)) == 0) { cui_dbus_get_basic_variant(arg, DBUS_TYPE_BOOLEAN, &boolean_value); service->autoconnect = boolean_value; service->update_index = SERVICE_AUTOCONNECT; } else if (g_strcmp0(name, PROPERTY(SERVICE_ROAMING)) == 0) { cui_dbus_get_basic_variant(arg, DBUS_TYPE_BOOLEAN, &boolean_value); service->roaming = boolean_value; service->update_index = SERVICE_ROAMING; } else if (g_strcmp0(name, PROPERTY(SERVICE_NAMESERVERS)) == 0) { cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array); g_free(service->nameservers); if (array != NULL) { service->nameservers = g_strjoinv(";", array); g_free(array); } else service->nameservers = NULL; service->update_index = SERVICE_NAMESERVERS; } else if (g_strcmp0(name, PROPERTY(SERVICE_NAMESERVERS_CONFIGURATION)) == 0) { cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array); g_free(service->nameservers_conf); if (array != NULL) { service->nameservers_conf = g_strjoinv(";", array); g_free(array); } else service->nameservers_conf = NULL; service->update_index = SERVICE_NAMESERVERS_CONFIGURATION; } else if (g_strcmp0(name, PROPERTY(SERVICE_DOMAINS)) == 0) { cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array); g_free(service->domains); if (array != NULL) { service->domains = g_strjoinv(";", array); g_free(array); } else service->domains = NULL; service->update_index = SERVICE_DOMAINS; } else if (g_strcmp0(name, PROPERTY(SERVICE_DOMAINS_CONFIGURATION)) == 0) { cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array); g_free(service->domains_conf); if (array != NULL) { service->domains_conf = g_strjoinv(";", array); g_free(array); } else service->domains_conf = NULL; service->update_index = SERVICE_DOMAINS_CONFIGURATION; } else if (g_strcmp0(name, PROPERTY(SERVICE_TIMESERVERS)) == 0) { cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array); g_free(service->timeservers); if (array != NULL) { service->timeservers = g_strjoinv(";", array); g_free(array); } else service->timeservers = NULL; service->update_index = SERVICE_TIMESERVERS; } else if (g_strcmp0(name, PROPERTY(SERVICE_TIMESERVERS_CONFIGURATION)) == 0) { cui_dbus_get_array(arg, DBUS_TYPE_STRING, &length, &array); g_free(service->timeservers_conf); if (array != NULL) { service->timeservers_conf = g_strjoinv(";", array); g_free(array); } else service->timeservers_conf = NULL; service->update_index = SERVICE_TIMESERVERS_CONFIGURATION; } else if (g_strcmp0(name, PROPERTY(SERVICE_IPv4)) == 0) { service->ipv4 = parse_ipv4(arg, service->ipv4); service->update_index = SERVICE_IPv4; } else if (g_strcmp0(name, PROPERTY(SERVICE_IPv4_CONFIGURATION)) == 0) { service->ipv4_conf = parse_ipv4(arg, service->ipv4_conf); service->update_index = SERVICE_IPv4_CONFIGURATION; } else if (g_strcmp0(name, PROPERTY(SERVICE_IPv6)) == 0) { service->ipv6 = parse_ipv6(arg, service->ipv6); service->update_index = SERVICE_IPv6; } else if (g_strcmp0(name, PROPERTY(SERVICE_IPv6_CONFIGURATION)) == 0) { service->ipv6_conf = parse_ipv6(arg, service->ipv6_conf); service->update_index = SERVICE_IPv6_CONFIGURATION; } else if (g_strcmp0(name, PROPERTY(SERVICE_PROXY)) == 0) { service->proxy = parse_proxy(arg, service->proxy); service->update_index = SERVICE_PROXY; } else if (g_strcmp0(name, PROPERTY(SERVICE_PROXY_CONFIGURATION)) == 0) { service->proxy_conf = parse_proxy(arg, service->proxy_conf); service->update_index = SERVICE_PROXY_CONFIGURATION; } else if (g_strcmp0(name, PROPERTY(SERVICE_PROVIDER)) == 0) { service->provider = parse_provider(arg, service->provider); service->update_index = SERVICE_PROVIDER; } else if (g_strcmp0(name, PROPERTY(SERVICE_ETHERNET)) == 0) { service->ethernet = parse_ethernet(arg, service->ethernet); service->update_index = SERVICE_ETHERNET; } return FALSE; }
static int set_service_property(struct connman_service *service, enum connman_service_property property, int dbus_type, void *data) { struct property_setting *set = NULL; const char *property_name; DBusMessage *message; DBusMessageIter arg; if (connman == NULL) return -EINVAL; if (service->call_modify[property] != NULL) return -EINVAL; message = dbus_message_new_method_call(CONNMAN_DBUS_NAME, service->path, CONNMAN_SERVICE_INTERFACE, "SetProperty"); if (message == NULL) return -ENOMEM; set = g_try_malloc0(sizeof(struct property_setting)); if (set == NULL) goto error; set->data = service; set->index = property; property_name = PROPERTY(property); dbus_message_iter_init_append(message, &arg); switch (property) { case SERVICE_IPv4_CONFIGURATION: cui_dbus_append_dict(&arg, property_name, append_ipv4_config, data); break; case SERVICE_IPv6_CONFIGURATION: cui_dbus_append_dict(&arg, property_name, append_ipv6_config, data); break; case SERVICE_PROXY_CONFIGURATION: cui_dbus_append_dict(&arg, property_name, append_proxy_config, data); break; case SERVICE_NAMESERVERS_CONFIGURATION: case SERVICE_DOMAINS_CONFIGURATION: case SERVICE_TIMESERVERS_CONFIGURATION: cui_dbus_append_array(&arg, property_name, DBUS_TYPE_STRING, append_string_list, data); break; default: cui_dbus_append_basic(&arg, property_name, dbus_type, data); break; } if (dbus_connection_send_with_reply(service_if->dbus_cnx, message, &service->call_modify[property], DBUS_TIMEOUT_USE_DEFAULT) == FALSE) goto error; if (dbus_pending_call_set_notify(service->call_modify[property], set_property_cb, set, g_free) == FALSE) goto error; return 0; error: dbus_message_unref(message); if (set == NULL) return -ENOMEM; g_free(set); return -EINVAL; }