From a31fcc3fcdb8e38a562abf7a42c974225d60ba01 Mon Sep 17 00:00:00 2001
From: Duncan Cragg
Date: Mon, 11 Jan 2010 21:14:50 +0000
Subject: [PATCH] object web, etc
---
doc/intro.txt | 5 +++
src/drivers/ot/test/teston.c | 98 +++++++++++++++++++++++++++++-------------
src/include/notification.h | 1 +
src/on/notification.c | 4 ++
www/index.html | 17 +++++---
5 files changed, 87 insertions(+), 38 deletions(-)
create mode 100644 doc/intro.txt
diff --git a/doc/intro.txt b/doc/intro.txt
new file mode 100644
index 0000000..cf267ca
--- /dev/null
+++ b/doc/intro.txt
@@ -0,0 +1,5 @@
+Cilux
+
+Cilux is a U-Web Exchange or peer. It is the reference implementation of the U-Web's Object Standards.
+
+
diff --git a/src/drivers/ot/test/teston.c b/src/drivers/ot/test/teston.c
index 387becd..deb9ff5 100644
--- a/src/drivers/ot/test/teston.c
+++ b/src/drivers/ot/test/teston.c
@@ -83,37 +83,37 @@ void cast_event(n_object* o, n_object* c)
*/
void start_tests(void)
{
- k_log_out("Creating o11111 ------------------");
+ k_log_out("Creating o1 ------------------");
char* o11111s = "UID: 11111-4141a\n"
"\n"
"Cost: £111\n";
n_object* o11111 = n_object_new(o11111s);
test_state(o11111, o11111s, "11111-4141a", "£111");
- k_log_out("Committing o11111");
+ k_log_out("Committing o1");
n_commit(o11111);
- k_log_out("Creating o22222 ------------------");
+ k_log_out("Creating o2 ------------------");
char* o22222s = "UID: 22222-ef990\n"
- "Permit: - UID: 11111-4141a\n"
- " quiet\n"
+ "Open: - UID: 11111-4141a\n"
+ " quiet\n"
"\n"
"Cost: £222\n";
n_object* o22222 = n_object_new(o22222s);
test_state(o22222, o22222s, "22222-ef990", "£222");
- k_log_out("o11111 views o22222 ------------------");
+ k_log_out("o1 views o2 ------------------");
n_object* o2 = n_view(o11111, "22222-ef990"); /* creates Cast:/shell o2 and sends View event to o2 */
k_assert(!o2, "Object 2 has not been committed yet, but Object 1 can view it:\n%s\n", n_to_string(o2));
n_commit(o11111); /* ?? commit View (i.e. header change set) */
n_commit(o22222); /* merges with shell and sends Cast event to o1 */
- k_log_out("o11111 views o22222 ------------------");
+ k_log_out("o1 views o2 ------------------");
o2 = n_view(o11111, "22222-ef990"); /* quiet, so no View event to o2, satisfiable now so no Cast event to o1 */
k_assert(o2!=0, "Object 2 has been committed, but can't be viewed by Object 1");
test_state(o2, o22222s, "22222-ef990", "£222");
- k_log_out("o22222 views o33333 ------------------");
+ k_log_out("o2 views o3 ------------------");
n_object* o3 = n_view(o22222, "33333-18bbc"); /* creats Cast:/shell o3 and sends View event to o3 */
k_assert(!o3, "Object 3 has not been created yet, but Object 2 can view it:\n%s", n_to_string(o3));
n_commit(o22222); /* ?? commit View (i.e. header change set) */
@@ -127,60 +127,96 @@ void view_event_1(n_object* o, n_object* v)
void cast_event_1(n_object* o, n_object* c)
{
- k_log_out("o11111 is cast o22222 ------------------");
+ k_log_out("o1 is cast o2 ------------------");
test_state(c, 0, "22222-ef990", "£222");
- k_assert(!strcmp(n_header(o, "View:1:UID"), "22222-ef990"), "o1 <-Cast- o2: o1 first View UID not o2" );
- k_assert(!strcmp(n_header(c, "Cast:1:UID"), "11111-4141a"), "o1 <-Cast- o2: o2 first Cast UID not o1" );
- k_assert(!strcmp(n_header(c, "Permit:1:UID"), "11111-4141a"), "o1 <-Cast- o2: o2 first Permit UID not o1" );
+ k_assert(!strcmp(n_header(o, "View:1:UID"), "22222-ef990"), "o1 <-Cast- o2: o1 first View UID not o2" );
+ k_assert(!strcmp(n_header(c, "Cast:1:UID"), "11111-4141a"), "o1 <-Cast- o2: o2 first Cast UID not o1" );
+ k_assert(!strcmp(n_header(c, "Open:1:UID"), "11111-4141a"), "o1 <-Cast- o2: o2 first Open UID not o1" );
}
/* -------------------------------------------------------------------------- */
void view_event_2(n_object* o, n_object* v)
{
- k_log_out("o22222 gets view from o11111 ------------------");
- test_state(v, 0, "11111-4141a", "£111");
- k_assert(!strcmp(n_header(v, "View:1:UID"), "22222-ef990"), "o1 -View-> o2: o1 first View UID not o2" );
- k_assert(!strcmp(n_header(o, "Cast:1:UID"), "11111-4141a"), "o1 -View-> o2: o2 first Cast UID not o1" );
- k_assert(!strcmp(n_header(o, "Permit:1:UID"), "11111-4141a"), "o1 -View-> o2: o2 first Permit UID not o1" );
+ if(n_uid_is(v, "11111-4141a")){
+ k_log_out("o2 gets view from o1 ------------------");
+ test_state(v, 0, "11111-4141a", "£111");
+ k_assert(!strcmp(n_header(v, "View:1:UID"), "22222-ef990"), "o1 -View-> o2: o1 first View UID not o2" );
+ k_assert(!strcmp(n_header(o, "Cast:1:UID"), "11111-4141a"), "o1 -View-> o2: o2 first Cast UID not o1" );
+ k_assert(!strcmp(n_header(o, "Open:1:UID"), "11111-4141a"), "o1 -View-> o2: o2 first Open UID not o1" );
+ }
+ else
+ if(n_uid_is(v, "11111-4141a")){
+ k_log_out("o2 gets view from o3 ------------------");
+ test_state(v, 0, "33333-18bbc", "£333");
+ k_assert(!strcmp(n_header(v, "View:1:UID"), "22222-ef990"), "o3 -View-> o2: o3 first View UID not o2" );
+ k_assert(!strcmp(n_header(o, "Cast:2:UID"), "33333-18bbc"), "o3 -View-> o2: o2 second Cast UID not o3" );
+ k_assert( !n_header(o, "Open:2:UID"), "o3 -View-> o2: o2 has an Open" );
+
+ k_log_out("o2 opens to o3 ------------------");
+ n_open(o, "33333-18bbc", "quiet");
+ k_log_out("Committing o2");
+ n_commit(o);
+ k_assert(!strcmp(n_header(o, "Open:2:UID"), "33333-18bbc"), "o2 second Open UID not o3" );
+ k_assert(!strcmp(n_header(o, "Open:2:quiet"), ""), "o2 second Open not quiet" );
+ }
+ else{
+ k_assert(0, "o2 got view but not from o1 or o3");
+ }
}
void cast_event_2(n_object* o, n_object* c)
{
- k_log_out("o22222 is cast o33333 ------------------");
+ k_log_out("o2 is cast o3 ------------------");
test_state(c, 0, "33333-18bbc", "£333");
- k_assert(!strcmp(n_header(o, "View:1:UID"), "33333-18bbc"), "o2 <-Cast- o3: o2 first View UID not o3" );
- k_assert(!strcmp(n_header(c, "Cast:1:UID"), "22222-ef990"), "o2 <-Cast- o3: o3 first Cast UID not o2" );
- k_assert(!strcmp(n_header(c, "Permit:1:UID"), "22222-ef990"), "o2 <-Cast- o3: o3 first Permit UID not o2" );
+ k_assert(!strcmp(n_header(o, "View:1:UID"), "33333-18bbc"), "o2 <-Cast- o3: o2 first View UID not o3" );
+ k_assert(!strcmp(n_header(c, "Cast:1:UID"), "22222-ef990"), "o2 <-Cast- o3: o3 first Cast UID not o2" );
+ k_assert(!strcmp(n_header(c, "Open:1:UID"), "22222-ef990"), "o2 <-Cast- o3: o3 first Open UID not o2" );
}
/* -------------------------------------------------------------------------- */
void view_event_3(n_object* o, n_object* v)
{
- k_log_out("o33333 gets view from o22222 ------------------");
+ k_log_out("o3 gets view from o2 ------------------");
test_state(v, 0, "22222-ef990", "£222");
- k_assert(!strcmp(n_header(v, "View:1:UID"), "33333-18bbc"), "o2 -View-> o3: o2 first View UID not o3" );
- k_assert(!strcmp(n_header(o, "Cast:1:UID"), "22222-ef990"), "o2 -View-> o3: o3 first Cast UID not o2" );
- k_assert( !n_header(o, "Permit:1:UID"), "o2 -View-> o3: o3 has a Permit" );
+ k_assert(!strcmp(n_header(v, "View:1:UID"), "33333-18bbc"), "o2 -View-> o3: o2 first View UID not o3" );
+ k_assert(!strcmp(n_header(o, "Cast:1:UID"), "22222-ef990"), "o2 -View-> o3: o3 first Cast UID not o2" );
+ k_assert( !n_header(o, "Open:1:UID"), "o2 -View-> o3: o3 has an Open" );
- k_log_out("Creating o33333 ------------------");
+ k_log_out("Creating o3 ------------------");
char* o33333s = "UID: 33333-18bbc\n"
- "Permit: - UID: 22222-ef990\n"
- " quiet\n"
+ "Open: - UID: 22222-ef990\n"
+ " quiet\n"
"\n"
"Cost: £333\n";
n_object* o33333 = n_object_new(o33333s);
test_state(o33333, o33333s, "33333-18bbc", "£333");
- k_assert(!strcmp(n_header(o33333, "Permit:1:UID"), "22222-ef990"), "o3 first Permit not o2" );
- k_assert(!strcmp(n_header(o33333, "Permit:1:quiet"), ""), "o3 first Permit not quiet" );
+ k_assert(!strcmp(n_header(o33333, "Open:1:UID"), "22222-ef990"), "o3 first Open not o2" );
+ k_assert(!strcmp(n_header(o33333, "Open:1:quiet"), ""), "o3 first Open not quiet" );
- k_log_out("Committing o33333");
+ k_log_out("Committing o3");
n_commit(o33333);
+
+ k_assert(!strcmp(n_header(o, "Cast:1:UID"), "22222-ef990"), "o3 first Cast UID not o2" );
+ k_assert(!strcmp(n_header(o, "Open:1:UID"), "22222-ef990"), "o3 first Open not o2" );
+ k_assert(!strcmp(n_header(o, "Open:1:quiet"), ""), "o3 first Open not quiet" );
+
+ k_log_out("o3 views o2 ------------------");
+ n_object* o2 = n_view(o, "22222-ef990");
+ k_assert(!o2, "o2 is not Open to o3, but o3 can view it:\n%s\n", n_to_string(o2));
+
+ k_log_out("Committing o3");
+ n_commit(o);
}
void cast_event_3(n_object* o, n_object* c)
{
+ k_log_out("o3 is cast o2 ------------------");
+ test_state(c, 0, "22222-ef990", "£222");
+ k_assert(!strcmp(n_header(o, "View:1:UID"), "22222-ef990"), "o3 <-Cast- o2: o3 first View UID not o2" );
+ k_assert(!strcmp(n_header(c, "Cast:2:UID"), "33333-18bbc"), "o3 <-Cast- o2: o2 second Cast UID not o3" );
+ k_assert(!strcmp(n_header(c, "Open:2:UID"), "33333-18bbc"), "o3 <-Cast- o2: o2 second Open UID not o3" );
}
/* -------------------------------------------------------------------------- */
diff --git a/src/include/notification.h b/src/include/notification.h
index 14a3030..750ad6a 100644
--- a/src/include/notification.h
+++ b/src/include/notification.h
@@ -28,6 +28,7 @@ PUBLIC void n_register_driver(char* name,
PUBLIC n_object* n_object_new(char* s);
PUBLIC void n_commit(n_object* o);
PUBLIC n_object* n_view(n_object* o, char* uid);
+PUBLIC void n_open(n_object* o, char* uid, char* options);
PUBLIC char* n_to_string(n_object* o);
PUBLIC char* n_uid(n_object* o);
PUBLIC int n_uid_is(n_object* o, char* uid);
diff --git a/src/on/notification.c b/src/on/notification.c
index 3833a08..61d25f3 100644
--- a/src/on/notification.c
+++ b/src/on/notification.c
@@ -30,6 +30,10 @@ EXPORT n_object* n_view(n_object* o, char* uid)
return 0;
}
+EXPORT void n_open(n_object* o, char* uid, char* options)
+{
+}
+
EXPORT char* n_to_string(n_object* o)
{
return 0;
diff --git a/www/index.html b/www/index.html
index ef7af28..4ef6798 100644
--- a/www/index.html
+++ b/www/index.html
@@ -3,25 +3,28 @@
-
-
+
+
- The Cilux U-Web Exchange
+ The Cilux Object Web Exchange
-
The Cilux U-Web Exchange
+
The Cilux Object Web Exchange
-Cilux is a U-Web "Exchange": a peer for, and the
-reference implementation of, the U-Web.
+Cilux is a Object Web "Exchange": a peer for, and the
+reference implementation of, the Object Web.
Cilux is Open Source and written in C. It is intended to be run both client-side and
-server-side on Linux-based PCs and Ultra-Mobile PCs, as well as MIDs such as Maemo.
+server-side on Linux-based PCs and Ultra-Mobile PCs, including the OpenPandora console,
+as well as Mobile Internet Devices (MIDs) such as Nokia's upcoming Maemo 5 device. The
+typical MID specification and APIs aimed for are: at least 320x320 touch screen with
+OpenGL ES 2.0; GPS, Wifi and 3G; front- and back-facing cameras.