void project_t::dump() const { fprintf(stderr, "PROJECT {\n"); fprintf(stderr, " NAME=\"%s\"\n", name()); fprintf(stderr, " DESCRIPTION=\"%s\"\n", description()); fprintf(stderr, " DEFAULT=\"%s\"\n", default_target()); fprintf(stderr, " BASEDIR=\"%s\"\n", basedir()); targets_->foreach(dump_one_target, 0); taglists_->foreach(dump_one_taglist, 0); filesets_->foreach(dump_one_fileset, 0); dump_properties(); fprintf(stderr, "}\n"); }
int main( int argc, char *argv[]) { char cmdstr[80]; int status, i; xbee_serial_t XBEE_SERPORT; target_t *target = NULL; memset( target_list, 0, sizeof target_list); parse_serial_arguments( argc, argv, &XBEE_SERPORT); // initialize the serial and device layer for this XBee device if (xbee_dev_init( &my_xbee, &XBEE_SERPORT, NULL, NULL)) { printf( "Failed to initialize device.\n"); return 0; } // replace ZDO cluster table with one that intercepts Device Annce messages sample_endpoints.zdo.cluster_table = zdo_clusters; // Initialize the WPAN layer of the XBee device driver. This layer enables // endpoints and clusters, and is required for all ZigBee layers. xbee_wpan_init( &my_xbee, &sample_endpoints.zdo); // Initialize the AT Command layer for this XBee device and have the // driver query it for basic information (hardware version, firmware version, // serial number, IEEE address, etc.) xbee_cmd_init_device( &my_xbee); printf( "Waiting for driver to query the XBee device...\n"); do { xbee_dev_tick( &my_xbee); status = xbee_cmd_query_status( &my_xbee); } while (status == -EBUSY); if (status) { printf( "Error %d waiting for query to complete.\n", status); } // report on the settings xbee_dev_dump_settings( &my_xbee, XBEE_DEV_DUMP_FLAG_DEFAULT); // set Profile ID for our Basic Client Cluster endpoint sample_endpoints.zcl.profile_id = profile_id; print_help(); puts( "searching for Commissioning Servers"); find_devices(); while (1) { while (xbee_readline( cmdstr, sizeof cmdstr) == -EAGAIN) { wpan_tick( &my_xbee.wpan_dev); } if (! strcmpi( cmdstr, "quit")) { return 0; } else if (! strcmpi( cmdstr, "help") || ! strcmp( cmdstr, "?")) { print_help(); } else if (! strncmpi( cmdstr, "profile ", 8)) { profile_id = strtoul( &cmdstr[8], NULL, 16); printf( "Profile ID set to 0x%04x\n", profile_id); sample_endpoints.zcl.profile_id = profile_id; } else if (! strcmpi( cmdstr, "find")) { find_devices(); } else if (! strcmpi( cmdstr, "target")) { puts( " #: --IEEE Address--- Ver. --------Application Name--------" " ---Date Code----"); for (i = 0; i < target_index; ++i) { print_target( i); } puts( "End of List"); } else if (! strncmpi( cmdstr, "target ", 7)) { i = (int) strtoul( &cmdstr[7], NULL, 10); if (target_index == 0) { printf( "error, no targets in list, starting search now...\n"); find_devices(); } else if (i < 0 || i >= target_index) { printf( "error, index %d is invalid (must be 0 to %u)\n", i, target_index - 1); } else { target = &target_list[i]; puts( "set target to:"); print_target( i); } } else if (! strcmpi( cmdstr, "save")) { restart_target( target, TRUE); } else if (! strcmpi( cmdstr, "cancel")) { restart_target( target, FALSE); } else if (! strcmpi( cmdstr, "default")) { default_target( target); } else if (! strcmpi( cmdstr, "deploy")) { set_pan( target, &network_deploy); } else if (! strncmpi( cmdstr, "deploy ", 7)) { if (cmdstr[7] == 'r') { puts( "deploy as router"); network_deploy.startup_control = ZCL_COMM_STARTUP_JOINED; } else if (cmdstr[7] == 'c') { puts( "deploy as coordinator"); network_deploy.startup_control = ZCL_COMM_STARTUP_COORDINATOR; } set_pan( target, &network_deploy); } else if (! strcmpi( cmdstr, "comm")) { set_pan( target, &network_comm); } else if (! strncmpi( cmdstr, "AT", 2)) { process_command( &my_xbee, &cmdstr[2]); } else { printf( "unknown command: '%s'\n", cmdstr); } } }