diff --git a/checkin_notes b/checkin_notes index b1f3bb4ff6..708c9e2bc2 100755 --- a/checkin_notes +++ b/checkin_notes @@ -6925,3 +6925,17 @@ David 27 June 2006 client_state.C client_types.C proxy.C,h (removed) + +David 27 June 2006 + - Add new GUI RPC get_simple_gui_info(): returns list + of projects and active results. + + client/ + client_state.h + cs_statefile.C + gui_rpc_server_ops.C + lib/ + boinc_cmd.C + gui_rpc_client.h + gui_rpc_client_ops.C + gui_rpc_client_print.C diff --git a/client/client_state.h b/client/client_state.h index 35257aab26..16c1c0b66f 100644 --- a/client/client_state.h +++ b/client/client_state.h @@ -406,7 +406,7 @@ public: int parse_app_info(PROJECT*, FILE*); int write_state_gui(MIOFILE&); int write_file_transfers_gui(MIOFILE&); - int write_tasks_gui(MIOFILE&); + int write_tasks_gui(MIOFILE&, bool); // --------------- cs_trickle.C: private: diff --git a/client/cs_statefile.C b/client/cs_statefile.C index 5136c73767..55952f818d 100644 --- a/client/cs_statefile.C +++ b/client/cs_statefile.C @@ -621,16 +621,16 @@ int CLIENT_STATE::write_state_gui(MIOFILE& f) { return 0; } -int CLIENT_STATE::write_tasks_gui(MIOFILE& f) { +int CLIENT_STATE::write_tasks_gui(MIOFILE& f, bool active_only) { unsigned int i; - f.printf("\n"); - for(i=0; iwrite_gui(f); } - f.printf("\n"); - return 0; } diff --git a/client/gui_rpc_server_ops.C b/client/gui_rpc_server_ops.C index 76e94b2b97..7d33bf7a4b 100644 --- a/client/gui_rpc_server_ops.C +++ b/client/gui_rpc_server_ops.C @@ -78,6 +78,17 @@ void GUI_RPC_CONN::handle_auth2(char* buf, MIOFILE& fout) { auth_needed = false; } +static void handle_get_simple_gui_info(MIOFILE& fout) { + unsigned int i; + fout.printf("\n"); + for (i=0; iwrite_state(fout, true); + } + gstate.write_tasks_gui(fout, true); + fout.printf("\n"); +} + static void handle_get_project_status(MIOFILE& fout) { unsigned int i; fout.printf("\n"); @@ -804,7 +815,9 @@ int GUI_RPC_CONN::handle_rpc() { } else if (match_tag(request_msg, "\n"); + gstate.write_tasks_gui(mf, false); + mf.printf("\n"); } else if (match_tag(request_msg, "&)", "Get a list of projects, with only basic fields filled in." diff --git a/doc/stats.php b/doc/stats.php index 8a657cdf9a..00a9eeffcf 100644 --- a/doc/stats.php +++ b/doc/stats.php @@ -2,12 +2,11 @@ require_once("docutil.php"); -page_head("Statistics data"); +page_head("Credit statistics web sites and services"); echo " Statistics data is the number of Cobblestones (credit units) -granted to hosts, participants and teams by the -various BOINC projects. +granted to hosts, participants and teams by the various BOINC projects. This can be used for various purposes, such as:
  • @@ -20,11 +19,16 @@ Examples are listed at here. that show user and/or team credit, possible across projects. Examples are listed at here. -
  • Displays of current credit on cell phones and PDAs.
+
  • Displays of current credit on cell phones and PDAs. + + +Displays that use colors to distinguish BOINC projects should use +these colors. +

    -BOINC provides a flexible architecture for distributing -statistics data, with the goal of enabling new display applications. +BOINC provides a flexible architecture for distributing statistics data, +with the goal of enabling new display applications.


    diff --git a/lib/boinc_cmd.C b/lib/boinc_cmd.C index adfff137a3..3e11b7bbf9 100644 --- a/lib/boinc_cmd.C +++ b/lib/boinc_cmd.C @@ -64,6 +64,7 @@ Commands:\n\ --get_results show results\n\ --get_file_transfers show file transfers\n\ --get_project_status show status of all projects\n\ + --get_simple_gui_info show status of projects and active results\n\ --get_disk_usage\n\ --result url result_name {suspend | resume | abort | graphics_window | graphics_fullscreen}\n\ --project url {reset | detach | update | suspend | resume | nomorework | allowmorework}\n\ @@ -228,6 +229,10 @@ int main(int argc, char** argv) { PROJECTS ps; retval = rpc.get_project_status(ps); if (!retval) ps.print(); + } else if (!strcmp(cmd, "--get_simple_gui_info")) { + SIMPLE_GUI_INFO sgi; + retval = rpc.get_simple_gui_info(sgi); + if (!retval) sgi.print(); } else if (!strcmp(cmd, "--get_disk_usage")) { PROJECTS ps; retval = rpc.get_disk_usage(ps); diff --git a/lib/gui_rpc_client.h b/lib/gui_rpc_client.h index 406effbbfd..63f486a2b8 100644 --- a/lib/gui_rpc_client.h +++ b/lib/gui_rpc_client.h @@ -508,6 +508,12 @@ struct CC_STATUS { bool ams_password_error; }; +struct SIMPLE_GUI_INFO { + std::vector projects; + std::vector results; + void print(); +}; + class RPC_CLIENT { public: int sock; @@ -541,6 +547,7 @@ public: int get_state(CC_STATE&); int get_results(RESULTS&); int get_file_transfers(FILE_TRANSFERS&); + int get_simple_gui_info(SIMPLE_GUI_INFO&); int get_project_status(CC_STATE&); int get_project_status(PROJECTS&); int get_disk_usage(PROJECTS&); diff --git a/lib/gui_rpc_client_ops.C b/lib/gui_rpc_client_ops.C index d82f6efe13..ab3b6dbe7f 100644 --- a/lib/gui_rpc_client_ops.C +++ b/lib/gui_rpc_client_ops.C @@ -1045,6 +1045,37 @@ int RPC_CLIENT::get_file_transfers(FILE_TRANSFERS& t) { return retval; } +int RPC_CLIENT::get_simple_gui_info(SIMPLE_GUI_INFO& sgi) { + int retval; + SET_LOCALE sl; + char buf[256]; + RPC rpc(this); + + sgi.projects.clear(); + sgi.results.clear(); + retval = rpc.do_rpc("\n"); + if (!retval) { + while (rpc.fin.fgets(buf, 256)) { + if (match_tag(buf, "")) break; + else if (match_tag(buf, "")) { + PROJECT* project = new PROJECT(); + project->parse(rpc.fin); + sgi.projects.push_back(project); + continue; + } + else if (match_tag(buf, "")) { + RESULT* result = new RESULT(); + result->parse(rpc.fin); + sgi.results.push_back(result); + continue; + } + } + } + return retval; +} + +// creates new array of PROJECTs +// int RPC_CLIENT::get_project_status(PROJECTS& p) { int retval; SET_LOCALE sl; @@ -1068,6 +1099,10 @@ int RPC_CLIENT::get_project_status(PROJECTS& p) { return retval; } +// Updates the PROJECT array in the CC_STATE in place; +// flags any projects that don't exist anymore. +// KLUDGE - doesn't belong here +// int RPC_CLIENT::get_project_status(CC_STATE& state) { int retval; SET_LOCALE sl; diff --git a/lib/gui_rpc_client_print.C b/lib/gui_rpc_client_print.C index c41c8fedcc..6d6ba61266 100644 --- a/lib/gui_rpc_client_print.C +++ b/lib/gui_rpc_client_print.C @@ -167,6 +167,20 @@ void HOST_INFO::print() { printf(" disk free: %f\n", d_free); } +void SIMPLE_GUI_INFO::print() { + unsigned int i; + printf("======== Projects ========\n"); + for (i=0; iprint(); + } + printf("\n======== Results ========\n"); + for (i=0; iprint(); + } +} + void CC_STATE::print() { unsigned int i; printf("======== Projects ========\n");