static void set_puct_query_callback(const struct ofono_error *error, const char *currency, double ppu, void *data) { struct ofono_call_meter *cm = data; DBusMessage *reply; if (cm->pending == NULL) return; if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { ofono_error("Setting PUCT successful, but query was not"); cm->flags &= ~CALL_METER_FLAG_CACHED; __ofono_dbus_pending_reply(&cm->pending, __ofono_error_failed(cm->pending)); return; } reply = dbus_message_new_method_return(cm->pending); __ofono_dbus_pending_reply(&cm->pending, reply); set_currency(cm, currency); set_ppu(cm, ppu); }
static void query_puct_callback(const struct ofono_error *error, const char *currency, double ppu, void *data) { struct ofono_call_meter *cm = data; if (error->type == OFONO_ERROR_TYPE_NO_ERROR) { cm->flags |= CALL_METER_FLAG_HAVE_PUCT; set_currency(cm, currency); set_ppu(cm, ppu); } query_acm_max(cm); }
/* * This function is for the really bizarre case of someone trying to call * SetProperty before GetProperties. But we must handle it... */ static void set_puct_initial_query_callback(const struct ofono_error *error, const char *currency, double ppu, void *data) { struct ofono_call_meter *cm = data; DBusMessageIter iter; DBusMessageIter var; const char *name; const char *pin2; if (cm->pending == NULL) return; if (error->type != OFONO_ERROR_TYPE_NO_ERROR) { __ofono_dbus_pending_reply(&cm->pending, __ofono_error_failed(cm->pending)); return; } set_currency(cm, currency); set_ppu(cm, ppu); cm->flags |= CALL_METER_FLAG_HAVE_PUCT; dbus_message_iter_init(cm->pending, &iter); dbus_message_iter_get_basic(&iter, &name); dbus_message_iter_next(&iter); dbus_message_iter_recurse(&iter, &var); dbus_message_iter_next(&iter); dbus_message_iter_get_basic(&iter, &pin2); if (!strcmp(name, "PricePerUnit")) dbus_message_iter_get_basic(&var, &ppu); else dbus_message_iter_get_basic(&var, ¤cy); cm->driver->puct_set(cm, currency, ppu, pin2, set_puct_callback, cm); }
void NesMain(void) { unsigned char bgy = 0; const char palettebg[] = { 0x0f, 0x11, 0x21, 0x30, 0x0f, 0x11, 0x21, 0x30, 0x0f, 0x11, 0x21, 0x30, 0x0f, 0x11, 0x21, 0x30 }; const char palettespr[] = { 0x0f, 0x00, 0x10, 0x21, 0x0f, 0x0f, 0x10, 0x21, 0x0f, 0x09, 0x19, 0x21, 0x0f, 0x15, 0x27, 0x30 }; init_ppu(); set_palette((char *)palettebg, 0); set_palette((char *)palettespr, 1); set_background(0x21, 0xc9, "HELLO, WORLD!", 13); set_scroll(0, 0); set_ppu(0x08, 0x1e); while (1) { vblank(); bgy++; if (bgy == 240) { bgy == 0; } set_scroll(0, bgy); frame++; } }