/* send current list of tokens to parser and reset tokenizer */
parser->brace_count = 0;
parser->bracket_count = 0;
- parser->emit(parser, parser->tokens);
+ parser->emit(parser, parser->tokens, parser->opaque);
if (parser->tokens) {
QDECREF(parser->tokens);
}
}
void json_message_parser_init(JSONMessageParser *parser,
- void (*func)(JSONMessageParser *, QList *))
+ void (*func)(JSONMessageParser *, QList *, void *), void *opaque)
{
parser->emit = func;
parser->brace_count = 0;
parser->bracket_count = 0;
parser->tokens = qlist_new();
parser->token_size = 0;
+ parser->opaque = opaque;
json_lexer_init(&parser->lexer, json_message_process_token);
}
typedef struct JSONMessageParser
{
- void (*emit)(struct JSONMessageParser *parser, QList *tokens);
+ void (*emit)(struct JSONMessageParser *parser, QList *tokens, void *);
JSONLexer lexer;
int brace_count;
int bracket_count;
QList *tokens;
uint64_t token_size;
+ void *opaque;
} JSONMessageParser;
void json_message_parser_init(JSONMessageParser *parser,
- void (*func)(JSONMessageParser *, QList *));
+ void (*func)(JSONMessageParser *, QList *, void *), void *opaque);
int json_message_parser_feed(JSONMessageParser *parser,
const char *buffer, size_t size);
qobject_decref(data);
}
-static void handle_qmp_command(JSONMessageParser *parser, QList *tokens)
+static void handle_qmp_command(JSONMessageParser *parser, QList *tokens, void *opaque)
{
int err;
QObject *obj;
break;
case CHR_EVENT_CLOSED:
json_message_parser_destroy(&mon->mc->parser);
- json_message_parser_init(&mon->mc->parser, handle_qmp_command);
+ json_message_parser_init(&mon->mc->parser, handle_qmp_command, NULL);
mon_refcount--;
monitor_fdsets_cleanup();
break;
monitor_control_event, mon);
qemu_chr_fe_set_echo(chr, true);
- json_message_parser_init(&mon->mc->parser, handle_qmp_command);
+ json_message_parser_init(&mon->mc->parser, handle_qmp_command, NULL);
} else {
qemu_chr_add_handlers(chr, monitor_can_read, monitor_read,
monitor_event, mon);
# Since: 1.2.0
##
{ 'type': 'FdsetInfo',
- 'data': {'fdset-id': 'int', 'fds': ['FdsetFdInfo']} }
+ 'data': {'fdset-id': yy'int', 'fds': ['FdsetFdInfo']} }
##
# @query-fdsets:
# Since: 1.2.0
##
{ 'command': 'query-target', 'returns': 'TargetInfo' }
+
+
+
+## Eric 2013.3.7 ##
+
+##
+# @AccelInfo:
+#
+# Information describing the acceleration sensor value
+#
+# @Xaxis: x axis value of the acceleration sensor
+# @Yaxis: y axis value of the acceleration sensor
+# @Zaxis: z axis value of the acceleration sensor
+#
+# Since: 1.2.0
+##
+{ 'type': 'AccelInfo',
+ 'data': { 'Xaxis': 'int', 'Yaxis': 'int', 'Zaxis' : 'int'} }
+
+##
+# @query-accel:
+#
+# Return information about the acceleration sensor value
+#
+# Returns: AccelInfo
+#
+# Since: 1.2.0
+##
+{ 'command': 'query-accel', 'returns': 'AccelInfo' }
},
};
+static QemuOptsList qemu_carrier_opts = {
+ .name = "carrier",
+ .head = QTAILQ_HEAD_INITIALIZER(qemu_carrier_opts.head),
+ .desc = {
+ {
+ .name = "host",
+ .type = QEMU_OPT_STRING,
+ },{
+ .name = "port",
+ .type = QEMU_OPT_STRING,
+ },{
+ .name = "ipv4",
+ .type = QEMU_OPT_BOOL,
+ },{
+ .name = "ipv6",
+ .type = QEMU_OPT_BOOL,
+ },
+ { /* end of list */ }
+ },
+};
+
static QemuOptsList *vm_config_groups[32] = {
&qemu_drive_opts,
&qemu_chardev_opts,
&qemu_boot_opts,
&qemu_iscsi_opts,
&qemu_sandbox_opts,
+ &qemu_carrier_opts,
NULL,
};
}
/* handle requests/control events coming in over the channel */
-static void process_event(JSONMessageParser *parser, QList *tokens)
+static void process_event(JSONMessageParser *parser, QList *tokens, void *opaque)
{
GAState *s = container_of(parser, GAState, parser);
QObject *obj;
s->command_state = ga_command_state_new();
ga_command_state_init(s, s->command_state);
ga_command_state_init_all(s->command_state);
- json_message_parser_init(&s->parser, process_event);
+ json_message_parser_init(&s->parser, process_event, NULL);
ga_state = s;
#ifndef _WIN32
if (!register_signal_handlers()) {
char uaddr[INET6_ADDRSTRLEN+1];
char uport[33];
int slisten, rc, to, port_min, port_max, p;
-
memset(&ai,0, sizeof(ai));
ai.ai_flags = AI_PASSIVE | AI_ADDRCONFIG;
ai.ai_family = PF_UNSPEC;
fprintf(stderr, "bind(unix:%s): %s\n", un.sun_path, strerror(errno));
goto err;
}
- if (listen(sock, 1) < 0) {
+ if (listen(sock, 5) < 0) {
fprintf(stderr, "listen(unix:%s): %s\n", un.sun_path, strerror(errno));
goto err;
}
QObject *result;
} JSONParsingState;
-static void parse_json(JSONMessageParser *parser, QList *tokens)
+static void parse_json(JSONMessageParser *parser, QList *tokens, void *opaque)
{
JSONParsingState *s = container_of(parser, JSONParsingState, parser);
s->result = json_parser_parse(tokens, s->ap);
state.ap = ap;
- json_message_parser_init(&state.parser, parse_json);
+ json_message_parser_init(&state.parser, parse_json, NULL);
json_message_parser_feed(&state.parser, string, strlen(string));
json_message_parser_flush(&state.parser);
json_message_parser_destroy(&state.parser);
.args_type = "",
.mhandler.cmd_new = qmp_marshal_input_query_target,
},
+
+SQMP
+Eric 2013.3.7
+EQMP
+
+SQMP
+query-accel
+-------------
+
+Show acceleration sensor information.
+
+Example:
+
+-> { "execute": "query-accel" }
+<- {
+ "return":{
+ "Xaxis":1,
+ "Yaxis":2,
+ "Zaxis":3
+ }
+ }
+
+EQMP
+
+ {
+ .name = "query-accel",
+ .args_type = "",
+ .mhandler.cmd_new = qmp_marshal_input_query_accel,
+ },
+
# debug channel
obj-y += debug_ch.o
+# carrier
+obj-y += carrier.o qmp_handler.o
+
# maru hardware
include $(SRC_PATH)/tizen/src/Makefile.tizen.$(TARGET_BASE_ARCH)
#include "hw/maru_camera_common.h"
#include "hw/gloffscreen_test.h"
#include "debug_ch.h"
+#include "carrier.h"
#include <stdlib.h>
#ifdef CONFIG_SDL
mloop_ev_stop();
shutdown_skin_server();
shutdown_guest_server();
+ stop_carrier();
maru_display_fini();
}
int guest_server_port = tizen_base_port + SDB_UDP_SENSOR_INDEX;
start_guest_server(guest_server_port);
+ start_carrier(guest_server_port+1);
mloop_ev_init();
}