Mercurial > hg > Members > kono > Cerium
changeset 863:c26aa4e52258
get serial id
author | kazz <kazz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 22 Jun 2010 10:44:58 +0900 |
parents | e39f320c4411 |
children | 8323230d766b |
files | Renderer/Test/aquarium.cc Renderer/Test/aquarium.h |
diffstat | 2 files changed, 15 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/Renderer/Test/aquarium.cc Thu Jun 17 04:46:25 2010 +0900 +++ b/Renderer/Test/aquarium.cc Tue Jun 22 10:44:58 2010 +0900 @@ -4,8 +4,12 @@ #include "lindaapi.h" #include "aquarium.h" +#define GET_SERIAL_ID 65535 + linda_t aquarium::linda_addr = { "localhost", 10000 }; int aquarium::linda; +int aquarium::serial_id; + const char *usr_help_str = "Usage: ./aquarium -linda LINDA_SERVER_NAME\n"; void TMend(TaskManager *manager); @@ -19,6 +23,7 @@ void init_network() { aquarium::linda_connect(); + } MainLoopPtr @@ -32,6 +37,15 @@ aquarium::linda_connect() { init_linda(); // セレクタの初期化 linda = open_linda_java(linda_addr.hostname, linda_addr.port); + // serial_id の取得 + int seq = psx_in(linda, GET_SERIAL_ID); + unsigned char *data = NULL; + do { + psx_sync_n(); + data = psx_reply(seq); + } while (data == NULL); + serial_id = atoi((char *)data + LINDA_HEADER_SIZE); + printf("Get serial_id: %d\n", serial_id); } int
--- a/Renderer/Test/aquarium.h Thu Jun 17 04:46:25 2010 +0900 +++ b/Renderer/Test/aquarium.h Tue Jun 22 10:44:58 2010 +0900 @@ -12,6 +12,7 @@ public: static linda_t linda_addr; static int linda; + static int serial_id; static void linda_connect(); MainLoopPtr init(Viewer *viewer, int screen_w, int screen_h); };