tux-droid-svn Mailing List for Tux Droid CE (Page 202)
Status: Beta
Brought to you by:
ks156
You can subscribe to this list here.
2007 |
Jan
|
Feb
(32) |
Mar
(108) |
Apr
(71) |
May
(38) |
Jun
(128) |
Jul
(1) |
Aug
(14) |
Sep
(77) |
Oct
(104) |
Nov
(90) |
Dec
(71) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2008 |
Jan
(81) |
Feb
(18) |
Mar
(40) |
Apr
(102) |
May
(151) |
Jun
(74) |
Jul
(151) |
Aug
(257) |
Sep
(447) |
Oct
(379) |
Nov
(404) |
Dec
(430) |
2009 |
Jan
(173) |
Feb
(236) |
Mar
(519) |
Apr
(300) |
May
(112) |
Jun
(232) |
Jul
(314) |
Aug
(58) |
Sep
(203) |
Oct
(293) |
Nov
(26) |
Dec
(109) |
2010 |
Jan
(19) |
Feb
(25) |
Mar
(33) |
Apr
(1) |
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: eFfeM <c2m...@c2...> - 2008-04-20 11:41:42
|
Author: eFfeM Date: 2008-04-20 13:41:47 +0200 (Sun, 20 Apr 2008) New Revision: 981 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c Log: cleanup, includes, split one function in two Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c 2008-04-20 11:22:44 UTC (rev 980) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c 2008-04-20 11:41:47 UTC (rev 981) @@ -23,13 +23,11 @@ #include <stdlib.h> #include <string.h> +#include "tux_hw_cmd.h" #include "tux_hw_status.h" +#include "tux_leds.h" #include "tux_sw_status.h" #include "tux_usb.h" -#include "tux_hw_cmd.h" -#include "tux_leds.h" -#include "tux_cmd_parser.h" -#include "tux_usb.h" typedef enum { @@ -58,9 +56,13 @@ /* Get on / off state */ if (hw_status_table.led.left_led_intensity < 50) + { left_led_state = OFF; + } else + { left_led_state = ON; + } /* Get changing state */ if (hw_status_table.led.effect_status.bits.left_led_fading || @@ -87,7 +89,9 @@ /* Check if the state have changed */ if (strcmp(new_left_state, old_left_state)) + { tux_sw_status_set_value(SW_ID_LEFT_LED_STATE, (void *)new_left_state, true); + } } /** @@ -101,9 +105,13 @@ /* Get on / off state */ if (hw_status_table.led.right_led_intensity < 50) + { right_led_state = OFF; + } else + { right_led_state = ON; + } /* Get changing state */ if (hw_status_table.led.effect_status.bits.right_led_fading || @@ -130,8 +138,10 @@ /* Check if the state have changed */ if (strcmp(new_right_state, old_right_state)) + { tux_sw_status_set_value(SW_ID_RIGHT_LED_STATE, (void *)new_right_state, true); + } } /** Default settings for the fading effect. */ @@ -213,19 +223,28 @@ /* Preconditions. */ if (delta <= 0) + { delta = 1; + } if (delta > 255) + { delta = 255; + } delay = (unsigned char)roundf(gradient_delay / FW_MAIN_LOOP_DELAY); /* Can't go infinitely fast. */ if (delay == 0) + { delay = 1; + } + /* Hardware doesn't support longer delays, we should do them with multiple * commands if necessary. XXX Not supported for now. */ if (delay > 255) + { delay = 255; + } frame[0] = LED_FADE_SPEED_CMD; frame[1] = leds; @@ -323,8 +342,10 @@ right_intensity_delta); } if (skip) + { /* Nothing to do then. */ return ret; + } } break; case FADE_RATE: @@ -349,13 +370,19 @@ /* Preconditions */ if (effect->step <= 0) + { effect->step = 1; + } if (effect->step > 255) + { effect->step = 255; + } /* We should use effect NONE if we don't want gradient. */ if (effect->speed <= 0) + { effect->speed = 0.1; + } /* Don't divide by zero if there's nothing to do ;-). */ if (leds & LED_LEFT && left_intensity_delta) @@ -364,7 +391,9 @@ delta = (int)roundf(left_intensity_delta / effect->step); /* If we can't have as many steps as required. */ if (delta == 0) + { delta = 1; + } ret = config_gradient(LED_LEFT, delta, effect->speed/effect->step); } @@ -374,13 +403,17 @@ delta = (int)roundf(right_intensity_delta / effect->step); /* If we can't have as many steps as required. */ if (delta == 0) + { delta = 1; + } ret = config_gradient(LED_RIGHT, delta, effect->speed/effect->step); } if (skip) + { /* Nothing to do then. */ return ret; + } } break; case GRADIENT_DELTA: @@ -391,32 +424,40 @@ /* Preconditions */ if (effect->step <= 0) + { effect->step = 1; + } if (effect->step > 255) + { effect->step = 255; + } /* We should use effect NONE if we don't want gradient. */ if (effect->speed <= 0) + { effect->speed = 0.1; + } /* Don't divide by zero if there's nothing to do ;-). */ if (leds & LED_LEFT && left_intensity_delta) { skip = false; - gradient_delay = effect->speed * effect->step / \ + gradient_delay = effect->speed * effect->step / left_intensity_delta; ret = config_gradient(LED_LEFT, effect->step, gradient_delay); } if (leds & LED_RIGHT && right_intensity_delta) { skip = false; - gradient_delay = effect->speed * effect->step / \ + gradient_delay = effect->speed * effect->step / right_intensity_delta; ret = config_gradient(LED_RIGHT, effect->step, gradient_delay); } if (skip) + { /* Nothing to do then. */ return ret; + } } break; default: @@ -444,14 +485,28 @@ /* Preconditions */ if (leds < LED_NONE) + { leds = LED_NONE; - else if (leds > LED_BOTH) - leds = LED_BOTH; + } + else + { + if (leds > LED_BOTH) + { + leds = LED_BOTH; + } + } if (intensity < 0) + { intensity = 0; - else if (intensity > 255) - intensity = 255; + } + else + { + if (intensity > 255) + { + intensity = 255; + } + } left_intensity_delta = abs(intensity - hw_status_table.led.left_led_intensity); right_intensity_delta = abs(intensity - hw_status_table.led.right_led_intensity); @@ -494,37 +549,71 @@ /* Preconditions */ if (leds < LED_NONE) + { leds = LED_NONE; - else if (leds > LED_BOTH) - leds = LED_BOTH; + } + else + { + if (leds > LED_BOTH) + { + leds = LED_BOTH; + } + } if (min_intensity < 0) + { min_intensity = 0; - else if (min_intensity > 255) - min_intensity = 255; + } + else + { + if (min_intensity > 255) + { + min_intensity = 255; + } + } if (max_intensity < 0) + { max_intensity = 0; - else if (max_intensity > 255) - max_intensity = 255; + } + else + { + if (max_intensity > 255) + { + max_intensity = 255; + } + } if (min_intensity > max_intensity) + { min_intensity = max_intensity; + } if (pulse_period <= 0) + { pulse_period = 1; + } if (toggle_count <= 0) + { toggle_count = 1; + } delta = max_intensity - min_intensity; ret = led_configure_effects(leds, delta, delta, effect); pulse_width = (int)roundf(pulse_period/FW_MAIN_LOOP_DELAY/2); if (pulse_width < 1) + { pulse_width = 1; - if (pulse_width > 255) - pulse_width = 255; + } + else + { + if (pulse_width > 255) + { + pulse_width = 255; + } + } frame[0] = LED_PULSE_RANGE_CMD; frame[1] = leds; @@ -545,33 +634,66 @@ /** * */ -LIBLOCAL unsigned char -conststr_to_val(char *conststr) +static unsigned char +conststr_to_ledval(char *conststr) { if (!strcmp(conststr, "LED_NONE")) - return 0; + { + return 0; + } if (!strcmp(conststr, "LED_LEFT")) + { return 1; + } if (!strcmp(conststr, "LED_RIGHT")) + { return 2; + } if (!strcmp(conststr, "LED_BOTH")) + { return 3; + } + return 0; +} + +/** + * + */ +static unsigned char +conststr_to_effectval(char *conststr) +{ if (!strcmp(conststr, "UNAFFECTED")) + { return 0; + } if (!strcmp(conststr, "LAST")) + { return 1; + } if (!strcmp(conststr, "NONE")) + { return 2; + } if (!strcmp(conststr, "DEFAULT")) + { return 3; + } if (!strcmp(conststr, "FADE_DURATION")) + { return 4; + } if (!strcmp(conststr, "FADE_RATE")) + { return 5; + } if (!strcmp(conststr, "GRADIENT_NBR")) + { return 6; + } if (!strcmp(conststr, "GRADIENT_DELTA")) + { return 7; + } return 0; } @@ -592,25 +714,36 @@ unsigned char e_st = 2; bool ret = true; - lds = conststr_to_val(leds); + lds = conststr_to_ledval(leds); ret = str_to_float(intensity, &intsty); - e_t = conststr_to_val(effect_type); + e_t = conststr_to_effectval(effect_type); ret &= str_to_float(effect_speed, &e_sp); ret &= str_to_uint8(effect_step, &e_st); if (!ret) + { return false; + } effect.type = e_t; effect.speed = e_sp; effect.step = e_st; if (intsty < 0) + { intsty2 = 0; - else if (intsty > 1.0) - intsty2 = 255; + } else - intsty2 = (int)(255 * intsty); + { + if (intsty > 1.0) + { + intsty2 = 255; + } + else + { + intsty2 = (int)(255 * intsty); + } + } return led_set(lds, intsty2, &effect); } @@ -637,8 +770,8 @@ float p_period = 0.3; bool ret = true; - lds = conststr_to_val(leds); - e_t = conststr_to_val(effect_type); + lds = conststr_to_ledval(leds); + e_t = conststr_to_effectval(effect_type); ret = str_to_float(min_intensity, &min_intsty); ret &= str_to_float(max_intensity, &max_intsty); ret &= str_to_float(effect_speed, &e_sp); @@ -647,25 +780,45 @@ ret &= str_to_float(pulse_period, &p_period); if (!ret) + { return false; + } effect.type = e_t; effect.speed = e_sp; effect.step = e_st; if (min_intsty < 0) + { min_intsty2 = 0; - else if (min_intsty > 1.0) - min_intsty2 = 255; + } else - min_intsty2 = (int)(255 * min_intsty); + { + if (min_intsty > 1.0) + { + min_intsty2 = 255; + } + else + { + min_intsty2 = (int)(255 * min_intsty); + } + } if (max_intsty < 0) + { max_intsty2 = 0; - else if (max_intsty > 1.0) - max_intsty2 = 255; + } else - max_intsty2 = (int)(255 * max_intsty); + { + if (max_intsty > 1.0) + { + max_intsty2 = 255; + } + else + { + max_intsty2 = (int)(255 * max_intsty); + } + } return led_pulse(lds, min_intsty2, max_intsty2, p_count, p_period, &effect); |
From: eFfeM <c2m...@c2...> - 2008-04-20 11:22:52
|
Author: eFfeM Date: 2008-04-20 13:22:44 +0200 (Sun, 20 Apr 2008) New Revision: 980 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/log.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c Log: removed unneeded includes of <stdlib.h>; reordered some includes Modified: software_suite_v2/middleware/tuxdriver/trunk/src/log.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/log.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/log.c 2008-04-20 11:22:44 UTC (rev 980) @@ -18,11 +18,10 @@ * 02111-1307, USA. */ -#include <stdlib.h> +#include <assert.h> #include <stdio.h> #include <stdarg.h> #include <time.h> -#include <assert.h> #include "log.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c 2008-04-20 11:22:44 UTC (rev 980) @@ -19,8 +19,8 @@ */ #include <stdio.h> -#include <stdlib.h> #include <string.h> + #include "tux_audio.h" #include "tux_hw_cmd.h" #include "tux_usb.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-04-20 11:22:44 UTC (rev 980) @@ -20,8 +20,8 @@ #include <math.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> + #include "tux_battery.h" #include "tux_hw_status.h" #include "tux_sw_status.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-04-20 11:22:44 UTC (rev 980) @@ -18,7 +18,6 @@ * 02111-1307, USA. */ -#include <stdlib.h> #include <stdio.h> #include <string.h> #include <time.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c 2008-04-20 11:22:44 UTC (rev 980) @@ -18,10 +18,11 @@ * 02111-1307, USA. */ +#include <math.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> -#include <stdlib.h> -#include <math.h> + #include "tux_hw_status.h" #include "tux_sw_status.h" #include "tux_usb.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.c 2008-04-20 11:22:44 UTC (rev 980) @@ -18,10 +18,10 @@ * 02111-1307, USA. */ +#include <math.h> #include <stdio.h> #include <string.h> -#include <stdlib.h> -#include <math.h> + #include "tux_hw_status.h" #include "tux_sw_status.h" #include "tux_light.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-04-20 11:22:44 UTC (rev 980) @@ -20,7 +20,7 @@ #include <stdio.h> #include <string.h> -#include <stdlib.h> + #include "tux_misc.h" #ifdef WIN32 # include <time.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.c 2008-04-20 11:22:44 UTC (rev 980) @@ -20,7 +20,7 @@ #include <stdio.h> #include <string.h> -#include <stdlib.h> + #include "tux_movements.h" #include "tux_hw_status.h" #include "tux_hw_cmd.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.c 2008-04-20 11:22:44 UTC (rev 980) @@ -18,10 +18,10 @@ * 02111-1307, USA. */ +#include <math.h> #include <stdio.h> #include <string.h> -#include <stdlib.h> -#include <math.h> + #include "tux_hw_status.h" #include "tux_sw_status.h" #include "tux_usb.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c 2008-04-20 11:22:44 UTC (rev 980) @@ -18,10 +18,10 @@ * 02111-1307, USA. */ +#include <math.h> #include <stdio.h> #include <string.h> -#include <stdlib.h> -#include <math.h> + #include "tux_hw_status.h" #include "tux_hw_cmd.h" #include "tux_sw_status.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-04-20 11:22:44 UTC (rev 980) @@ -18,10 +18,11 @@ * 02111-1307, USA. */ +#include <dirent.h> #include <stdio.h> +#include <stdlib.h> #include <string.h> -#include <stdlib.h> -#include <dirent.h> + #include "tux_hw_status.h" #include "tux_hw_cmd.h" #include "tux_sw_status.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.c 2008-04-20 11:22:44 UTC (rev 980) @@ -20,7 +20,7 @@ #include <stdio.h> #include <string.h> -#include <stdlib.h> + #include "tux_hw_status.h" #include "tux_hw_cmd.h" #include "tux_sw_status.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c 2008-04-20 11:22:44 UTC (rev 980) @@ -18,13 +18,14 @@ * 02111-1307, USA. */ +#include <errno.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> -#include <errno.h> + #ifdef USE_MUTEX # include "threading_uniform.h" #endif + #include "version.h" #include "tux_firmware.h" #include "tux_hw_status.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-04-20 11:22:44 UTC (rev 980) @@ -20,8 +20,8 @@ #include <errno.h> #include <stdio.h> -#include <stdlib.h> #include <string.h> + #ifdef WIN32 # include "usb.h" #else Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c 2008-04-20 11:22:44 UTC (rev 980) @@ -20,7 +20,7 @@ #include <stdio.h> #include <string.h> -#include <stdlib.h> + #include "tux_hw_status.h" #include "tux_sw_status.h" #include "tux_hw_cmd.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c 2008-04-20 11:17:42 UTC (rev 979) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c 2008-04-20 11:22:44 UTC (rev 980) @@ -20,7 +20,7 @@ #include <stdio.h> #include <string.h> -#include <stdlib.h> + #include "tux_hw_status.h" #include "tux_hw_cmd.h" #include "tux_sw_status.h" |
From: eFfeM <c2m...@c2...> - 2008-04-20 11:17:38
|
Author: eFfeM Date: 2008-04-20 13:17:42 +0200 (Sun, 20 Apr 2008) New Revision: 979 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c Log: remove unneeded includes of <errno.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c 2008-04-20 11:17:42 UTC (rev 979) @@ -18,7 +18,6 @@ * 02111-1307, USA. */ -#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-04-20 11:17:42 UTC (rev 979) @@ -18,7 +18,6 @@ * 02111-1307, USA. */ -#include <errno.h> #include <math.h> #include <stdio.h> #include <stdlib.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-04-20 11:17:42 UTC (rev 979) @@ -18,7 +18,6 @@ * 02111-1307, USA. */ -#include <errno.h> #include <stdlib.h> #include <stdio.h> #include <string.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.c 2008-04-20 11:17:42 UTC (rev 979) @@ -18,7 +18,6 @@ * 02111-1307, USA. */ -#include <errno.h> #include <string.h> #include "tux_cmd_parser.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include <math.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include <math.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include "tux_misc.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include "tux_movements.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include <math.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include <math.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include <dirent.h> Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include "tux_hw_status.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c 2008-04-20 11:17:42 UTC (rev 979) @@ -18,10 +18,10 @@ * 02111-1307, USA. */ +#include <errno.h> #include <stdio.h> #include <stdlib.h> #include <string.h> -#include <errno.h> #ifdef WIN32 # include "usb.h" #else Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include "tux_hw_status.h" Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c 2008-04-20 11:12:35 UTC (rev 978) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c 2008-04-20 11:17:42 UTC (rev 979) @@ -19,7 +19,6 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> #include <stdlib.h> #include "tux_hw_status.h" |
From: eFfeM <c2m...@c2...> - 2008-04-20 11:12:36
|
Author: eFfeM Date: 2008-04-20 13:12:35 +0200 (Sun, 20 Apr 2008) New Revision: 978 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_id.c Log: cleanup, removed unneeded includes Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_id.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_id.c 2008-04-20 10:45:34 UTC (rev 977) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_id.c 2008-04-20 11:12:35 UTC (rev 978) @@ -19,13 +19,11 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> -#include <stdlib.h> + #include "tux_descriptor.h" #include "tux_hw_status.h" #include "tux_hw_cmd.h" -#include "tux_id.h" #include "tux_usb.h" LIBLOCAL id_descriptor_t id_desc; @@ -45,12 +43,11 @@ LIBLOCAL void tux_id_dump_descriptor(char *descriptor) { - char tmp_str[80] = ""; + char tmp_str[80]; - strcat(descriptor, "- ID connection\n"); - sprintf(tmp_str, " - number : \t[%d]\n", - id_desc.number); - strcat(descriptor, tmp_str); + strcat(descriptor, "- ID connection\n"); + sprintf(tmp_str, " - number : \t[%d]\n", id_desc.number); + strcat(descriptor, tmp_str); return; } @@ -61,8 +58,8 @@ LIBLOCAL void tux_id_update_number(void) { - id_desc.number = (hw_status_table.id.msb_number << 8); - id_desc.number += hw_status_table.id.lsb_number; + id_desc.number = (hw_status_table.id.msb_number << 8) + + hw_status_table.id.lsb_number; } /** @@ -72,9 +69,9 @@ tux_id_get_descriptor(void) { unsigned char frame[TUX_SEND_LENGTH - 1] = - {USB_DONGLE_CONNECTION_CMD, - USB_TUX_CONNECTION_ID_REQUEST, - 0, 0}; + { USB_DONGLE_CONNECTION_CMD, + USB_TUX_CONNECTION_ID_REQUEST, + 0, 0}; tux_usb_send_to_dongle(frame); } @@ -86,9 +83,9 @@ tux_id_cmd_disconnect_from_tux(void) { unsigned char frame[TUX_SEND_LENGTH - 1] = - {USB_DONGLE_CONNECTION_CMD, - USB_TUX_CONNECTION_DISCONNECT, - 0, 0}; + { USB_DONGLE_CONNECTION_CMD, + USB_TUX_CONNECTION_DISCONNECT, + 0, 0}; return tux_usb_send_to_dongle(frame); } |
From: eFfeM <c2m...@c2...> - 2008-04-20 10:45:34
|
Author: eFfeM Date: 2008-04-20 12:45:34 +0200 (Sun, 20 Apr 2008) New Revision: 977 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_hw_status.c Log: includes, layout Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_hw_status.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_hw_status.c 2008-04-20 10:31:21 UTC (rev 976) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_hw_status.c 2008-04-20 10:45:34 UTC (rev 977) @@ -19,11 +19,10 @@ */ #include <string.h> -#include <stdio.h> -#include <stdlib.h> + +#include "log.h" #include "tux_hw_status.h" #include "tux_misc.h" -#include "log.h" LIBLOCAL hw_status_table_t hw_status_table; LIBLOCAL unsigned char tux_hw_status_header_counter[16] = { 0, 0, 0, 0, 0, 0, @@ -169,10 +168,16 @@ unsigned char p_count = 0; for (i = 0; i < 16; i++) + { p_count += tux_hw_status_header_counter[i]; + } + /* as there is only debug code in this for loop it might make sense + to have a guarding ifdef around the for loop to save a few cycles */ for (i = 0; i < 16; i++) - if ((tux_hw_status_header_counter[i] > 1) && (p_count > 12)) { + { + if ((tux_hw_status_header_counter[i] > 1) && (p_count > 12)) + { log_debug("Frames counter (%d) :\n\t%s:[%d]\n\t%s:[%d]\n\ \r\t%s:[%d]\n\t%s:[%d]\n\t%s:[%d]\n\t%s:[%d]\n\t%s:[%d]\n\ \r\t%s:[%d]\n\t%s:[%d]\n\t%s:[%d]\n\t%s:[%d]\n\t%s:[%d]\n\ @@ -196,9 +201,13 @@ tux_hw_status_id_to_str(15), tux_hw_status_header_counter[15]); break; } + } + // use memset instead ? for (i = 0; i < 16; i++) + { tux_hw_status_header_counter[i] = 0; + } } /** @@ -210,11 +219,17 @@ int ret = 0; if (hw_status_table.ports.portb.Byte != frame[1]) + { ret = FRAME_HEADER_PORTS; + } if (hw_status_table.ports.portc.Byte != frame[2]) + { ret = FRAME_HEADER_PORTS; + } if (hw_status_table.ports.portd.Byte != frame[3]) + { ret = FRAME_HEADER_PORTS; + } hw_status_table.ports.portb.Byte = frame[1]; hw_status_table.ports.portc.Byte = frame[2]; @@ -232,11 +247,17 @@ int ret = 0; if (hw_status_table.sensors1.sensors.Byte != frame[1]) + { ret = FRAME_HEADER_SENSORS1; + } if (hw_status_table.sensors1.play_internal_sound != frame[2]) + { ret = FRAME_HEADER_SENSORS1; + } if (hw_status_table.sensors1.play_general_sound != frame[3]) + { ret = FRAME_HEADER_SENSORS1; + } hw_status_table.sensors1.sensors.Byte = frame[1]; hw_status_table.sensors1.play_internal_sound = frame[2]; @@ -254,11 +275,17 @@ int ret = 0; if (hw_status_table.light.high_level != frame[1]) + { ret = FRAME_HEADER_LIGHT; + } if (hw_status_table.light.low_level != frame[2]) + { ret = FRAME_HEADER_LIGHT; + } if (hw_status_table.light.mode != frame[3]) + { ret = FRAME_HEADER_LIGHT; + } hw_status_table.light.high_level = frame[1]; hw_status_table.light.low_level = frame[2]; @@ -276,11 +303,17 @@ int ret = 0; if (hw_status_table.position1.eyes_remaining_mvm != frame[1]) + { ret = FRAME_HEADER_POSITION1; + } if (hw_status_table.position1.mouth_remaining_mvm != frame[2]) + { ret = FRAME_HEADER_POSITION1; + } if (hw_status_table.position1.wings_remaining_mvm != frame[3]) + { ret = FRAME_HEADER_POSITION1; + } hw_status_table.position1.eyes_remaining_mvm = frame[1]; hw_status_table.position1.mouth_remaining_mvm = frame[2]; @@ -298,9 +331,13 @@ int ret = 0; if (hw_status_table.position2.spin_remaining_mvm != frame[1]) + { ret = FRAME_HEADER_POSITION2; + } if (hw_status_table.position2.wings_down != frame[2]) + { ret = FRAME_HEADER_POSITION2; + } hw_status_table.position2.spin_remaining_mvm = frame[1]; hw_status_table.position2.wings_down = frame[2]; @@ -317,7 +354,9 @@ int ret = 0; if (hw_status_table.ir.rc5_code.Byte != frame[1]) + { ret = FRAME_HEADER_IR; + } hw_status_table.ir.rc5_code.Byte = frame[1]; @@ -333,9 +372,13 @@ int ret = 0; if (hw_status_table.id.msb_number != frame[1]) + { ret = FRAME_HEADER_ID; + } if (hw_status_table.id.lsb_number != frame[2]) + { ret = FRAME_HEADER_ID; + } hw_status_table.id.msb_number = frame[1]; hw_status_table.id.lsb_number = frame[2]; @@ -352,11 +395,17 @@ int ret = 0; if (hw_status_table.battery.high_level != frame[1]) + { ret = FRAME_HEADER_BATTERY; + } if (hw_status_table.battery.low_level != frame[2]) + { ret = FRAME_HEADER_BATTERY; + } if (hw_status_table.battery.motors_state != frame[3]) + { ret = FRAME_HEADER_BATTERY; + } hw_status_table.battery.high_level = frame[1]; hw_status_table.battery.low_level = frame[2]; @@ -374,11 +423,17 @@ int ret = 0; if (hw_status_table.version.cm.Byte != frame[1]) + { ret = FRAME_HEADER_VERSION; + } if (hw_status_table.version.minor != frame[2]) + { ret = FRAME_HEADER_VERSION; + } if (hw_status_table.version.update != frame[3]) + { ret = FRAME_HEADER_VERSION; + } hw_status_table.version.cm.Byte = frame[1]; hw_status_table.version.minor = frame[2]; @@ -405,11 +460,17 @@ int ret = 0; if (hw_status_table.revision.lsb_number != frame[1]) + { ret = FRAME_HEADER_REVISION; + } if (hw_status_table.revision.msb_number != frame[2]) + { ret = FRAME_HEADER_REVISION; + } if (hw_status_table.revision.release_type.Byte != frame[3]) + { ret = FRAME_HEADER_REVISION; + } hw_status_table.revision.lsb_number = frame[1]; hw_status_table.revision.msb_number = frame[2]; @@ -436,11 +497,17 @@ int ret = 0; if (hw_status_table.author.lsb_id != frame[1]) + { ret = FRAME_HEADER_AUTHOR; + } if (hw_status_table.author.msb_id != frame[2]) + { ret = FRAME_HEADER_AUTHOR; + } if (hw_status_table.author.variation_number != frame[3]) + { ret = FRAME_HEADER_AUTHOR; + } hw_status_table.author.lsb_id = frame[1]; hw_status_table.author.msb_id = frame[2]; @@ -467,11 +534,17 @@ int ret = 0; if (hw_status_table.audio.sound_track_played != frame[1]) + { ret = FRAME_HEADER_AUDIO; + } if (hw_status_table.audio.programming_steps.Byte != frame[2]) + { ret = FRAME_HEADER_AUDIO; + } if (hw_status_table.audio.programmed_sound_track != frame[3]) + { ret = FRAME_HEADER_AUDIO; + } hw_status_table.audio.sound_track_played = frame[1]; hw_status_table.audio.programming_steps.Byte = frame[2]; @@ -489,9 +562,13 @@ int ret = 0; if (hw_status_table.sound_var.number_of_sounds != frame[1]) + { ret = FRAME_HEADER_SOUND_VAR; + } if (hw_status_table.sound_var.flash_usage != frame[2]) + { ret = FRAME_HEADER_SOUND_VAR; + } hw_status_table.sound_var.number_of_sounds = frame[1]; hw_status_table.sound_var.flash_usage = frame[2]; @@ -508,9 +585,13 @@ int ret = 0; if (hw_status_table.flash_prog.current_state != frame[1]) + { ret = FRAME_HEADER_FLASH_PROG; + } if (hw_status_table.flash_prog.last_sound_size != frame[2]) + { ret = FRAME_HEADER_FLASH_PROG; + } hw_status_table.flash_prog.current_state = frame[1]; hw_status_table.flash_prog.last_sound_size = frame[2]; @@ -527,11 +608,17 @@ int ret = 0; if (hw_status_table.led.left_led_intensity != frame[1]) + { ret = FRAME_HEADER_LED; + } if (hw_status_table.led.right_led_intensity != frame[2]) + { ret = FRAME_HEADER_LED; + } if (hw_status_table.led.effect_status.Byte != frame[3]) + { ret = FRAME_HEADER_LED; + } hw_status_table.led.left_led_intensity = frame[1]; hw_status_table.led.right_led_intensity = frame[2]; @@ -549,11 +636,17 @@ int ret = 0; if (hw_status_table.pong.pongs_pending_number != frame[1]) + { ret = FRAME_HEADER_PONG; + } if (hw_status_table.pong.pongs_lost_by_i2c_number != frame[2]) + { ret = FRAME_HEADER_PONG; + } if (hw_status_table.pong.pongs_lost_by_rf_number != frame[3]) + { ret = FRAME_HEADER_PONG; + } hw_status_table.pong.pongs_pending_number = frame[1]; hw_status_table.pong.pongs_lost_by_i2c_number = frame[2]; |
From: eFfeM <c2m...@c2...> - 2008-04-20 10:31:21
|
Author: eFfeM Date: 2008-04-20 12:31:21 +0200 (Sun, 20 Apr 2008) New Revision: 976 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c Log: clean includes, layout Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c 2008-04-20 10:22:21 UTC (rev 975) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c 2008-04-20 10:31:21 UTC (rev 976) @@ -19,14 +19,12 @@ */ #include <stdio.h> -#include <errno.h> #include <string.h> -#include <stdlib.h> + #include "tux_descriptor.h" -#include "tux_usb.h" +#include "tux_firmware.h" #include "tux_hw_status.h" #include "tux_sw_status.h" -#include "tux_firmware.h" #include "tux_usb.h" /** State of the versioning state machine. */ @@ -187,44 +185,44 @@ static void dump_descriptor_of_cpu(char *descriptor, firmware_descriptor_t *desc) { - char tmp_str[80] = ""; + char tmp_str[80] = ""; - sprintf(tmp_str, " CPU id : \t\t\t%d\n", - desc->cpu_id); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " CPU name : \t\t\t%s\n", - cpu_id_to_name(desc->cpu_id)); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Version major : \t\t%d\n", - desc->version_major); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Version minor : \t\t%d\n", - desc->version_minor); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Version update : \t\t%d\n", - desc->version_update); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Revision : \t\t\t%d\n", - desc->revision); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Released : \t\t\t%s\n", - desc->release ? "True" : "False"); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Local modification : \t%s\n", - desc->local_modification ? "True" : "False"); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Mixed revisions : \t\t%s\n", - desc->mixed_revisions ? "True" : "False"); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Author id : \t\t%d\n", - desc->author); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Variation : \t\t%d\n", - desc->variation); - strcat(descriptor, tmp_str); - sprintf(tmp_str, " Symbolic version : \t\t[%s]\n", - desc->version_string); - strcat(descriptor, tmp_str); + sprintf(tmp_str, " CPU id : \t\t\t%d\n", + desc->cpu_id); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " CPU name : \t\t\t%s\n", + cpu_id_to_name(desc->cpu_id)); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Version major : \t\t%d\n", + desc->version_major); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Version minor : \t\t%d\n", + desc->version_minor); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Version update : \t\t%d\n", + desc->version_update); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Revision : \t\t\t%d\n", + desc->revision); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Released : \t\t\t%s\n", + desc->release ? "True" : "False"); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Local modification : \t%s\n", + desc->local_modification ? "True" : "False"); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Mixed revisions : \t\t%s\n", + desc->mixed_revisions ? "True" : "False"); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Author id : \t\t%d\n", + desc->author); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Variation : \t\t%d\n", + desc->variation); + strcat(descriptor, tmp_str); + sprintf(tmp_str, " Symbolic version : \t\t[%s]\n", + desc->version_string); + strcat(descriptor, tmp_str); return; } @@ -235,26 +233,30 @@ LIBLOCAL void tux_firmware_dump_descriptor(char *descriptor) { - char tmp_str[80] = ""; - int i; + char tmp_str[80] = ""; + int i; - strcat(descriptor, "- Firmwares\n"); + strcat(descriptor, "- Firmwares\n"); - if (firmware_release_desc.version_string[0] == '\0') { - sprintf(tmp_str, " - %s : \t[%s]\n", - RELEASE_STR_NAME, UNOFFICIAL_RELEASE_STR); - strcat(descriptor, tmp_str); - } else { - sprintf(tmp_str, " - %s : \t[%s]\n", - RELEASE_STR_NAME, firmware_release_desc.version_string); - strcat(descriptor, tmp_str); + if (firmware_release_desc.version_string[0] == '\0') + { + sprintf(tmp_str, " - %s : \t[%s]\n", + RELEASE_STR_NAME, UNOFFICIAL_RELEASE_STR); + strcat(descriptor, tmp_str); } + else + { + sprintf(tmp_str, " - %s : \t[%s]\n", + RELEASE_STR_NAME, firmware_release_desc.version_string); + strcat(descriptor, tmp_str); + } - for (i = 0; i < NUMBER_OF_CPU; i++) { - sprintf(tmp_str, " - CPU %d\n", i + 1); - strcat(descriptor, tmp_str); - - dump_descriptor_of_cpu(descriptor, &firmwares_desc[i]); + for (i = 0; i < NUMBER_OF_CPU; i++) + { + sprintf(tmp_str, " - CPU %d\n", i + 1); + strcat(descriptor, tmp_str); + + dump_descriptor_of_cpu(descriptor, &firmwares_desc[i]); } return; @@ -286,7 +288,9 @@ firmware_descriptor_t *f_desc; if (current_cpu == INVALID_CPU_NUM) + { return; + } f_desc = &firmwares_desc[current_cpu]; f_desc->revision = hw_status_table.revision.msb_number << 8; @@ -321,7 +325,9 @@ firmware_descriptor_t *f_desc; if (current_cpu == INVALID_CPU_NUM) + { return; + } f_desc = &firmwares_desc[current_cpu]; f_desc->author = hw_status_table.author.msb_id << 8; @@ -348,9 +354,13 @@ ret = tux_usb_send_to_tux(data); if (ret) + { return 1; + } else + { return 0; + } } /** @@ -365,10 +375,17 @@ unsigned char const author[4] = {0xC9, 0, 0, 0}; if (cpu_id == TUXRF_CPU_NUM) + { tux_hw_parse_body_version(tuxrf_version); + } - else if (cpu_id == FUXRF_CPU_NUM) - tux_hw_parse_body_version(fuxrf_version); + else + { + if (cpu_id == FUXRF_CPU_NUM) + { + tux_hw_parse_body_version(fuxrf_version); + } + } tux_hw_parse_body_revision(revision); tux_hw_parse_body_author(author); @@ -387,9 +404,13 @@ if ((firmware->version_major != major) || (firmware->version_minor != minor) || (firmware->version_update != update)) + { return false; + } else + { return true; + } } /** @@ -444,66 +465,92 @@ /* Check if all firmwares is released and it have the same * version */ - while (cpu_num <= HIGHEST_CPU_NUM) { + while (cpu_num <= HIGHEST_CPU_NUM) + { if (first_rf_ver && ((cpu_num == FUXRF_CPU_NUM) || (cpu_num == TUXRF_CPU_NUM))) + { cpu_num ++; - else { + } + else + { firmware = &firmwares_desc[cpu_num]; if (!firmware->release) + { /* Firmware is not released -> FAIL */ return; + } if (!test_fw_ver(firmware, t_major, t_minor, t_update)) + { /* Firmware have not the same version than the first one */ perfect_package = false; + } cpu_num ++; } } /* If the firmware set is not a perfect package */ - if (!perfect_package) { + if (!perfect_package) + { /* Determine the general version major */ cpu_num = LOWEST_CPU_NUM; - while (cpu_num <= HIGHEST_CPU_NUM) { + while (cpu_num <= HIGHEST_CPU_NUM) + { firmware = &firmwares_desc[cpu_num]; if (firmware->version_major > major) + { major = firmware->version_major; + } cpu_num ++; } /* Determine the general version minor */ cpu_num = LOWEST_CPU_NUM; - while (cpu_num <= HIGHEST_CPU_NUM) { + while (cpu_num <= HIGHEST_CPU_NUM) + { firmware = &firmwares_desc[cpu_num]; if ((firmware->version_major == major) && (firmware->version_minor > minor)) + { minor = firmware->version_minor; + } cpu_num ++; } /* Determine the general version update */ cpu_num = LOWEST_CPU_NUM; - while (cpu_num <= HIGHEST_CPU_NUM) { + while (cpu_num <= HIGHEST_CPU_NUM) + { firmware = &firmwares_desc[cpu_num]; if ((firmware->version_major == major) && (firmware->version_minor == minor) && (firmware->version_update > update)) + { update = firmware->version_update; + } cpu_num ++; } /* Test if the firmware set is an official package */ /* release 0.3.1, tuxcore and tuxaudio updated to 0.3.1 */ - if ((major == 0) && (minor == 3) && (update == 1)) { + if ((major == 0) && (minor == 3) && (update == 1)) + { ret = test_fw_ver(&firmwares_desc[TUXCORE_CPU_NUM], 0, 3, 1); ret &= test_fw_ver(&firmwares_desc[TUXAUDIO_CPU_NUM], 0, 3, 1); ret &= test_fw_ver(&firmwares_desc[FUXUSB_CPU_NUM], 0, 3, 0); if (!ret) + { /* Not official package -> FAIL */ return; - } else + } + } + else + { /* Not other special case -> FAIL */ return; - } else { + } + } + else + { major = t_major; minor = t_minor; update = t_update; @@ -529,7 +576,9 @@ tux_firmware_state_machine_call(void) { if (!tux_usb_connected()) + { return; + } switch (versioning_state) { case STDBY: @@ -541,18 +590,22 @@ retries = TUX_FIRMWARE_RETRY_COUNT; break; case INFO_REQ: - if (cpu_num > HIGHEST_CPU_NUM) { + if (cpu_num > HIGHEST_CPU_NUM) + { versioning_state = SPECIAL; break; } - if (firmwares_desc[cpu_num].version_string[0] == '\0') { - if (!retries) { + if (firmwares_desc[cpu_num].version_string[0] == '\0') + { + if (!retries) + { cpu_num++; break; } - if (!send_firmware_versionning_request(cpu_num)) { + if (!send_firmware_versionning_request(cpu_num)) + { retries--; break; } @@ -562,14 +615,16 @@ versioning_state = INFO_GET; break; case INFO_GET: - if (!retries) { + if (!retries) + { cpu_num++; retries = TUX_FIRMWARE_RETRY_COUNT; versioning_state = INFO_REQ; break; } - if (firmwares_desc[cpu_num].version_string[0] != '\0') { + if (firmwares_desc[cpu_num].version_string[0] != '\0') + { cpu_num++; retries = TUX_FIRMWARE_RETRY_COUNT; versioning_state = INFO_REQ; @@ -579,15 +634,23 @@ break; case SPECIAL: if (firmwares_desc[TUXRF_CPU_NUM].version_string[0] == '\0') + { special_old_versionning(TUXRF_CPU_NUM); + } if (firmwares_desc[FUXRF_CPU_NUM].version_string[0] == '\0') + { special_old_versionning(FUXRF_CPU_NUM); + } /* TODO : old FUXUSB cpu */ if ((firmwares_desc[TUXCORE_CPU_NUM].version_string[0] == '\0') || (firmwares_desc[TUXAUDIO_CPU_NUM].version_string[0] == '\0')) + { versioning_state = INIT; + } else + { versioning_state = RELEASE; + } break; case RELEASE: determine_release_package(); @@ -619,7 +682,8 @@ LIBLOCAL void tux_firmware_get_descriptor(void) { - if (versioning_state == STDBY) { + if (versioning_state == STDBY) + { tux_firmware_init_descriptor(); versioning_state = INIT; } |
From: eFfeM <c2m...@c2...> - 2008-04-20 10:22:16
|
Author: eFfeM Date: 2008-04-20 12:22:21 +0200 (Sun, 20 Apr 2008) New Revision: 975 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.h Log: removed unneeded includes, layout Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.c 2008-04-20 10:15:17 UTC (rev 974) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.c 2008-04-20 10:22:21 UTC (rev 975) @@ -18,17 +18,16 @@ * 02111-1307, USA. */ -#include <stdio.h> #include <errno.h> #include <string.h> -#include <stdlib.h> + +#include "tux_cmd_parser.h" +#include "tux_eyes.h" #include "tux_hw_status.h" #include "tux_hw_cmd.h" +#include "tux_movements.h" #include "tux_sw_status.h" -#include "tux_cmd_parser.h" -#include "tux_movements.h" #include "tux_usb.h" -#include "tux_eyes.h" /** * Update the status of the position of the eyes. @@ -37,22 +36,31 @@ tux_eyes_update_position(void) { char *new_position = ""; - char *old_position = ""; + char *old_position; if (!hw_status_table.ports.portd.bits.eyes_open_switch) { new_position = STRING_VALUE_OPEN; - } else if (!hw_status_table.ports.portd.bits.eyes_closed_switch) + } + else { - new_position = STRING_VALUE_CLOSE; - } else - new_position = STRING_VALUE_NDEF; + if (!hw_status_table.ports.portd.bits.eyes_closed_switch) + { + new_position = STRING_VALUE_CLOSE; + } + else + { + new_position = STRING_VALUE_NDEF; + } + } old_position = (char *)tux_sw_status_get_value(SW_ID_EYES_POSITION); if (strcmp(new_position, old_position)) + { tux_sw_status_set_value(SW_ID_EYES_POSITION, (void *)new_position, true); + } } /** @@ -67,8 +75,10 @@ old_count = *(unsigned char *)tux_sw_status_get_value(SW_ID_EYES_REMAINING_MVM); if (new_count != old_count) + { tux_sw_status_set_value(SW_ID_EYES_REMAINING_MVM, (void *)&new_count, true); + } } /** @@ -82,11 +92,13 @@ bool ret; ret = str_to_uint8(counter, &cnt); - fs = tux_movement_conststr_to_val(final_state); - if (!ret) + { return false; + } + fs = tux_movement_conststr_to_val(final_state); + return tux_movement_perform(MOVE_EYES, cnt, 0.0, 5, fs, false); } @@ -102,19 +114,25 @@ unsigned char frame[TUX_SEND_LENGTH - 1] = {EYES_BLINK_CMD, 0, 0, 0}; ret = str_to_float(timeout, &to); - fs = tux_movement_conststr_to_val(final_state); - if (!ret) + { return false; + } + fs = tux_movement_conststr_to_val(final_state); + /* Short movements */ if (to < 0.3) + { return tux_movement_perform(MOVE_EYES, 0, to, 5, fs, false); + } /* Long movements */ ret = tux_usb_send_to_tux(frame); if (!ret) + { return false; + } switch (fs) { case FINAL_ST_UNDEFINED: Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.h 2008-04-20 10:15:17 UTC (rev 974) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.h 2008-04-20 10:22:21 UTC (rev 975) @@ -21,8 +21,6 @@ #ifndef _TUX_EYES_H_ #define _TUX_EYES_H_ -#include "tux_misc.h" - #define TUX_EYES_POSITION_NDEF 0 #define TUX_EYES_POSITION_OPEN 1 #define TUX_EYES_POSITION_CLOSE 2 |
From: eFfeM <c2m...@c2...> - 2008-04-20 10:15:12
|
Author: eFfeM Date: 2008-04-20 12:15:17 +0200 (Sun, 20 Apr 2008) New Revision: 974 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_error.c Log: small layout fixes Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_error.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_error.c 2008-04-20 10:13:30 UTC (rev 973) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_error.c 2008-04-20 10:15:17 UTC (rev 974) @@ -30,21 +30,21 @@ switch (error_code) { case E_TUXDRV_NOERROR: return "No error"; - case E_TUXDRV_PARSERISDISABLED: + case E_TUXDRV_PARSERISDISABLED: return "The parser of command is disabled"; - case E_TUXDRV_INVALIDCOMMAND: + case E_TUXDRV_INVALIDCOMMAND: return "Invalid command"; - case E_TUXDRV_STACKOVERFLOW: + case E_TUXDRV_STACKOVERFLOW: return "The stack of commands is full"; - case E_TUXDRV_FILEERROR: + case E_TUXDRV_FILEERROR: return "File error"; - case E_TUXDRV_BADWAVFILE: + case E_TUXDRV_BADWAVFILE: return "Wave file error"; - case E_TUXDRV_INVALIDIDENTIFIER: + case E_TUXDRV_INVALIDIDENTIFIER: return "The identifier is unknow"; - case E_TUXDRV_INVALIDNAME: + case E_TUXDRV_INVALIDNAME: return "The name is unknow"; - case E_TUXDRV_INVALIDPARAMETER: + case E_TUXDRV_INVALIDPARAMETER: return "One or more parameters are invalid"; case E_TUXDRV_BUSY: return "The system is busy"; |
From: eFfeM <c2m...@c2...> - 2008-04-20 10:13:26
|
Author: eFfeM Date: 2008-04-20 12:13:30 +0200 (Sun, 20 Apr 2008) New Revision: 973 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c Log: sorted include files, curlies on separate line (yes I am a little bit a freak) Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-04-20 10:07:17 UTC (rev 972) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c 2008-04-20 10:13:30 UTC (rev 973) @@ -19,30 +19,26 @@ */ #include <stdio.h> -#include <stdlib.h> -#include <time.h> -#include <string.h> -#include <errno.h> -#include "tux_usb.h" +#include "log.h" +#include "tux_battery.h" +#include "tux_cmd_parser.h" +#include "tux_descriptor.h" #include "tux_error.h" +#include "tux_eyes.h" +#include "tux_firmware.h" #include "tux_hw_status.h" -#include "tux_descriptor.h" -#include "tux_firmware.h" -#include "tux_wings.h" -#include "tux_spinning.h" -#include "tux_user_inputs.h" +#include "tux_id.h" +#include "tux_leds.h" +#include "tux_light.h" +#include "tux_misc.h" #include "tux_mouth.h" -#include "tux_eyes.h" -#include "tux_battery.h" -#include "tux_light.h" -#include "tux_leds.h" -#include "tux_id.h" #include "tux_pong.h" -#include "tux_cmd_parser.h" #include "tux_sound_flash.h" +#include "tux_user_inputs.h" +#include "tux_spinning.h" +#include "tux_usb.h" +#include "tux_wings.h" #include "version.h" -#include "log.h" -#include "tux_misc.h" static bool driver_started = false; static simple_callback_t end_cycle_funct; @@ -104,7 +100,8 @@ header = data[0]; ret = tux_hw_status_parse_frame(data); - if (ret == -1) { + if (ret == -1) + { log_warning("STATUS FRAME : %.2x %.2x %.2x %.2x", data[0], data[1], @@ -112,7 +109,8 @@ data[3]); } - switch (header) { + switch (header) + { /* Descriptor frames */ case FRAME_HEADER_VERSION: tux_firmware_update_version(); @@ -128,27 +126,31 @@ break; /* Status frames */ case FRAME_HEADER_PORTS: - if (header == ret) { + if (header == ret) + { tux_spinning_update_direction(); tux_mouth_update_position(); tux_eyes_update_position(); } break; case FRAME_HEADER_POSITION1: - if (header == ret) { + if (header == ret) + { tux_wings_update_movements_remaining(); tux_mouth_update_movements_remaining(); tux_eyes_update_movements_remaining(); } break; case FRAME_HEADER_POSITION2: - if (header == ret) { + if (header == ret) + { tux_wings_update_position(); tux_spinning_update_movements_remaining(); } break; case FRAME_HEADER_SENSORS1: - if (header == ret) { + if (header == ret) + { tux_sound_flash_update_flash_play(); tux_sound_flash_update_general_play(); tux_user_inputs_update_head_button(); @@ -165,21 +167,27 @@ case FRAME_HEADER_BATTERY: tux_user_inputs_update_charger_state(); if (header == ret) + { tux_battery_update_level(); + } break; case FRAME_HEADER_LIGHT: if (header == ret) + { tux_light_update_level(); + } break; case FRAME_HEADER_LED: - if (header == ret) { + if (header == ret) + { tux_leds_update_left(); tux_leds_update_right(); } break; /* Don't work ... case FRAME_HEADER_FLASH_PROG: - if (header == ret) { + if (header == ret) + { tux_sound_flash_update_prog_current_track(); tux_sound_flash_update_prog_last_track_size(); } @@ -199,7 +207,8 @@ on_rf_state(unsigned char state) { tux_sw_status_set_value(SW_ID_RF_STATE, (void *)&state, true); - if (state) { + if (state) + { tux_descriptor_get(); /* For reinitilizing the remote control task */ tux_user_inputs_init(); @@ -221,7 +230,9 @@ tux_cmd_parser_init(); tux_sw_status_set_value(SW_ID_DONGLE_PLUG, (void *)&state, true); if (dongle_connected_funct) + { dongle_connected_funct(); + } } /** @@ -233,7 +244,9 @@ bool state = false; tux_sw_status_set_value(SW_ID_DONGLE_PLUG, (void *)&state, true); if (dongle_disconnected_funct) + { dongle_disconnected_funct(); + } } /** @@ -249,7 +262,9 @@ tux_hw_status_header_counter_check(); if (end_cycle_funct) + { end_cycle_funct(); + } tux_cmd_parser_delay_stack_perform(); } @@ -260,10 +275,13 @@ LIBEXPORT TuxDrvError TuxDrv_PerformCommand(double delay, char *cmd_str) { - if (delay == 0.0) { + if (delay == 0.0) + { log_debug("Perform an instant command : [%s]", cmd_str); return tux_cmd_parser_parse_command(cmd_str); - } else { + } + else + { log_debug("Perform a delayed command : [%s], %f", cmd_str, delay); return tux_cmd_parser_insert_delay_command(delay, cmd_str, false); } @@ -457,7 +475,8 @@ tux_usb_set_loop_cycle_complete_callback(on_read_loop_cycle_complete); driver_started = true; - while (driver_started) { + while (driver_started) + { tux_usb_start(); sleep(1); } |
From: eFfeM <c2m...@c2...> - 2008-04-20 10:07:16
|
Author: eFfeM Date: 2008-04-20 12:07:17 +0200 (Sun, 20 Apr 2008) New Revision: 972 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.h Log: layout changes, removed unneeded includes Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.c 2008-04-19 17:10:33 UTC (rev 971) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.c 2008-04-20 10:07:17 UTC (rev 972) @@ -18,14 +18,13 @@ * 02111-1307, USA. */ +#include <errno.h> #include <stdio.h> -#include <errno.h> #include <string.h> -#include <stdlib.h> + +#include "tux_descriptor.h" #include "tux_usb.h" -#include "tux_descriptor.h" #include "tux_sw_status.h" -#include "log.h" /** * @@ -64,21 +63,25 @@ sprintf(descriptor, "Tux droid descriptor\n--------------------\n\n"); /* Firmware descriptors */ - tux_firmware_dump_descriptor(descriptor); + tux_firmware_dump_descriptor(descriptor); /* Sound flash descriptor */ - tux_sound_flash_dump_descriptor(descriptor); + tux_sound_flash_dump_descriptor(descriptor); /* ID connection descriptor */ - tux_id_dump_descriptor(descriptor); + tux_id_dump_descriptor(descriptor); desc_file = fopen(DESCRIPTOR_FILE_PATH, "w"); - if (desc_file) { + if (desc_file) + { fprintf(desc_file, "%s\n", descriptor); fclose(desc_file); - } else - printf("file error %s\n", strerror(errno)); + } + else + { + printf("file error %s\n", strerror(errno)); + } } /** @@ -91,11 +94,17 @@ f = fopen("./lock_tux", "r"); - if (f) { - if (tux_firmware_check_new_descriptor(false) || tux_sound_flash_check_new_descriptor(false)) + if (f) + { + if (tux_firmware_check_new_descriptor(false) + || tux_sound_flash_check_new_descriptor(false)) + { tux_usb_reset(); + } fclose(f); - } else { + } + else + { tux_firmware_check_new_descriptor(true); tux_sound_flash_check_new_descriptor(true); } Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.h 2008-04-19 17:10:33 UTC (rev 971) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.h 2008-04-20 10:07:17 UTC (rev 972) @@ -21,7 +21,6 @@ #ifndef _TUX_DESCRIPTOR_H_ #define _TUX_DESCRIPTOR_H_ -#include "tux_misc.h" #include "tux_firmware.h" #include "tux_sound_flash.h" #include "tux_id.h" |
From: eFfeM <c2m...@c2...> - 2008-04-19 17:10:35
|
Author: eFfeM Date: 2008-04-19 19:10:33 +0200 (Sat, 19 Apr 2008) New Revision: 971 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.h Log: intermediate commit (cleanup, some optimisations) this one is fully functional but I will be working some more on it Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-04-19 15:28:53 UTC (rev 970) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-04-19 17:10:33 UTC (rev 971) @@ -18,35 +18,47 @@ * 02111-1307, USA. */ +#include <errno.h> +#include <stdlib.h> #include <stdio.h> -#include <stdlib.h> +#include <string.h> #include <time.h> -#include <string.h> -#include <errno.h> + #ifdef USE_MUTEX # include "threading_uniform.h" #endif -#include "tux_misc.h" + +#include "log.h" +#include "tux_audio.h" #include "tux_cmd_parser.h" -#include "tux_usb.h" +#include "tux_error.h" #include "tux_eyes.h" +#include "tux_leds.h" +#include "tux_misc.h" #include "tux_mouth.h" -#include "tux_wings.h" +#include "tux_sound_flash.h" #include "tux_spinning.h" +#include "tux_usb.h" #include "tux_user_inputs.h" -#include "tux_leds.h" -#include "tux_sound_flash.h" -#include "tux_audio.h" -#include "log.h" -#include "tux_error.h" +#include "tux_wings.h" +#define CMDSIZE 1024 +#define NRCMDS 256 + +#define match_token(t_num, str, t_count) (i >= t_count) &&\ + (!strcmp(tokens[t_num], str)) +#define check_result(funct_res) if (funct_res) \ + return E_TUXDRV_NOERROR; \ + else \ + return E_TUXDRV_INVALIDPARAMETER; + typedef struct { double timeout; - char cmd[1024]; + char cmd[CMDSIZE]; } delay_cmd_t; typedef struct { - delay_cmd_t cmd_list[256]; + delay_cmd_t cmd_list[NRCMDS]; int cmd_count; } cmd_stack_t; @@ -94,6 +106,10 @@ p = src_str; + /* the implementation below is build upon strncpy + it might be more efficient/cleaner to use strtok + */ + if (p) { while (1) @@ -128,15 +144,25 @@ int r = 0; if (hex_to_uint8(p0, &data[0])) + { r++; + } if (hex_to_uint8(p1, &data[1])) + { r++; + } if (hex_to_uint8(p2, &data[2])) + { r++; + } if (hex_to_uint8(p3, &data[3])) + { r++; + } if (hex_to_uint8(p4, &data[4])) + { r++; + } if (r < TUX_SEND_LENGTH) return false; @@ -144,13 +170,6 @@ return tux_usb_send_raw(data); } -#define match_token(t_num, str, t_count) (i >= t_count) &&\ - (!strcmp(tokens[t_num], str)) -#define check_result(funct_res) if (funct_res) \ - return E_TUXDRV_NOERROR; \ - else \ - return E_TUXDRV_INVALIDPARAMETER; - /** * Parse a command. */ @@ -162,152 +181,199 @@ /* If the parser is not enabled then fail */ if (!cmd_parser_enable) + { return E_TUXDRV_PARSERISDISABLED; + } log_debug("Parse command : [%s]", cmd_str); i = tux_cmd_parser_get_tokens(cmd_str, &tokens, 32); /* If no tokens in the command then fail */ - if (i <= 0) { + if (i <= 0) + { return E_TUXDRV_INVALIDCOMMAND; } /* Command to tux */ - if (match_token(0, "TUX_CMD", 1)) { + if (match_token(0, "TUX_CMD", 1)) + { /* EYES commands */ - if (match_token(1, "EYES", 2)) { + if (match_token(1, "EYES", 2)) + { /* EYES ON */ - if (match_token(2, "ON", 5)) { + if (match_token(2, "ON", 5)) + { check_result(tux_eyes_cmd_on(tokens[3], tokens[4])); /* EYES ON_DURING */ - } else if (match_token(2, "ON_DURING", 5)) { + } else if (match_token(2, "ON_DURING", 5)) + { check_result(tux_eyes_cmd_on_during(tokens[3], tokens[4])); /* EYES OPEN */ - } else if (match_token(2, "OPEN", 3)) { + } else if (match_token(2, "OPEN", 3)) + { check_result(tux_eyes_cmd_open()); /* EYES CLOSE */ - } else if (match_token(2, "CLOSE", 3)) { + } else if (match_token(2, "CLOSE", 3)) + { check_result(tux_eyes_cmd_close()); /* EYES OFF */ - } else if (match_token(2, "OFF", 3)) { + } else if (match_token(2, "OFF", 3)) + { check_result(tux_eyes_cmd_off()); } /* MOUTH commands */ - } else if (match_token(1, "MOUTH", 2)) { + } else if (match_token(1, "MOUTH", 2)) + { /* MOUTH ON */ - if (match_token(2, "ON", 5)) { + if (match_token(2, "ON", 5)) + { check_result(tux_mouth_cmd_on(tokens[3], tokens[4])); /* MOUTH ON_DURING */ - } else if (match_token(2, "ON_DURING", 5)) { + } else if (match_token(2, "ON_DURING", 5)) + { check_result(tux_mouth_cmd_on_during(tokens[3], tokens[4])); /* MOUTH OPEN */ - } else if (match_token(2, "OPEN", 3)) { + } else if (match_token(2, "OPEN", 3)) + { check_result(tux_mouth_cmd_open()); /* MOUTH CLOSE */ - } else if (match_token(2, "CLOSE", 3)) { + } else if (match_token(2, "CLOSE", 3)) + { check_result(tux_mouth_cmd_close()); /* MOUTH OFF */ - } else if (match_token(2, "OFF", 3)) { + } else if (match_token(2, "OFF", 3)) + { check_result(tux_mouth_cmd_off()); } /* WINGS commands */ - } else if (match_token(1, "WINGS", 2)) { + } else if (match_token(1, "WINGS", 2)) + { /* WINGS ON */ - if (match_token(2, "ON", 5)) { + if (match_token(2, "ON", 5)) + { check_result(tux_wings_cmd_on(tokens[3], tokens[4])); /* WINGS ON_DURING */ - } else if (match_token(2, "ON_DURING", 5)) { + } else if (match_token(2, "ON_DURING", 5)) + { check_result(tux_wings_cmd_on_during(tokens[3], tokens[4])); /* WINGS OPEN */ - } else if (match_token(2, "UP", 3)) { + } else if (match_token(2, "UP", 3)) + { check_result(tux_wings_cmd_up()); /* WINGS CLOSE */ - } else if (match_token(2, "DOWN", 3)) { + } else if (match_token(2, "DOWN", 3)) + { check_result(tux_wings_cmd_down()); /* WINGS OFF */ - } else if (match_token(2, "OFF", 3)) { + } else if (match_token(2, "OFF", 3)) + { check_result(tux_wings_cmd_off()); /* WINGS SPEED */ - } else if (match_token(2, "SPEED", 4)) { + } else if (match_token(2, "SPEED", 4)) + { check_result(tux_wings_cmd_speed(tokens[3])); } /* SPINNING commands */ - } else if (match_token(1, "SPINNING", 2)) { + } else if (match_token(1, "SPINNING", 2)) + { /* SPINNING SPEED */ - if (match_token(2, "SPEED", 4)) { + if (match_token(2, "SPEED", 4)) + { check_result(tux_spinning_cmd_speed(tokens[3])); /* SPINNING LEFT ON */ - } else if (match_token(2, "LEFT_ON", 4)) { + } else if (match_token(2, "LEFT_ON", 4)) + { check_result(tux_spinning_cmd_left_on(tokens[3])); /* SPINNING RIGHT ON */ - } else if (match_token(2, "RIGHT_ON", 4)) { + } else if (match_token(2, "RIGHT_ON", 4)) + { check_result(tux_spinning_cmd_right_on(tokens[3])); /* SPINNING LEFT ON DURING */ - } else if (match_token(2, "LEFT_ON_DURING", 4)) { + } else if (match_token(2, "LEFT_ON_DURING", 4)) + { check_result(tux_spinning_cmd_left_on_during(tokens[3])); /* SPINNING RIGHT ON DURING */ - } else if (match_token(2, "RIGHT_ON_DURING", 4)) { + } else if (match_token(2, "RIGHT_ON_DURING", 4)) + { check_result(tux_spinning_cmd_right_on_during(tokens[3])); /* SPINNING OFF */ - } else if (match_token(2, "OFF", 3)) { + } else if (match_token(2, "OFF", 3)) + { check_result(tux_spinning_cmd_off()); } /* IR commands */ - } else if (match_token(1, "IR", 2)) { + } else if (match_token(1, "IR", 2)) + { /* IR ON */ - if (match_token(2, "ON", 3)) { + if (match_token(2, "ON", 3)) + { check_result(tux_user_inputs_cmd_ir_on()); /* IR OFF */ - } else if (match_token(2, "OFF", 3)) { + } else if (match_token(2, "OFF", 3)) + { check_result(tux_user_inputs_cmd_ir_off()); /* IR SEND */ - } else if (match_token(2, "SEND", 5)) { + } else if (match_token(2, "SEND", 5)) + { check_result(tux_user_inputs_cmd_ir_send(tokens[3], tokens[4])); } /* LED commands */ - } else if (match_token(1, "LED", 2)) { + } else if (match_token(1, "LED", 2)) + { /* LED SET */ - if (match_token(2, "SET", 8)) { + if (match_token(2, "SET", 8)) + { check_result(tux_leds_cmd_set(tokens[3], tokens[4], tokens[5], tokens[6], tokens[7])); /* LED ON */ - } else if (match_token(2, "ON", 5)) { + } else if (match_token(2, "ON", 5)) + { check_result(tux_leds_cmd_set(tokens[3], tokens[4], "NONE", "0", "0")); /* LED OFF */ - } else if (match_token(2, "OFF", 4)) { + } else if (match_token(2, "OFF", 4)) + { check_result(tux_leds_cmd_set(tokens[3], "0.0", "NONE", "0", "0")); /* LED PULSE */ - } else if (match_token(2, "PULSE", 11)) { + } else if (match_token(2, "PULSE", 11)) + { check_result(tux_leds_cmd_pulse(tokens[3], tokens[4], tokens[5], tokens[6], tokens[7], tokens[8], tokens[9], tokens[10])); /* LED BLINK */ - } else if (match_token(2, "BLINK", 6)) { + } else if (match_token(2, "BLINK", 6)) + { check_result(tux_leds_cmd_pulse(tokens[3], "0.0", "1.0", tokens[4], tokens[5], "NONE", "0", "0")); } /* SOUND FLASH commands */ - } else if (match_token(1, "SOUND_FLASH", 2)) { + } else if (match_token(1, "SOUND_FLASH", 2)) + { /* SOUND FLASH PLAY */ - if (match_token(2, "PLAY", 5)) { + if (match_token(2, "PLAY", 5)) + { check_result(tux_sound_flash_cmd_play(tokens[3], tokens[4])); } /* AUDIO commands */ - } else if (match_token(1, "AUDIO", 2)) { + } else if (match_token(1, "AUDIO", 2)) + { /* CHANNEL GENERAL */ - if (match_token(2, "CHANNEL_GENERAL", 3)) { + if (match_token(2, "CHANNEL_GENERAL", 3)) + { check_result(tux_audio_cmd_channel_general()); /* CHANNEL TTS */ - } else if (match_token(2, "CHANNEL_TTS", 3)) { + } else if (match_token(2, "CHANNEL_TTS", 3)) + { check_result(tux_audio_cmd_channel_tts()); /* MUTE */ - } else if (match_token(2, "MUTE", 4)) { + } else if (match_token(2, "MUTE", 4)) + { check_result(tux_audio_cmd_mute(tokens[3])); } } /* Command raw to fux dongle or tux */ - } else if (match_token(0, "RAW_CMD", 6)) { + } else if (match_token(0, "RAW_CMD", 6)) + { check_result(tux_cmd_parser_parse_raw_cmd(tokens[1], tokens[2], tokens[3], tokens[4], tokens[5])); } @@ -321,39 +387,44 @@ tux_cmd_parser_insert_delay_command(float delay, char *cmd_str, bool sys_cmd) { TuxDrvError ret = E_TUXDRV_STACKOVERFLOW; - int free_idx = -1; int i; + double curtime = get_time(); + #ifdef USE_MUTEX mutex_lock(__stack_mutex); #endif - if (sys_cmd) { - for (i = 0; i < 256; i++) - if (!strcmp(sys_cmd_stack.cmd_list[i].cmd, "")) { - free_idx = i; + + if (sys_cmd) + { + for (i = 0; i < NRCMDS; i++) + { + if (!strcmp(sys_cmd_stack.cmd_list[i].cmd, "")) + { + sprintf(sys_cmd_stack.cmd_list[i].cmd, cmd_str); + sys_cmd_stack.cmd_list[i].timeout = delay + curtime; + ret = E_TUXDRV_NOERROR; break; } - - if (free_idx != -1) { - sprintf(sys_cmd_stack.cmd_list[free_idx].cmd, cmd_str); - sys_cmd_stack.cmd_list[free_idx].timeout = delay + get_time(); - ret = E_TUXDRV_NOERROR; - } - } else { - for (i = 0; i < 256; i++) - if (!strcmp(user_cmd_stack.cmd_list[i].cmd, "")) { - free_idx = i; + } + } + else + { + for (i = 0; i < NRCMDS; i++) + { + if (!strcmp(user_cmd_stack.cmd_list[i].cmd, "")) + { + sprintf(user_cmd_stack.cmd_list[i].cmd, cmd_str); + user_cmd_stack.cmd_list[i].timeout = delay + curtime; + ret = E_TUXDRV_NOERROR; break; } - - if (free_idx != -1) { - sprintf(user_cmd_stack.cmd_list[free_idx].cmd, cmd_str); - user_cmd_stack.cmd_list[free_idx].timeout = delay + get_time(); - ret = E_TUXDRV_NOERROR; - } + } } + #ifdef USE_MUTEX mutex_unlock(__stack_mutex); #endif + return ret; } @@ -368,18 +439,26 @@ #ifdef USE_MUTEX mutex_lock(__stack_mutex); #endif + /* Clear user cmd */ memset(&user_cmd_stack, 0, sizeof(cmd_stack_t)); + /* Clear system cmd */ - for (i = 0; i < 256; i++) - if (strcmp(sys_cmd_stack.cmd_list[i].cmd, "")) { + for (i = 0; i < NRCMDS; i++) + { + if (strcmp(sys_cmd_stack.cmd_list[i].cmd, "")) + { tux_cmd_parser_parse_command(sys_cmd_stack.cmd_list[i].cmd); memset(&sys_cmd_stack.cmd_list[i], 0, sizeof(delay_cmd_t)); } + } + memset(&sys_cmd_stack, 0, sizeof(cmd_stack_t)); + #ifdef USE_MUTEX mutex_unlock(__stack_mutex); #endif + return true; } @@ -390,22 +469,32 @@ tux_cmd_parser_delay_stack_perform(void) { int i; + double curtime = get_time(); #ifdef USE_MUTEX mutex_lock(__stack_mutex); #endif - for (i = 0; i < 256; i++) { + + for (i = 0; i < NRCMDS; i++) + { if (strcmp(user_cmd_stack.cmd_list[i].cmd, "")) - if (get_time() >= user_cmd_stack.cmd_list[i].timeout) { + { + if (curtime >= user_cmd_stack.cmd_list[i].timeout) + { tux_cmd_parser_parse_command(user_cmd_stack.cmd_list[i].cmd); memset(&user_cmd_stack.cmd_list[i], 0, sizeof(delay_cmd_t)); } + } if (strcmp(sys_cmd_stack.cmd_list[i].cmd, "")) - if (get_time() >= sys_cmd_stack.cmd_list[i].timeout) { + { + if (curtime >= sys_cmd_stack.cmd_list[i].timeout) + { tux_cmd_parser_parse_command(sys_cmd_stack.cmd_list[i].cmd); memset(&sys_cmd_stack.cmd_list[i], 0, sizeof(delay_cmd_t)); } + } } + #ifdef USE_MUTEX mutex_unlock(__stack_mutex); #endif @@ -418,13 +507,15 @@ parse_line(char *line_str) { float delay= 0.0; - char cmd_str[1024] = ""; + char cmd_str[CMDSIZE] = ""; int i; i = sscanf(line_str, "%f:%[^\n]", &delay, cmd_str); if (i == 2) + { return tux_cmd_parser_insert_delay_command(delay, cmd_str, false); + } return E_TUXDRV_NOERROR; } @@ -445,24 +536,31 @@ #ifdef USE_MUTEX mutex_lock(__macro_mutex); #endif + strcpy(macro, macro_str); - if ((line_tmp = strtok(macro, lex_ret)) != NULL) { - + if ((line_tmp = strtok(macro, lex_ret)) != NULL) + { ret = parse_line(line_tmp); if (ret != E_TUXDRV_NOERROR) + { result = ret; + } - while ((line_tmp = strtok(NULL, lex_ret)) != NULL) { + while ((line_tmp = strtok(NULL, lex_ret)) != NULL) + { ret = parse_line(line_tmp); - if (ret != E_TUXDRV_NOERROR) { + if (ret != E_TUXDRV_NOERROR) + { result = ret; break; } } } + #ifdef USE_MUTEX mutex_unlock(__macro_mutex); #endif + return result; } @@ -472,7 +570,7 @@ LIBLOCAL TuxDrvError tux_cmd_parser_parse_file(char *file_path) { - char line[1024] = ""; + char line[CMDSIZE] = ""; FILE *macro_file; TuxDrvError ret; TuxDrvError result = E_TUXDRV_NOERROR; @@ -482,19 +580,27 @@ #endif macro_file = fopen(file_path, "r"); - if (macro_file) { - while (!feof(macro_file)) { + if (macro_file) + { + while (!feof(macro_file)) + { fgets(line, sizeof(line)-2, macro_file); ret = parse_line(line); if (ret != E_TUXDRV_NOERROR) + { result = ret; + } } fclose(macro_file); - } else + } + else + { result = E_TUXDRV_FILEERROR; + } #ifdef USE_MUTEX mutex_unlock(__macro_mutex); #endif + return result; } Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.h 2008-04-19 15:28:53 UTC (rev 970) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.h 2008-04-19 17:10:33 UTC (rev 971) @@ -25,9 +25,12 @@ #include "tux_misc.h" #include "tux_error.h" -typedef char token_str_t[1024]; -typedef token_str_t tokens_t[256]; +#define TOKENSIZE 1024 +#define MAXNRTOKENS 256 +typedef char token_str_t[TOKENSIZE]; +typedef token_str_t tokens_t[MAXNRTOKENS]; + extern void tux_cmd_parser_init(void); extern void tux_cmd_parser_set_enable(bool value); extern int tux_cmd_parser_get_tokens(char *src_str, tokens_t *toks, |
From: eFfeM <c2m...@c2...> - 2008-04-19 15:28:51
|
Author: eFfeM Date: 2008-04-19 17:28:53 +0200 (Sat, 19 Apr 2008) New Revision: 970 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/usb.h Log: aligned constants Modified: software_suite_v2/middleware/tuxdriver/trunk/src/usb.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/usb.h 2008-04-19 15:23:15 UTC (rev 969) +++ software_suite_v2/middleware/tuxdriver/trunk/src/usb.h 2008-04-19 15:28:53 UTC (rev 970) @@ -4,6 +4,9 @@ #include <stdlib.h> #include <windows.h> +/* ensure byte-packed structures */ +#include <pshpack1.h> + /* * 'interface' is defined somewhere in the Windows header files. This macro * is deleted here to avoid conflicts and compile errors. @@ -31,14 +34,14 @@ /* * Device and/or Interface Class codes */ -#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ -#define USB_CLASS_AUDIO 1 -#define USB_CLASS_COMM 2 -#define USB_CLASS_HID 3 -#define USB_CLASS_PRINTER 7 -#define USB_CLASS_MASS_STORAGE 8 -#define USB_CLASS_HUB 9 -#define USB_CLASS_DATA 10 +#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ +#define USB_CLASS_AUDIO 1 +#define USB_CLASS_COMM 2 +#define USB_CLASS_HID 3 +#define USB_CLASS_PRINTER 7 +#define USB_CLASS_MASS_STORAGE 8 +#define USB_CLASS_HUB 9 +#define USB_CLASS_DATA 10 #define USB_CLASS_VENDOR_SPEC 0xff /* @@ -47,12 +50,12 @@ #define USB_DT_DEVICE 0x01 #define USB_DT_CONFIG 0x02 #define USB_DT_STRING 0x03 -#define USB_DT_INTERFACE 0x04 -#define USB_DT_ENDPOINT 0x05 +#define USB_DT_INTERFACE 0x04 +#define USB_DT_ENDPOINT 0x05 #define USB_DT_HID 0x21 -#define USB_DT_REPORT 0x22 -#define USB_DT_PHYSICAL 0x23 +#define USB_DT_REPORT 0x22 +#define USB_DT_PHYSICAL 0x23 #define USB_DT_HUB 0x29 /* @@ -66,10 +69,7 @@ #define USB_DT_HUB_NONVAR_SIZE 7 -/* ensure byte-packed structures */ -#include <pshpack1.h> - /* All standard descriptors have these 2 fields in common */ struct usb_descriptor_header { unsigned char bLength; @@ -191,19 +191,19 @@ /* * Standard requests */ -#define USB_REQ_GET_STATUS 0x00 -#define USB_REQ_CLEAR_FEATURE 0x01 +#define USB_REQ_GET_STATUS 0x00 +#define USB_REQ_CLEAR_FEATURE 0x01 /* 0x02 is reserved */ -#define USB_REQ_SET_FEATURE 0x03 +#define USB_REQ_SET_FEATURE 0x03 /* 0x04 is reserved */ -#define USB_REQ_SET_ADDRESS 0x05 +#define USB_REQ_SET_ADDRESS 0x05 #define USB_REQ_GET_DESCRIPTOR 0x06 #define USB_REQ_SET_DESCRIPTOR 0x07 #define USB_REQ_GET_CONFIGURATION 0x08 #define USB_REQ_SET_CONFIGURATION 0x09 -#define USB_REQ_GET_INTERFACE 0x0A -#define USB_REQ_SET_INTERFACE 0x0B -#define USB_REQ_SYNCH_FRAME 0x0C +#define USB_REQ_GET_INTERFACE 0x0A +#define USB_REQ_SET_INTERFACE 0x0B +#define USB_REQ_SYNCH_FRAME 0x0C #define USB_TYPE_STANDARD (0x00 << 5) #define USB_TYPE_CLASS (0x01 << 5) @@ -211,8 +211,8 @@ #define USB_TYPE_RESERVED (0x03 << 5) #define USB_RECIP_DEVICE 0x00 -#define USB_RECIP_INTERFACE 0x01 -#define USB_RECIP_ENDPOINT 0x02 +#define USB_RECIP_INTERFACE 0x01 +#define USB_RECIP_ENDPOINT 0x02 #define USB_RECIP_OTHER 0x03 /* |
From: eFfeM <c2m...@c2...> - 2008-04-19 15:23:18
|
Author: eFfeM Date: 2008-04-19 17:23:15 +0200 (Sat, 19 Apr 2008) New Revision: 969 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c Log: added curlies, reordered includes Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c 2008-04-19 15:18:11 UTC (rev 968) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c 2008-04-19 15:23:15 UTC (rev 969) @@ -18,12 +18,12 @@ * 02111-1307, USA. */ +#include <errno.h> #include <stdio.h> -#include <errno.h> +#include <stdlib.h> #include <string.h> -#include <stdlib.h> +#include "tux_audio.h" #include "tux_hw_cmd.h" -#include "tux_audio.h" #include "tux_usb.h" /** Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-04-19 15:18:11 UTC (rev 968) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-04-19 15:23:15 UTC (rev 969) @@ -18,21 +18,21 @@ * 02111-1307, USA. */ +#include <errno.h> +#include <math.h> #include <stdio.h> -#include <errno.h> +#include <stdlib.h> #include <string.h> -#include <stdlib.h> -#include <math.h> +#include "tux_battery.h" #include "tux_hw_status.h" #include "tux_sw_status.h" -#include "tux_battery.h" typedef enum { FULL, HIGH, LOW, - EMPTY, + EMPTY } battery_state_t; static battery_state_t battery_state = EMPTY; @@ -56,37 +56,58 @@ old_level = *(float *)tux_sw_status_get_value(SW_ID_BATTERY_LEVEL); - if (fabs(new_level - last_level_for_event) > 0.1) { + if (fabs(new_level - last_level_for_event) > 0.1) + { last_level_for_event = new_level; if (!hw_status_table.battery.motors_state) + { tux_sw_status_set_value(SW_ID_BATTERY_LEVEL, (void *)&new_level, true); + } - if (new_level >= TUX_BATTERY_FULL_VALUE) { + if (new_level >= TUX_BATTERY_FULL_VALUE) + { new_state_str = STRING_VALUE_FULL; battery_state = FULL; - } else if ((new_level < TUX_BATTERY_FULL_VALUE) && - (new_level >= TUX_BATTERY_HIGH_VALUE)) - { - new_state_str = STRING_VALUE_HIGH; - battery_state = HIGH; - } else if ((new_level < TUX_BATTERY_HIGH_VALUE) && - (new_level >= TUX_BATTERY_LOW_VALUE)) - { - new_state_str = STRING_VALUE_LOW; - battery_state = LOW; - } else { - new_state_str = STRING_VALUE_EMPTY; - battery_state = EMPTY; } + else + { + if ((new_level < TUX_BATTERY_FULL_VALUE) && + (new_level >= TUX_BATTERY_HIGH_VALUE)) + { + new_state_str = STRING_VALUE_HIGH; + battery_state = HIGH; + } + else + { + if ((new_level < TUX_BATTERY_HIGH_VALUE) && + (new_level >= TUX_BATTERY_LOW_VALUE)) + { + new_state_str = STRING_VALUE_LOW; + battery_state = LOW; + } + else + { + new_state_str = STRING_VALUE_EMPTY; + battery_state = EMPTY; + } + } + } old_state_str = (char *)tux_sw_status_get_value(SW_ID_BATTERY_STATE); if (strcmp(new_state_str, old_state_str)) + { tux_sw_status_set_value(SW_ID_BATTERY_STATE, (void *)new_state_str, true); - } else + } + } + else + { if (old_level != new_level) + { tux_sw_status_set_value(SW_ID_BATTERY_LEVEL, (void *)&new_level, false); + } + } } |
From: eFfeM <c2m...@c2...> - 2008-04-19 15:18:08
|
Author: eFfeM Date: 2008-04-19 17:18:11 +0200 (Sat, 19 Apr 2008) New Revision: 968 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/log.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.h Log: Some cosmetical changes Modified: software_suite_v2/middleware/tuxdriver/trunk/src/log.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/log.c 2008-04-19 15:00:37 UTC (rev 967) +++ software_suite_v2/middleware/tuxdriver/trunk/src/log.c 2008-04-19 15:18:11 UTC (rev 968) @@ -78,7 +78,9 @@ case LOG_TARGET_TUX: log_file = fopen(LOG_FILE, "at"); if (log_file == NULL) + { return false; + } break; case LOG_TARGET_SHELL: @@ -221,9 +223,13 @@ case LOG_TARGET_SHELL: if (at_level == LOG_LEVEL_WARNING || at_level == LOG_LEVEL_ERROR) + { fprintf(stderr, "tux_driver: %s\n", text); + } else + { fprintf(stdout, "tux_driver: %s\n", text); + } break; } Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c 2008-04-19 15:00:37 UTC (rev 967) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c 2008-04-19 15:18:11 UTC (rev 968) @@ -32,8 +32,8 @@ LIBLOCAL bool tux_audio_cmd_channel_general(void) { - unsigned char frame[TUX_SEND_LENGTH - 1] = {USB_DONGLE_AUDIO_CMD, - 0, 0, 0}; + unsigned char frame[TUX_SEND_LENGTH - 1] = + {USB_DONGLE_AUDIO_CMD, 0, 0, 0}; return tux_usb_send_to_dongle(frame); } @@ -43,8 +43,8 @@ LIBLOCAL bool tux_audio_cmd_channel_tts(void) { - unsigned char frame[TUX_SEND_LENGTH - 1] = {USB_DONGLE_AUDIO_CMD, - 1, 0, 0}; + unsigned char frame[TUX_SEND_LENGTH - 1] = + {USB_DONGLE_AUDIO_CMD, 1, 0, 0}; return tux_usb_send_to_dongle(frame); } @@ -54,17 +54,23 @@ LIBLOCAL bool tux_audio_cmd_mute(char *value) { - unsigned char frame[TUX_SEND_LENGTH - 1] = {AUDIO_MUTE_CMD, - 0, 0, 0}; + unsigned char frame[TUX_SEND_LENGTH - 1] = + {AUDIO_MUTE_CMD, 0, 0, 0}; bool m_value; if (!str_to_bool(value, &m_value)) + { return false; + } if (m_value) + { frame[1] = 1; + } else + { frame[1] = 0; + } return tux_usb_send_to_tux(frame); } Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.h 2008-04-19 15:00:37 UTC (rev 967) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.h 2008-04-19 15:18:11 UTC (rev 968) @@ -21,7 +21,7 @@ #ifndef _TUX_AUDIO_H_ #define _TUX_AUDIO_H_ -#include "tux_misc.h" +#include <stdbool.h> extern bool tux_audio_cmd_channel_general(void); extern bool tux_audio_cmd_channel_tts(void); |
From: eFfeM <c2m...@c2...> - 2008-04-19 15:00:41
|
Author: eFfeM Date: 2008-04-19 17:00:37 +0200 (Sat, 19 Apr 2008) New Revision: 967 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/log.c Log: few small cleanups Modified: software_suite_v2/middleware/tuxdriver/trunk/src/log.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/log.c 2008-04-19 13:02:09 UTC (rev 966) +++ software_suite_v2/middleware/tuxdriver/trunk/src/log.c 2008-04-19 15:00:37 UTC (rev 967) @@ -69,7 +69,9 @@ log_open(log_target_t target) { if (log_opened) + { return true; + } switch (target) { @@ -96,7 +98,9 @@ log_close(void) { if (!log_opened) + { return; + } switch (log_target) { @@ -158,13 +162,17 @@ /* No need for the log to be 'opened' when logging to std{out,err} */ if (log_target != LOG_TARGET_SHELL && !log_opened) + { return false; + } /* Logging at level NONE has no sense */ assert(at_level >= LOG_LEVEL_DEBUG && at_level < LOG_LEVEL_NONE); if (at_level < current_level) + { return true; + } /* Add date & time when LOG_TARGET_TUX */ if (log_target == LOG_TARGET_TUX) @@ -176,7 +184,9 @@ r = strftime(p, size, "%F %T ", localtime(&now)); #endif if (r == 0) + { return false; + } p += r; size -= r; @@ -187,7 +197,9 @@ { r = snprintf(p, size, "%s: ", level_names[at_level]); if (r < 0) + { return false; + } p += r; size -= r; @@ -197,7 +209,9 @@ r = vsnprintf(p, size, fmt, al); va_end(al); if (r < 0) - return false; + { + return false; + } switch (log_target) { |
From: eFfeM <c2m...@c2...> - 2008-04-19 13:02:07
|
Author: eFfeM Date: 2008-04-19 15:02:09 +0200 (Sat, 19 Apr 2008) New Revision: 966 Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c Log: rewrote tux_cmd_parser_get_tokens Modified: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-04-19 10:25:11 UTC (rev 965) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-04-19 13:02:09 UTC (rev 966) @@ -84,36 +84,38 @@ /** * */ -/* TODO : It has surely a better way to do this. */ LIBLOCAL int tux_cmd_parser_get_tokens(char *src_str, tokens_t *toks, int max_tokens) { - tokens_t tokens; - char tok[12] = "%[^:,]%[:,]"; - char toke[7] = "%[^\n]"; - char reg_ex[1024] = ""; - char ts[8] = ""; - int i; + char *p; + char *pnext; + int len; + int cnt = 0; - for (i = 0; i < (max_tokens - 1); i++) - strncat(reg_ex, tok, sizeof(tok) - 1); - - strncat(reg_ex, toke, sizeof(toke) - 1); - - i = sscanf(src_str, reg_ex, - tokens[0], ts, tokens[1], ts, tokens[2], ts, tokens[3], ts, - tokens[4], ts, tokens[5], ts, tokens[6], ts, tokens[7], ts, - tokens[8], ts, tokens[9], ts, tokens[10], ts, tokens[11], ts, - tokens[12], ts, tokens[13], ts, tokens[14], ts, tokens[15], ts, - tokens[16], ts, tokens[17], ts, tokens[18], ts, tokens[19], ts, - tokens[20], ts, tokens[21], ts, tokens[22], ts, tokens[23], ts, - tokens[24], ts, tokens[25], ts, tokens[26], ts, tokens[27], ts, - tokens[28], ts, tokens[29], ts, tokens[30], ts, tokens[31], ts); - - memcpy(toks, &tokens, sizeof(tokens_t)); - - i -= i / 2; - return i; + p = src_str; + + if (p) + { + while (1) + { + pnext = strpbrk(p, ":,"); + if (pnext) + { + len = pnext - p; + strncpy((*toks)[cnt], p,len); + ((*toks)[cnt])[len] = 0; + cnt++; + } + else + { + strcpy((*toks)[cnt], p); + cnt++; + break; + } + p = pnext+1; + } + } + return(cnt); } /** |
From: eFfeM <c2m...@c2...> - 2008-04-19 10:25:13
|
Author: eFfeM Date: 2008-04-19 12:25:11 +0200 (Sat, 19 Apr 2008) New Revision: 965 Modified: software_suite_v2/middleware/tuxdriver/trunk/test/main.c Log: added options to control level of output; added usage() function Modified: software_suite_v2/middleware/tuxdriver/trunk/test/main.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/test/main.c 2008-04-17 09:12:05 UTC (rev 964) +++ software_suite_v2/middleware/tuxdriver/trunk/test/main.c 2008-04-19 10:25:11 UTC (rev 965) @@ -18,16 +18,21 @@ * 02111-1307, USA. */ +#include <errno.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <time.h> -#include <string.h> -#include <errno.h> +#include <unistd.h> #ifdef WIN32 # include <windows.h> #endif + #include "../include/tux_driver.h" +static int print_descriptor = 0; +static int print_status = 0; + /** * */ @@ -128,22 +133,35 @@ } } - /* Tuxdroid descriptor is complete */ - if (!strcmp(tokens[0], "descriptor_complete")) - /* TuxDrv_GetDescriptor */ - if (!strcmp(tokens[2], "True")) { - TuxDrv_GetDescriptor(&tux_desc); - printf("%s\n", tux_desc.firmwares.package->version_string); - printf("%s\n", tux_desc.firmwares.tuxcore->version_string); - printf("%s\n", tux_desc.firmwares.tuxaudio->version_string); - printf("%s\n", tux_desc.firmwares.tuxrf->version_string); - printf("%s\n", tux_desc.firmwares.fuxrf->version_string); - printf("%s\n", tux_desc.firmwares.fuxusb->version_string); - printf("%s\n", tux_desc.driver.version_string); + if (print_descriptor) + { + /* Tuxdroid descriptor is complete */ + if (!strcmp(tokens[0], "descriptor_complete")) + { + /* TuxDrv_GetDescriptor */ + if (!strcmp(tokens[2], "True")) + { + TuxDrv_GetDescriptor(&tux_desc); + printf("%s\n", tux_desc.firmwares.package->version_string); + printf("%s\n", tux_desc.firmwares.tuxcore->version_string); + printf("%s\n", tux_desc.firmwares.tuxaudio->version_string); + printf("%s\n", tux_desc.firmwares.tuxrf->version_string); + printf("%s\n", tux_desc.firmwares.fuxrf->version_string); + printf("%s\n", tux_desc.firmwares.fuxusb->version_string); + printf("%s\n", tux_desc.driver.version_string); + } } + } - /* Print status string */ - printf("%s\n", status); + if (print_status) + { + + /* Print status string */ + if ((print_status > 1) || (strcmp(tokens[0], "light_level"))) + { + printf("%s\n", status); + } + } } /** @@ -154,6 +172,15 @@ { } +static void +usage(char *progname) +{ + fprintf(stderr, "Usage: %s [-d -s -S]\n", progname); + fprintf(stderr, " -d: prints descriptor\n"); + fprintf(stderr, " -s: prints status messages except light_senser\n"); + fprintf(stderr, " -S: prints all status messages\n"); +} + /** * Main function. */ @@ -162,12 +189,40 @@ int argc; char* argv[]; { + char ch; + char *progname = argv[0]; + + // option names are to be reconsidered + while ((ch = getopt(argc, argv, "dsS")) != -1) + { + switch (ch) { + case 'd': + print_descriptor = 1; + break; + case 's': + print_status = 1; + break; + case 'S': + print_status = 2; + break; + case '?': + default: + usage(progname); + } + } + argc -= optind; + argv += optind; + #ifdef WIN32 if (TuxDrv_InitDll("../win32/tux_driver.dll") == NULL) + { return -1; + } #else if (TuxDrv_InitDll("../unix/tux_driver.so") == NULL) + { return -1; + } #endif TuxDrv_SetLogLevel(LOG_LEVEL_ERROR); TuxDrv_SetLogTarget(LOG_TARGET_SHELL); |
Author: remi Date: 2008-04-17 11:12:05 +0200 (Thu, 17 Apr 2008) New Revision: 964 Added: software_suite_v2/middleware/tuxdriver/ software_suite_v2/middleware/tuxdriver/branches/ software_suite_v2/middleware/tuxdriver/tags/ software_suite_v2/middleware/tuxdriver/trunk/ software_suite_v2/middleware/tuxdriver/trunk/AUTHORS software_suite_v2/middleware/tuxdriver/trunk/COPYING software_suite_v2/middleware/tuxdriver/trunk/README software_suite_v2/middleware/tuxdriver/trunk/doc/ software_suite_v2/middleware/tuxdriver/trunk/doc/Notes.txt software_suite_v2/middleware/tuxdriver/trunk/doc/TuxSSV2-Middleware-Driver.odt software_suite_v2/middleware/tuxdriver/trunk/include/ software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.h software_suite_v2/middleware/tuxdriver/trunk/libs/ software_suite_v2/middleware/tuxdriver/trunk/libs/libusb.lib software_suite_v2/middleware/tuxdriver/trunk/obj/ software_suite_v2/middleware/tuxdriver/trunk/src/ software_suite_v2/middleware/tuxdriver/trunk/src/log.c software_suite_v2/middleware/tuxdriver/trunk/src/log.h software_suite_v2/middleware/tuxdriver/trunk/src/threading_uniform.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_descriptor.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_driver.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_error.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_error.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_eyes.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_firmware.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_hw_cmd.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_hw_status.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_hw_status.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_id.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_id.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_leds.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_light.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_misc.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_mouth.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_movements.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_pong.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sound_flash.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_spinning.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_sw_status.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_usb.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_user_inputs.h software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.c software_suite_v2/middleware/tuxdriver/trunk/src/tux_wings.h software_suite_v2/middleware/tuxdriver/trunk/src/usb.h software_suite_v2/middleware/tuxdriver/trunk/src/version.h software_suite_v2/middleware/tuxdriver/trunk/test/ software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.unix software_suite_v2/middleware/tuxdriver/trunk/test/Makefile.win32 software_suite_v2/middleware/tuxdriver/trunk/test/compile.bat software_suite_v2/middleware/tuxdriver/trunk/test/descriptor.txt software_suite_v2/middleware/tuxdriver/trunk/test/main.c software_suite_v2/middleware/tuxdriver/trunk/test/tada.wav software_suite_v2/middleware/tuxdriver/trunk/test/test_macro.txt software_suite_v2/middleware/tuxdriver/trunk/unix/ software_suite_v2/middleware/tuxdriver/trunk/unix/Makefile software_suite_v2/middleware/tuxdriver/trunk/win32/ software_suite_v2/middleware/tuxdriver/trunk/win32/Makefile software_suite_v2/middleware/tuxdriver/trunk/win32/compile.bat Log: Start of tux_driver project. Added: software_suite_v2/middleware/tuxdriver/trunk/AUTHORS =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/AUTHORS (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/AUTHORS 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,10 @@ +tux_driver was written by: + + Remi Jocaille <rem...@c2...> + +Contributors: + + David Bourgeois <da...@ja...> + Paul Rathgeb <pau...@c2...> + Frans Meulenbroeks aka eFfeM + Added: software_suite_v2/middleware/tuxdriver/trunk/COPYING =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/COPYING (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/COPYING 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. Added: software_suite_v2/middleware/tuxdriver/trunk/README =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/README (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/README 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,8 @@ +tuxdriver-0.0.1 b007 ALPHA + +tux_driver is a shared library to control the tuxdroid robot. + +For all information about tuxdroid, please visit: + + http://www.tuxisalive.com + Added: software_suite_v2/middleware/tuxdriver/trunk/doc/Notes.txt =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/doc/Notes.txt (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/doc/Notes.txt 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,5 @@ +Directives of compilations: +USE_MUTEX +LOCK_TUX +USB_DEBUG +GENERATE_DOC \ No newline at end of file Added: software_suite_v2/middleware/tuxdriver/trunk/doc/TuxSSV2-Middleware-Driver.odt =================================================================== (Binary files differ) Property changes on: software_suite_v2/middleware/tuxdriver/trunk/doc/TuxSSV2-Middleware-Driver.odt ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.h (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/include/tux_driver.h 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,442 @@ +/* + * Tux Droid - Driver + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ +/* + * Imported functions: + * extern HMODULE TuxDrv_InitDll(const char *lpsz); + * extern long TuxDrv_UninitDll(void); + * extern void TuxDrv_Start(void); + * extern void TuxDrv_Stop(void); + * extern const char *TuxDrv_StrError(TuxDrvError error_code); + * extern void TuxDrv_GetDescriptor(tux_descriptor_t *tux_desc); + * extern void TuxDrv_SetStatusCallback(drv_status_callback_t funct); + * extern void TuxDrv_SetEndCycleCallback(drv_simple_callback_t funct); + * extern void TuxDrv_SetDongleConnectedCallback(drv_simple_callback_t funct); + * extern void TuxDrv_SetDongleDisconnectedCallback(drv_simple_callback_t funct); + * extern TuxDrvError TuxDrv_PerformCommand(double delay, char *cmd_str); + * extern void TuxDrv_ClearCommandStack(void); + * extern TuxDrvError TuxDrv_PerformMacroFile(char *file_path); + * extern TuxDrvError TuxDrv_PerformMacroText(char *macro); + * extern TuxDrvError TuxDrv_SoundReflash(char *tracks); + * extern void TuxDrv_SetLogLevel(log_level_t level); + * extern void TuxDrv_SetLogTarget(log_target_t target); + * extern TuxDrvError TuxDrv_GetStatusName(int id, char* name); + * extern TuxDrvError TuxDrv_GetStatusId(char* name, int *id); + * extern TuxDrvError TuxDrv_GetStatusState(int id, char *state); + * extern TuxDrvError TuxDrv_GetStatusValue(int id, char *value); + * extern void TuxDrv_GetAllStatusState(char *state); + * extern int TuxDrv_TokenizeStatus(char *status, drv_tokens_t *tokens); + * extern void TuxDrv_ResetPositions(void); + * extern void TuxDrv_ResetDongle(void); + * extern double get_time(void); + */ + +#ifndef _TUX_DRIVER_H_ +#define _TUX_DRIVER_H_ + +#include <stdbool.h> + +#ifndef WINAPI +# define WINAPI +#endif + +/** + * Id enumeration of high level status. + */ +typedef enum { + SW_ID_WINGS_POSITION = 0, + SW_ID_WINGS_REMAINING_MVM, + SW_ID_SPINNING_DIRECTION, + SW_ID_SPINNING_REMAINING_MVM, + SW_ID_LEFT_WING_BUTTON, + SW_ID_RIGHT_WING_BUTTON, + SW_ID_HEAD_BUTTON, + SW_ID_REMOTE_BUTTON, + SW_ID_MOUTH_POSITION, + SW_ID_MOUTH_REMAINING_MVM, + SW_ID_EYES_POSITION, + SW_ID_EYES_REMAINING_MVM, + SW_ID_DESCRIPTOR_COMPLETE, + SW_ID_RF_STATE, + SW_ID_DONGLE_PLUG, + SW_ID_CHARGER_STATE, + SW_ID_BATTERY_LEVEL, + SW_ID_BATTERY_STATE, + SW_ID_LIGHT_LEVEL, + SW_ID_LEFT_LED_STATE, + SW_ID_RIGHT_LED_STATE, + SW_ID_CONNECTION_QUALITY, + SW_ID_AUDIO_FLASH_PLAY, + SW_ID_AUDIO_GENERAL_PLAY, + SW_ID_FLASH_PROG_CURR_TRACK, + SW_ID_FLASH_PROG_LAST_TRACK_SIZE, + SW_ID_TUXCORE_SYMBOLIC_VERSION, + SW_ID_TUXAUDIO_SYMBOLIC_VERSION, + SW_ID_FUXUSB_SYMBOLIC_VERSION, + SW_ID_FUXRF_SYMBOLIC_VERSION, + SW_ID_TUXRF_SYMBOLIC_VERSION, + SW_ID_DRIVER_SYMBOLIC_VERSION, + SW_ID_SOUND_REFLASH_BEGIN, + SW_ID_SOUND_REFLASH_END, + SW_ID_SOUND_REFLASH_CURRENT_TRACK, +} SW_ID_DRIVER; + +#if defined(__cplusplus) +extern "C" { +#endif + +/** + * Error codes + */ +#define TUX_ERROR_BEGIN 256 +typedef int TuxDrvError; +typedef enum +{ + E_TUXDRV_NOERROR = 0, + E_TUXDRV_PARSERISDISABLED = TUX_ERROR_BEGIN, + E_TUXDRV_INVALIDCOMMAND, + E_TUXDRV_STACKOVERFLOW, + E_TUXDRV_FILEERROR, + E_TUXDRV_BADWAVFILE, + E_TUXDRV_INVALIDIDENTIFIER, + E_TUXDRV_INVALIDNAME, + E_TUXDRV_INVALIDPARAMETER, + E_TUXDRV_BUSY, + E_TUXDRV_WAVSIZEEXCEDED, +} tux_drv_error_t; + +/** + * CPU number enumeration. + */ +typedef enum { + TUXCORE_CPU_NUM = 0, + TUXAUDIO_CPU_NUM = 1, + TUXRF_CPU_NUM = 2, + FUXRF_CPU_NUM = 3, + FUXUSB_CPU_NUM = 4, + INVALID_CPU_NUM = -1, +} CPU_IDENTIFIERS; + +/** + * Descriptor structure of a firmaware. + */ +typedef struct { + CPU_IDENTIFIERS cpu_id; + unsigned int version_major; + unsigned int version_minor; + unsigned int version_update; + unsigned int revision; + bool release; + bool local_modification; + bool mixed_revisions; + unsigned int author; + unsigned int variation; + char version_string[256]; +} firmware_descriptor_t; + +/** + * Descriptor structure of sound flash. + */ +typedef struct { + unsigned int number_of_sounds; + unsigned int flash_usage; + unsigned int available_record_time; +} sound_flash_descriptor_t; + +/** + * Descriptor structure of ID connection. + */ +typedef struct { + unsigned int number; +} id_descriptor_t; + +/** + * Global descriptor structure of tuxdroid. + */ +typedef struct { + struct firmwares_t { + firmware_descriptor_t *package; + firmware_descriptor_t *tuxcore; + firmware_descriptor_t *tuxaudio; + firmware_descriptor_t *tuxrf; + firmware_descriptor_t *fuxrf; + firmware_descriptor_t *fuxusb; + } firmwares; + struct driver_version_t { + unsigned int version_major; + unsigned int version_minor; + unsigned int version_update; + unsigned int version_build; + char version_state[100]; + char version_string[100]; + } driver; + sound_flash_descriptor_t *sound_flash; + id_descriptor_t *id; +} tux_descriptor_t; + +/** + * Simple callback definition. + */ +typedef void(*drv_simple_callback_t)(void); + +/** + * Status callback definition. + */ +typedef void(*drv_status_callback_t)(char *status); + +/** + * Tokens structure + */ +typedef char drv_token_str_t[1024]; +typedef drv_token_str_t drv_tokens_t[256]; + +/** + * Logging target + */ +typedef enum log_target +{ + LOG_TARGET_TUX, + LOG_TARGET_SHELL +} log_target_t; + +/** + * Logging levels, in increasing priorities + */ +typedef enum log_level +{ + LOG_LEVEL_DEBUG, + LOG_LEVEL_INFO, + LOG_LEVEL_WARNING, + LOG_LEVEL_ERROR, + LOG_LEVEL_NONE +} log_level_t; + +/** + * Dynamic library definitions for specific os. + */ + +/** + * Windows arch. + */ +#ifdef WIN32 +# ifndef LOADSYMBOL +# define LOADSYMBOL GetProcAddress +# endif +# ifndef CLOSELIB +# define CLOSELIB FreeLibrary +# endif +# ifndef DYNHANDLE + typedef HMODULE DYNHANDLE; +# endif +/** + * Linux and mac arch. + */ +#else +# ifndef HWND +# define HWND void* +# endif +# ifndef HMODULE +# define HMODULE void* +# endif +# include <dlfcn.h> +# include <unistd.h> +# include <stdlib.h> +# include <string.h> +# ifndef LOADSYMBOL +# define LOADSYMBOL dlsym +# endif +# ifndef CLOSELIB +# define CLOSELIB dlclose +# endif +# ifndef DYNHANDLE + typedef void* DYNHANDLE; +# endif +#endif +/** + * Common arch. + */ +#ifndef DDECL +# define DDECL(x) LP_##x x=NULL; +#endif +#ifndef DCLEAR +# define DCLEAR(x) x=NULL; +#endif +#ifndef DYN +# define DYN(x) x=( LP_##x )LOADSYMBOL(hMod,#x); +#endif + +/** + * Function prototypes + */ +typedef void (WINAPI *LP_TuxDrv_Start)(void); +typedef void (WINAPI *LP_TuxDrv_Stop)(void); +typedef const char * (WINAPI *LP_TuxDrv_StrError)(TuxDrvError error_code); +typedef void (WINAPI *LP_TuxDrv_GetDescriptor)(tux_descriptor_t *tux_desc); +typedef void (WINAPI *LP_TuxDrv_SetStatusCallback)(drv_status_callback_t funct); +typedef void (WINAPI *LP_TuxDrv_SetEndCycleCallback)(drv_simple_callback_t funct); +typedef void (WINAPI *LP_TuxDrv_SetDongleConnectedCallback)(drv_simple_callback_t funct); +typedef void (WINAPI *LP_TuxDrv_SetDongleDisconnectedCallback)(drv_simple_callback_t funct); +typedef TuxDrvError (WINAPI *LP_TuxDrv_PerformCommand)(double delay, char *cmd_str); +typedef void (WINAPI *LP_TuxDrv_ClearCommandStack)(void); +typedef TuxDrvError (WINAPI *LP_TuxDrv_PerformMacroFile)(char *file_path); +typedef TuxDrvError (WINAPI *LP_TuxDrv_PerformMacroText)(char *macro); +typedef TuxDrvError (WINAPI *LP_TuxDrv_SoundReflash)(char *tracks); +typedef void (WINAPI *LP_TuxDrv_SetLogLevel)(log_level_t level); +typedef void (WINAPI *LP_TuxDrv_SetLogTarget)(log_target_t target); +typedef TuxDrvError (WINAPI *LP_TuxDrv_GetStatusName)(int id, char* name); +typedef TuxDrvError (WINAPI *LP_TuxDrv_GetStatusId)(char* name, int *id); +typedef TuxDrvError (WINAPI *LP_TuxDrv_GetStatusState)(int id, char *state); +typedef TuxDrvError (WINAPI *LP_TuxDrv_GetStatusValue)(int id, char *value); +typedef void (WINAPI *LP_TuxDrv_GetAllStatusState)(char *state); +typedef int (WINAPI *LP_TuxDrv_TokenizeStatus)(char *status, drv_tokens_t *tokens); +typedef void (WINAPI *LP_TuxDrv_ResetPositions)(void); +typedef void (WINAPI *LP_TuxDrv_ResetDongle)(void); +typedef double (WINAPI *LP_get_time)(void); + +/** + * Made instance of functions. + */ +DDECL(TuxDrv_Start); +DDECL(TuxDrv_Stop); +DDECL(TuxDrv_StrError); +DDECL(TuxDrv_GetDescriptor); +DDECL(TuxDrv_SetStatusCallback); +DDECL(TuxDrv_SetEndCycleCallback); +DDECL(TuxDrv_SetDongleConnectedCallback); +DDECL(TuxDrv_SetDongleDisconnectedCallback); +DDECL(TuxDrv_PerformCommand); +DDECL(TuxDrv_ClearCommandStack); +DDECL(TuxDrv_PerformMacroFile); +DDECL(TuxDrv_PerformMacroText); +DDECL(TuxDrv_SoundReflash); +DDECL(TuxDrv_SetLogLevel); +DDECL(TuxDrv_SetLogTarget); +DDECL(TuxDrv_GetStatusName); +DDECL(TuxDrv_GetStatusId); +DDECL(TuxDrv_GetStatusState); +DDECL(TuxDrv_GetStatusValue); +DDECL(TuxDrv_GetAllStatusState); +DDECL(TuxDrv_TokenizeStatus); +DDECL(TuxDrv_ResetPositions); +DDECL(TuxDrv_ResetDongle); +DDECL(get_time); + +/** + * Declaration of the handle to the library. + */ +HMODULE _TUXDRIVER_hMod = NULL; + +/** + * Get the function address in the library. + */ +void +LoadFunctions(hMod) +HMODULE hMod; +{ + _TUXDRIVER_hMod = hMod; + DYN(TuxDrv_Start); + DYN(TuxDrv_Stop); + DYN(TuxDrv_StrError); + DYN(TuxDrv_GetDescriptor); + DYN(TuxDrv_SetStatusCallback); + DYN(TuxDrv_SetEndCycleCallback); + DYN(TuxDrv_SetDongleConnectedCallback); + DYN(TuxDrv_SetDongleDisconnectedCallback); + DYN(TuxDrv_PerformCommand); + DYN(TuxDrv_ClearCommandStack); + DYN(TuxDrv_PerformMacroFile); + DYN(TuxDrv_PerformMacroText); + DYN(TuxDrv_SoundReflash); + DYN(TuxDrv_SetLogLevel); + DYN(TuxDrv_SetLogTarget); + DYN(TuxDrv_GetStatusName); + DYN(TuxDrv_GetStatusId); + DYN(TuxDrv_GetStatusState); + DYN(TuxDrv_GetStatusValue); + DYN(TuxDrv_GetAllStatusState); + DYN(TuxDrv_TokenizeStatus); + DYN(TuxDrv_ResetPositions); + DYN(TuxDrv_ResetDongle); + DYN(get_time); +} + +/** + * Initialization of library. + */ +HMODULE +TuxDrv_InitDll(lpsz) +const char *lpsz; +{ + + HMODULE hMod = NULL; +#ifdef WIN32 + hMod = LoadLibrary(lpsz); + if(!hMod || (hMod < (HMODULE)32)) + return hMod; +#else + hMod = dlopen(lpsz, RTLD_NOW); + if(!hMod) + return NULL; + + setenv("TUXDRIVERLIBPATH", lpsz, 1); +#endif + LoadFunctions(hMod); + return hMod; +} + +/** + * Finalization of library. + */ +long +TuxDrv_UninitDll() +{ + CLOSELIB(_TUXDRIVER_hMod); + _TUXDRIVER_hMod = NULL; + DCLEAR(TuxDrv_Start); + DCLEAR(TuxDrv_Stop); + DCLEAR(TuxDrv_StrError); + DCLEAR(TuxDrv_GetDescriptor); + DCLEAR(TuxDrv_SetStatusCallback); + DCLEAR(TuxDrv_SetEndCycleCallback); + DCLEAR(TuxDrv_SetDongleConnectedCallback); + DCLEAR(TuxDrv_SetDongleDisconnectedCallback); + DCLEAR(TuxDrv_PerformCommand); + DCLEAR(TuxDrv_ClearCommandStack); + DCLEAR(TuxDrv_PerformMacroFile); + DCLEAR(TuxDrv_PerformMacroText); + DCLEAR(TuxDrv_SoundReflash); + DCLEAR(TuxDrv_SetLogLevel); + DCLEAR(TuxDrv_SetLogTarget); + DCLEAR(TuxDrv_GetStatusName); + DCLEAR(TuxDrv_GetStatusId); + DCLEAR(TuxDrv_GetStatusState); + DCLEAR(TuxDrv_GetStatusValue); + DCLEAR(TuxDrv_GetAllStatusState); + DCLEAR(TuxDrv_TokenizeStatus); + DCLEAR(TuxDrv_ResetPositions); + DCLEAR(TuxDrv_ResetDongle); + DCLEAR(get_time); + return 0; +} + +#if defined(__cplusplus) +} +#endif + +#endif /* _TUX_DRIVER_H_ */ Added: software_suite_v2/middleware/tuxdriver/trunk/libs/libusb.lib =================================================================== (Binary files differ) Property changes on: software_suite_v2/middleware/tuxdriver/trunk/libs/libusb.lib ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: software_suite_v2/middleware/tuxdriver/trunk/src/log.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/log.c (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/log.c 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,217 @@ +/* + * Tux Droid - Log + * Copyright (C) 2007 C2ME S.A. <tux...@c2...> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include <stdlib.h> +#include <stdio.h> +#include <stdarg.h> +#include <time.h> +#include <assert.h> + +#include "log.h" + +/** Name of log file for target LOG_TARGET_TUX */ +#ifdef WIN32 +# define LOG_FILE "tux_driver.log" +#else +# define LOG_FILE "/var/log/tux_driver.log" +#endif + +/** All logged messages are prefixed with this text */ +#define LOG_PREFIX "tux_driver" + +/** Current logging level */ +static log_level_t current_level = LOG_LEVEL_INFO; + +/** Logging level names */ +static const char *level_names[] = +{ + [LOG_LEVEL_DEBUG] = "debug", + [LOG_LEVEL_INFO] = "info", + [LOG_LEVEL_WARNING] = "warning", + [LOG_LEVEL_ERROR] = "error", + [LOG_LEVEL_NONE] = "none" +}; + +/** Current logging target */ +static log_target_t log_target = LOG_TARGET_SHELL; + +/** Log file for target LOG_TARGET_TUX */ +static FILE *log_file; + +/** Whether the log has been opened */ +static bool log_opened; + +/** + * Open the log. + * + * /param[in] target Logging target + * + * /return true if successfull, false otherwise + */ +bool +log_open(log_target_t target) +{ + if (log_opened) + return true; + + switch (target) + { + case LOG_TARGET_TUX: + log_file = fopen(LOG_FILE, "at"); + if (log_file == NULL) + return false; + break; + + case LOG_TARGET_SHELL: + break; + } + + log_target = target; + log_opened = true; + + return true; +} + +/** + * Close the log. + */ +void +log_close(void) +{ + if (!log_opened) + return; + + switch (log_target) + { + case LOG_TARGET_TUX: + fclose(log_file); + log_file = NULL; + break; + + case LOG_TARGET_SHELL: + break; + } + + log_opened = false; +} + +/** + * Set the logging level. + * + * /param[in] new_level New logging level + */ +void +log_set_level(log_level_t new_level) +{ + assert(new_level >= LOG_LEVEL_DEBUG && new_level <= LOG_LEVEL_NONE); + current_level = new_level; +} + +/** + * Get the logging level. + * + * /return current logging level + */ +log_level_t +log_get_level(void) +{ + return current_level; +} + +/** + * Log formatted message at the specified level. + * + * /param[in] at_level Level to log the message at + * /param[in] fmt Message format + * /param[in] ... Optional message data + * + * If the priority of the specifed level is lower than the priority + * of the current logging level, the message is silently dropped. + * + * /return true if successful, false otherwise + */ +bool +log_text(log_level_t at_level, const char *fmt, ...) +{ + char text[1024], *p = text; + size_t size = sizeof(text); + time_t now; + va_list al; + int r; + + /* No need for the log to be 'opened' when logging to std{out,err} */ + if (log_target != LOG_TARGET_SHELL && !log_opened) + return false; + + /* Logging at level NONE has no sense */ + assert(at_level >= LOG_LEVEL_DEBUG && at_level < LOG_LEVEL_NONE); + + if (at_level < current_level) + return true; + + /* Add date & time when LOG_TARGET_TUX */ + if (log_target == LOG_TARGET_TUX) + { + now = time(NULL); +#ifdef WIN32 + r = strftime(p, size, "%y-%m-%d %H-%M-%S ", localtime(&now)); +#else + r = strftime(p, size, "%F %T ", localtime(&now)); +#endif + if (r == 0) + return false; + + p += r; + size -= r; + } + + /* Only prefix non-INFO level messages */ + if (at_level != LOG_LEVEL_INFO) + { + r = snprintf(p, size, "%s: ", level_names[at_level]); + if (r < 0) + return false; + + p += r; + size -= r; + } + + va_start(al, fmt); + r = vsnprintf(p, size, fmt, al); + va_end(al); + if (r < 0) + return false; + + switch (log_target) + { + case LOG_TARGET_TUX: + fprintf(log_file, "%s\n", text); + break; + + case LOG_TARGET_SHELL: + if (at_level == LOG_LEVEL_WARNING || at_level == LOG_LEVEL_ERROR) + fprintf(stderr, "tux_driver: %s\n", text); + else + fprintf(stdout, "tux_driver: %s\n", text); + break; + } + + return true; +} Added: software_suite_v2/middleware/tuxdriver/trunk/src/log.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/log.h (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/log.h 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,37 @@ +#ifndef __LOG_H__ +#define __LOG_H__ + +#include <stdbool.h> + +/** Logging target */ +typedef enum log_target +{ + LOG_TARGET_TUX, + LOG_TARGET_SHELL +} log_target_t; + +extern bool log_open(log_target_t target); +extern void log_close(void); + +/** Logging levels, in increasing priorities */ +typedef enum log_level +{ + LOG_LEVEL_DEBUG, + LOG_LEVEL_INFO, + LOG_LEVEL_WARNING, + LOG_LEVEL_ERROR, + LOG_LEVEL_NONE +} log_level_t; + +extern void log_set_level(log_level_t new_level); +extern log_level_t log_get_level(void); + +extern bool log_text(log_level_t at_level, const char *fmt, ...) + __attribute__((format(printf, 2, 3))); + +#define log_debug(fmt, ...) log_text(LOG_LEVEL_DEBUG, (fmt), ## __VA_ARGS__) +#define log_info(fmt, ...) log_text(LOG_LEVEL_INFO, (fmt), ## __VA_ARGS__) +#define log_warning(fmt, ...) log_text(LOG_LEVEL_WARNING, (fmt), ## __VA_ARGS__) +#define log_error(fmt, ...) log_text(LOG_LEVEL_ERROR, (fmt), ## __VA_ARGS__) + +#endif /* __LOG_H__ */ Added: software_suite_v2/middleware/tuxdriver/trunk/src/threading_uniform.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/threading_uniform.h (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/threading_uniform.h 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,54 @@ +/* + * FICHIER .H pour la realisation de THREADS PORTABLES LINUX/WINDOWS + * + * ce code a it par Smeagol(sme...@if...) et revu par + * Jerry Kan (pil...@gm...) + * pour le site + * http://www.irrlicht.fr/ communautrancaise Irrlicht + * + * retrouvez ce tutoriel et beaucoup d'autres sur notre forum, + */ + +#ifdef USE_MUTEX +#ifndef _THREADING_UNIFORM_H_ +#define _THREADING_UNIFORM_H_ + +#ifdef WIN32 +# include <windows.h> +# define callback_t unsigned long __stdcall +# define thread_t HANDLE +# define thread_create(thrd, fct, param) thrd = CreateThread(NULL,0,(LPTHREAD_START_ROUTINE)(fct),(param),0,NULL) +# define thread_delete(thrd) CloseHandle(thrd); +# define thread_wait_close(thrd) WaitForMultipleObjects(1, &thrd, TRUE, INFINITE) +# define mutex_t CRITICAL_SECTION +# define mutex_init(mutex) InitializeCriticalSection(& mutex) +# define mutex_lock(mutex) EnterCriticalSection(& mutex) +# define mutex_unlock(mutex) LeaveCriticalSection(& mutex) +# define mutex_delete(mutex) DeleteCriticalSection(& mutex) +# define semaphore_t HANDLE +# define semaphore_init(sema, max, place) ((sema) = CreateSemaphore(NULL, (max), (place), NULL)) +# define semaphore_lock(sema) WaitForSingleObject((sema), INFINITE) +# define semaphore_unlock(sema) ReleaseSemaphore((sema), 1, NULL) +# define semaphore_delete(sema) CloseHandle(sema) +#else +# include <pthread.h> +# define callback_t void * +# define thread_t pthread_t +# define thread_create(thrd, fct, param) pthread_create(&thrd, NULL, (fct), ((void *)param)); +# define thread_delete(thrd) +# define thread_wait_close(thrd) pthread_join(thrd, NULL) +# include <semaphore.h> +# define mutex_t pthread_mutex_t +# define mutex_init(mutex) pthread_mutex_init ((&mutex), NULL) +# define mutex_lock(mutex) pthread_mutex_lock((&mutex)) +# define mutex_unlock(mutex) pthread_mutex_unlock((&mutex)) +# define mutex_delete(mutex) pthread_mutex_destroy((&mutex)) +# define semaphore_t sem_t* +# define semaphore_init(sema, max, place) (sema) = new sem_t; sem_init ((sema), (max), (place)) +# define semaphore_lock(sema) sem_wait((sema)) +# define semaphore_unlock(sema) sem_post((sema)) +# define semaphore_delete(sema) sem_destroy((sema)); delete ((sema)) +#endif + +#endif +#endif Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.c 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,71 @@ +/* + * Tux Droid - Audio + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include "tux_hw_cmd.h" +#include "tux_audio.h" +#include "tux_usb.h" + +/** + * + */ +LIBLOCAL bool +tux_audio_cmd_channel_general(void) +{ + unsigned char frame[TUX_SEND_LENGTH - 1] = {USB_DONGLE_AUDIO_CMD, + 0, 0, 0}; + return tux_usb_send_to_dongle(frame); +} + +/** + * + */ +LIBLOCAL bool +tux_audio_cmd_channel_tts(void) +{ + unsigned char frame[TUX_SEND_LENGTH - 1] = {USB_DONGLE_AUDIO_CMD, + 1, 0, 0}; + return tux_usb_send_to_dongle(frame); +} + +/** + * + */ +LIBLOCAL bool +tux_audio_cmd_mute(char *value) +{ + unsigned char frame[TUX_SEND_LENGTH - 1] = {AUDIO_MUTE_CMD, + 0, 0, 0}; + bool m_value; + + if (!str_to_bool(value, &m_value)) + return false; + + if (m_value) + frame[1] = 1; + else + frame[1] = 0; + + return tux_usb_send_to_tux(frame); +} + Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.h (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_audio.h 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,30 @@ +/* + * Tux Droid - Audio + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _TUX_AUDIO_H_ +#define _TUX_AUDIO_H_ + +#include "tux_misc.h" + +extern bool tux_audio_cmd_channel_general(void); +extern bool tux_audio_cmd_channel_tts(void); +extern bool tux_audio_cmd_mute(char *value); + +#endif /* _TUX_AUDIO_H_ */ Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.c 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,92 @@ +/* + * Tux Droid - Battery + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include <stdio.h> +#include <errno.h> +#include <string.h> +#include <stdlib.h> +#include <math.h> +#include "tux_hw_status.h" +#include "tux_sw_status.h" +#include "tux_battery.h" + +typedef enum +{ + FULL, + HIGH, + LOW, + EMPTY, +} battery_state_t; + +static battery_state_t battery_state = EMPTY; +static float last_level_for_event = 0.0; + +/** + * Update the status of the battery voltage. + */ +LIBLOCAL void +tux_battery_update_level(void) +{ + float new_level = 0.0; + float old_level = 0.0; + int adc_value; + char *new_state_str = ""; + char *old_state_str = ""; + + adc_value = (hw_status_table.battery.high_level << 8); + adc_value += hw_status_table.battery.low_level; + new_level = adc_value * 0.00322 * 2.319; + + old_level = *(float *)tux_sw_status_get_value(SW_ID_BATTERY_LEVEL); + + if (fabs(new_level - last_level_for_event) > 0.1) { + last_level_for_event = new_level; + if (!hw_status_table.battery.motors_state) + tux_sw_status_set_value(SW_ID_BATTERY_LEVEL, + (void *)&new_level, true); + + if (new_level >= TUX_BATTERY_FULL_VALUE) { + new_state_str = STRING_VALUE_FULL; + battery_state = FULL; + } else if ((new_level < TUX_BATTERY_FULL_VALUE) && + (new_level >= TUX_BATTERY_HIGH_VALUE)) + { + new_state_str = STRING_VALUE_HIGH; + battery_state = HIGH; + } else if ((new_level < TUX_BATTERY_HIGH_VALUE) && + (new_level >= TUX_BATTERY_LOW_VALUE)) + { + new_state_str = STRING_VALUE_LOW; + battery_state = LOW; + } else { + new_state_str = STRING_VALUE_EMPTY; + battery_state = EMPTY; + } + + old_state_str = (char *)tux_sw_status_get_value(SW_ID_BATTERY_STATE); + + if (strcmp(new_state_str, old_state_str)) + tux_sw_status_set_value(SW_ID_BATTERY_STATE, (void *)new_state_str, + true); + } else + if (old_level != new_level) + tux_sw_status_set_value(SW_ID_BATTERY_LEVEL, (void *)&new_level, + false); +} Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.h =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.h (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_battery.h 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,31 @@ +/* + * Tux Droid - Battery + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#ifndef _TUX_BATTERY_H_ +#define _TUX_BATTERY_H_ + +#define TUX_BATTERY_FULL_VALUE 6.0 +#define TUX_BATTERY_HIGH_VALUE 5.4 +#define TUX_BATTERY_LOW_VALUE 4.5 +#define TUX_BATTERY_EMPTY_VALUE 0.0 + +extern void tux_battery_update_level(void); + +#endif /* _TUX_BATTERY_H_ */ Added: software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c =================================================================== --- software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c (rev 0) +++ software_suite_v2/middleware/tuxdriver/trunk/src/tux_cmd_parser.c 2008-04-17 09:12:05 UTC (rev 964) @@ -0,0 +1,498 @@ +/* + * Tux Droid - Command parser + * Copyright (C) 2008 C2ME Sa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2, or (at your option) + * any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA + * 02111-1307, USA. + */ + +#include <stdio.h> +#include <stdlib.h> +#include <time.h> +#include <string.h> +#include <errno.h> +#ifdef USE_MUTEX +# include "threading_uniform.h" +#endif +#include "tux_misc.h" +#include "tux_cmd_parser.h" +#include "tux_usb.h" +#include "tux_eyes.h" +#include "tux_mouth.h" +#include "tux_wings.h" +#include "tux_spinning.h" +#include "tux_user_inputs.h" +#include "tux_leds.h" +#include "tux_sound_flash.h" +#include "tux_audio.h" +#include "log.h" +#include "tux_error.h" + +typedef struct { + double timeout; + char cmd[1024]; +} delay_cmd_t; + +typedef struct { + delay_cmd_t cmd_list[256]; + int cmd_count; +} cmd_stack_t; + +static cmd_stack_t user_cmd_stack; +static cmd_stack_t sys_cmd_stack; +#ifdef USE_MUTEX +static mutex_t __stack_mutex; +static mutex_t __macro_mutex; +#endif +static bool cmd_parser_enable = true; + +/** + * + */ +LIBLOCAL void +tux_cmd_parser_init(void) +{ + memset(&user_cmd_stack, 0, sizeof(cmd_stack_t)); + memset(&sys_cmd_stack, 0, sizeof(cmd_stack_t)); +#ifdef USE_MUTEX + mutex_init(__stack_mutex); + mutex_init(__macro_mutex); +#endif +} + +/** + * + */ +LIBLOCAL void +tux_cmd_parser_set_enable(bool value) +{ + cmd_parser_enable = value; +} + +/** + * + */ +/* TODO : It has surely a better way to do this. */ +LIBLOCAL int +tux_cmd_parser_get_tokens(char *src_str, tokens_t *toks, int max_tokens) +{ + tokens_t tokens; + char tok[12] = "%[^:,]%[:,]"; + char toke[7] = "%[^\n]"; + char reg_ex[1024] = ""; + char ts[8] = ""; + int i; + + for (i = 0; i < (max_tokens - 1); i++) + strncat(reg_ex, tok, sizeof(tok) - 1); + + strncat(reg_ex, toke, sizeof(toke) - 1); + + i = sscanf(src_str, reg_ex, + tokens[0], ts, tokens[1], ts, tokens[2], ts, tokens[3], ts, + tokens[4], ts, tokens[5], ts, tokens[6], ts, tokens[7], ts, + tokens[8], ts, tokens[9], ts, tokens[10], ts, tokens[11], ts, + tokens[12], ts, tokens[13], ts, tokens[14], ts, tokens[15], ts, + tokens[16], ts, tokens[17], ts, tokens[18], ts, tokens[19], ts, + tokens[20], ts, tokens[21], ts, tokens[22], ts, tokens[23], ts, + tokens[24], ts, tokens[25], ts, tokens[26], ts, tokens[27], ts, + tokens[28], ts, tokens[29], ts, tokens[30], ts, tokens[31], ts); + + memcpy(toks, &tokens, sizeof(tokens_t)); + + i -= i / 2; + return i; +} + +/** + * + */ +static bool +tux_cmd_parser_parse_raw_cmd(char *p0, char *p1, char *p2, char *p3, char *p4) +{ + unsigned char data[TUX_SEND_LENG... [truncated message content] |
From: remi <c2m...@c2...> - 2008-04-17 08:52:55
|
Author: remi Date: 2008-04-17 10:52:55 +0200 (Thu, 17 Apr 2008) New Revision: 963 Added: software_suite_v2/ software_suite_v2/middleware/ Log: Start of the new software architecture (v2) |
From: jerome <c2m...@c2...> - 2008-04-07 12:36:46
|
Author: jerome Date: 2008-04-07 14:36:48 +0200 (Mon, 07 Apr 2008) New Revision: 962 Modified: software/gadgets/skype_controller/skype_controller.tgf software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml software/gadgets/skype_controller/skype_controller/strings.xml Log: * Updated help file. Modified: software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml =================================================================== --- software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml 2008-04-07 10:59:25 UTC (rev 961) +++ software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml 2008-04-07 12:36:48 UTC (rev 962) @@ -31,20 +31,19 @@ <current_title type='str'>Nom skype</current_title> <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> <help_text type='str'> + Version de skype recommandée: 2.0 Lançez le contrôleur skype, si votre logiciel de voix ip skype n'est pas détecté, le gadget le lançera automatiquement, au premier contact avec le gadget, vous pourrez décider d'utiliser ou non l'interface graphique. Pour profiter pleinement de l'interface sans fil de Tux Droid, vous pouvez paramétrer skype pour lançer directement votre session. -- Lancement du gadget: --------------------------------------- +-= Lancement du gadget =- - Tux Droid ailes: recherche linéaire de contacts. - Aile droite: Recherche vers l'arrière. - Aile gauche: Recherche vers l'avant. -- Tux Droid bouton de tête: -- Appeller le contact sélectionné. +- Tux Droid bouton de tête: Appeller le contact sélectionné. - Lancer skype (appuis de 2 secones, si pas pas lançé). - Télécommande: - Flèche gauche: Recherche vers l'arrière. @@ -52,8 +51,7 @@ - Bouton ok: Appeller le contact sélectionné. - Bouton téléphone vert: Appeller contact sélectionné. - - Fonctions lors d'un appel. ----------------------------------------------- + -= Fonctions lors d'un appel =- - Tux Droid ailes: - Aile droite: Prendre un appel entrant. @@ -61,8 +59,8 @@ - Tux Doid bouton de tête: - Annuler l'appel (Non accessible lorsque l'appel a été initialisé). -- Mode 'Noms personnalisés': ---------------------------------------------- +-= Mode 'Noms personnalisés' =- + L'option 'noms personnalisés' vous permettra de corriger la manière dont Tux Droid prononcera le nom de vos contacts, mais permet aussi de renommer n'importe qui de manière amusante. @@ -70,8 +68,7 @@ ensuite, pour l'utiliser, vous devez cocher l'option dans les paramètres du gadget, Enfin, paramétrer les noms que vous voulez entendre. -- Mode recherche par 'T9': ------------------------------------------ +-= Mode recherche par 'T9' =- Ce mode peut être activé dans la fenêtre des paramètres du gadget. Une fois activée, vous pourre utiliser la télécommande pour faire une recherche T9. @@ -82,25 +79,24 @@ - Flèche haute: Précédent contact possible. - Flèche du bas: Suivant contact possible. -- Contôles sur les status de l'utilisateur local: ---------------------------------------------------------------------- +-= Contôles sur les status de l'utilisateur local =- - Bouton rouge: Se déconnecter de skype. - Bouton vert: Se connecter à skype. - Bouton bleu: Status 'Ne pas déranger'. - Bouton jaune: Status 'Absent'. -Appeller des téléphones normaux: -------------------------------------------------------- +-= Appeller des téléphones normaux =- + - Vous pouvez composer le numéro avec la télécommande - Bouton alt: Démarrer/ arreter le mode keypad. - Bouton ok ou téléphone vert: Appeller contact sélectionné. - Aile gauche ou bouton téléphone rouge: Finir un appel. - Bouton retour arrière: Effacé le dernier nombre entré. -Lire les messages texte: ----------------------------------------- +-= Lire les messages texte =- + Quand Tux vous dis que vous avez un nouveau message, appuyez sur le bouton de tête pour le faire lire. Dans le cas d'un double appel, Tux vous le signalera grâce à un son, et coupera automatiquement le nouvel appel pour vous laisser continuer votre conversations. Modified: software/gadgets/skype_controller/skype_controller/strings.xml =================================================================== --- software/gadgets/skype_controller/skype_controller/strings.xml 2008-04-07 10:59:25 UTC (rev 961) +++ software/gadgets/skype_controller/skype_controller/strings.xml 2008-04-07 12:36:48 UTC (rev 962) @@ -31,22 +31,20 @@ <current_title type='str'>Skype name</current_title> <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> <help_text type='str'> -Recommanded skype version : 2.0 +Recommended skype version : 2.0 -Launch skype controller, if your skype client is not detected, the gadget will launch it automaticlly +Launch skype controller, if your skype client is not detected, the gadget will launch it automatically -When launching the skype controller gadget the gadget graphical interface or not. +When launching the skype controller gadget, you can choose to use the gadget graphical interface or not. For the ease of use from a distance, it is advised to configure the skype client to sign in automatically at startup. -- Contact list browsing and calling ---------------------------------------------------- +-= Contact list browsing and calling =- - Tux Droid wings: search contacts. - Right wing: Backward search. - Left wing : Forward search. -- Tux Droid head button: -- Call selected contact. +- Tux Droid head button: Call selected contact. - Launch skype (push about 2 seconds, if not launched). - Remote control: - Left arrow: Backward search. @@ -54,17 +52,16 @@ - Ok button: Call selected contact. - Green phone button: Call selected contact. - - Functions availables in 'call' mode --------------------------------------------------------- - + -= Functions available in 'call' mode =- + - Tux Droid wings: -- Right wing: Accept incomming call. +- Right wing: Accept incoming call. - Left wing: Refuse/finish an incoming/outgoing call. - Tux Doid head button: - Cancel a call (Not available when a call is in progress). -- 'Customized names' mode: ---------------------------------------------- +-= 'Customized names' mode =- + With this mode you can change the name Tux will use with the TTS for a given contact name. To use this mode you will need to run the skype controller gadget first to load your contact list. @@ -73,25 +70,23 @@ Finally, click the -manage- button to modify the names in your contact list. -- 'T9' search mode: ------------------------------------------ +-= 'T9' search mode =- This mode can be enabled in the settings window of the skype controller gadget. Once enabled you can use the remote control to do a T9 search. Select a letter using the numeric keypad on the remote control. - play/pause: Call this contact. - Stop button: Initialize search. -- Backspace button: remove one caracter. +- Backspace button: remove one character. - Up arrow: Previous available contact. - Down arrow: Next available contact. -- User status controls: ------------------------------------- +-= User status controls =- + - Red button: Get disconnected. - Green button: Get connected. - Blue button: Do not disturb mode - Yellow button: Away mode. -- Making a call to a normal phone. ----------------------------------------------------------- +-= Making a call to a normal phone =- With the remote control you can dial the phone number of a normal phone. - Alt button: Start/stop the numeric keypad mode. @@ -99,12 +94,11 @@ - Left wing or red phone hangup button: Abort call. - Backspace button : Delete last entry. -Reading text messages: --------------------------------------------- +-= Reading text messages =- When Tux says you received a new message and you press the head button shortly after, Tux will read the message. -In case of you have a second incoming call when you are already engadget in a conversation: Tux will play a sound and abort the incoming call so you can continue your first call. +In case you have a second incoming call when you are already engaged in a conversation: Tux will play a sound and abort the incoming call so you can continue your first call. When you received a text message while you are calling, Tux will flash his eyes.</help_text> <name_to_read type='str'>Skype controller</name_to_read> Modified: software/gadgets/skype_controller/skype_controller.tgf =================================================================== (Binary files differ) |
From: jerome <c2m...@c2...> - 2008-04-07 10:59:29
|
Author: jerome Date: 2008-04-07 12:59:25 +0200 (Mon, 07 Apr 2008) New Revision: 961 Modified: software/gadgets/skype_controller/skype_controller.tgf software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml software/gadgets/skype_controller/skype_controller/strings.xml Log: * Updated help file layout. Modified: software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp =================================================================== --- software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp 2008-04-07 07:04:46 UTC (rev 960) +++ software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp 2008-04-07 10:59:25 UTC (rev 961) @@ -193,7 +193,7 @@ if _me.get_param('mutex').locked(): return _me.get_param('mutex').acquire() - time.sleep(1.0) + time.sleep(0.5) if _me.get_param('flag0') >= 2: _me.set_param('to_call', _me.get_param('to_call') + '+' ) else: Modified: software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml =================================================================== --- software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml 2008-04-07 07:04:46 UTC (rev 960) +++ software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml 2008-04-07 10:59:25 UTC (rev 961) @@ -30,44 +30,37 @@ <connection_lost type='str'>Connection avec skype interrompue.</connection_lost> <current_title type='str'>Nom skype</current_title> <gui_conf_window_title type='str'>Paramètres</gui_conf_window_title> - <help_text type='str'>Version de skype recommandée: 2.0 + <help_text type='str'> +Version de skype recommandée: 2.0 - Lançez le contrôleur skype, si votre logiciel de voix ip skype n'est pas détecté, -le gadget le lançera automatiquement, au premier contact avec le gadget, vous pourrez décider -d'utiliser ou non l'interface graphique. +Lançez le contrôleur skype, si votre logiciel de voix ip skype n'est pas détecté, le gadget le lançera automatiquement, au premier contact avec le gadget, vous pourrez décider d'utiliser ou non l'interface graphique. - Astuce: pour profiter pleinement de l'interface sans fil de Tux Droid, vous -pouvez paramétrer skype pour lançer directement votre session. +Pour profiter pleinement de l'interface sans fil de Tux Droid, vous pouvez paramétrer skype pour lançer directement votre session. - Lancement du gadget: -------------------------------------- - - - Tux Droid ailes: recherche linéaire de contacts. - - Aile droite: Recherche vers l'arrière. - - Aile gauche: Recherche vers l'avant. - - - Tux Droid bouton de tête: - - Appeller le contact sélectionné. - - Lancer skype (appuis de 2 secones, si pas pas lançé). - - - Télécommande, flèches: recherche linéaire de contacts. - - Flèche gauche: Recherche vers l'arrière. - - Flèche droite: Recherche vers l'avant. +- Tux Droid ailes: recherche linéaire de contacts. +- Aile droite: Recherche vers l'arrière. +- Aile gauche: Recherche vers l'avant. +- Tux Droid bouton de tête: +- Appeller le contact sélectionné. +- Lancer skype (appuis de 2 secones, si pas pas lançé). +- Télécommande: +- Flèche gauche: Recherche vers l'arrière. +- Flèche droite: Recherche vers l'avant. - Bouton ok: Appeller le contact sélectionné. - Bouton téléphone vert: Appeller contact sélectionné. - - Fonctions lors d'un appel. ---------------------------------------------- - - Tux Droid ailes: - - Aile droite: Prendre un appel entrant. - - Aile gauche: Refuser/Terminer un appel entrant/sortant. - - - Tux Doid bouton de tête: - - Annuler l'appel (Non accessible lorsque l'appel a été initialisé). - +- Tux Droid ailes: +- Aile droite: Prendre un appel entrant. +- Aile gauche: Refuser/Terminer un appel entrant/sortant. +- Tux Doid bouton de tête: +- Annuler l'appel (Non accessible lorsque l'appel a été initialisé). + - Mode 'Noms personnalisés': --------------------------------------------- L'option 'noms personnalisés' vous permettra de corriger la manière dont Tux Droid @@ -83,12 +76,11 @@ Ce mode peut être activé dans la fenêtre des paramètres du gadget. Une fois activée, vous pourre utiliser la télécommande pour faire une recherche T9. Sélectionnez une lettre grâce au keypad. - - - Bouton play/pause: Appellez le contact sélectionné. - - Bouton stop: Réinitialiser la recherche. - - Bouton retour arrière: retirer un caractère. - - Flèche haute: Précédent contact possible. - - Flèche du bas: Suivant contact possible. +- Bouton play/pause: Appellez le contact sélectionné. +- Bouton stop: Réinitialiser la recherche. +- Bouton retour arrière: retirer un caractère. +- Flèche haute: Précédent contact possible. +- Flèche du bas: Suivant contact possible. - Contôles sur les status de l'utilisateur local: --------------------------------------------------------------------- @@ -101,17 +93,18 @@ Appeller des téléphones normaux: ------------------------------------------------------- - - Vous pouvez composer le numéro avec la télécommande - - Bouton alt: Démarrer/ arreter le mode keypad. - - Bouton ok ou téléphone vert: Appeller contact sélectionné. - - Aile gauche ou bouton téléphone rouge: Finir un appel. - - Bouton retour arrière: Effacé le dernier nombre entré. +- Vous pouvez composer le numéro avec la télécommande +- Bouton alt: Démarrer/ arreter le mode keypad. +- Bouton ok ou téléphone vert: Appeller contact sélectionné. +- Aile gauche ou bouton téléphone rouge: Finir un appel. +- Bouton retour arrière: Effacé le dernier nombre entré. Lire les messages texte: ---------------------------------------- - Quand Tux vous dis que vous avez un nouveau message, appuyez sur le bouton de tête pour le faire lire. +Quand Tux vous dis que vous avez un nouveau message, appuyez sur le bouton de tête pour le faire lire. Dans le cas d'un double appel, Tux vous le signalera grâce à un son, et coupera automatiquement le nouvel appel pour vous laisser continuer votre conversations. + Au cas ou un nouveau message arriverait lors d'une de vos conversation, vous en serez notifié grâce aux yeux de Tux.</help_text> <name_to_read type='str'>Controleur Skype</name_to_read> <no_dongle type='str'>Le dongle n'est pas connecté.</no_dongle> Modified: software/gadgets/skype_controller/skype_controller/strings.xml =================================================================== --- software/gadgets/skype_controller/skype_controller/strings.xml 2008-04-07 07:04:46 UTC (rev 960) +++ software/gadgets/skype_controller/skype_controller/strings.xml 2008-04-07 10:59:25 UTC (rev 961) @@ -30,9 +30,11 @@ <connection_lost type='str'>Skype connection broken.</connection_lost> <current_title type='str'>Skype name</current_title> <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> - <help_text type='str'> Recommanded skype version : 2.0 + <help_text type='str'> +Recommanded skype version : 2.0 - Launch skype controller, if your skype client is not detected, the gadget will launch it automaticlly +Launch skype controller, if your skype client is not detected, the gadget will launch it automaticlly + When launching the skype controller gadget the gadget graphical interface or not. For the ease of use from a distance, it is advised to configure the skype client to sign in automatically at startup. @@ -40,49 +42,46 @@ - Contact list browsing and calling --------------------------------------------------- - - Tux Droid wings: search contacts. - - Right wing: Backward search. - - Left wing : Forward search. - - - Tux Droid head button: - - Call selected contact. - - Launch skype (push about 2 seconds, if not launched). - - - Remote control, arrows: search contacts - - Left arrow: Backward search. - - Right arrow: Forward search. - +- Tux Droid wings: search contacts. +- Right wing: Backward search. +- Left wing : Forward search. +- Tux Droid head button: +- Call selected contact. +- Launch skype (push about 2 seconds, if not launched). +- Remote control: +- Left arrow: Backward search. +- Right arrow: Forward search. - Ok button: Call selected contact. - - Green phone button: Call selected contact. - Functions availables in 'call' mode -------------------------------------------------------- - - Tux Droid wings: - - Right wing: Accept incomming call. - - Left wing: Refuse/finish an incomming/outgoing call. - - - Tux Doid head button: - - Cancel a call (Not available when a call is in progress). +- Tux Droid wings: +- Right wing: Accept incomming call. +- Left wing: Refuse/finish an incoming/outgoing call. +- Tux Doid head button: +- Cancel a call (Not available when a call is in progress). - 'Customized names' mode: --------------------------------------------- - With this mode you can change the name Tux will use with the TTS for a given contact name. +With this mode you can change the name Tux will use with the TTS for a given contact name. + To use this mode you will need to run the skype controller gadget first to load your contact list. + Next, you need to enable the -use customized names- mode from the settings window of the gadget. + Finally, click the -manage- button to modify the names in your contact list. - 'T9' search mode: ----------------------------------------- -This mode can be enabled in the settings window of the skype controller gadget. Once enabled you can use the remote control to do a T9 search. Select a letter - - play/pause: Call this contact. - - using the numeric keypad on the remote control. - - Stop button: Initialize search. - - Backspace button: remove one caracter. - - Up arrow: Previous available contact. - - Down arrow: Next available contact. +This mode can be enabled in the settings window of the skype controller gadget. Once enabled you can use the remote control to do a T9 search. Select a letter using the numeric keypad on the remote control. +- play/pause: Call this contact. +- Stop button: Initialize search. +- Backspace button: remove one caracter. +- Up arrow: Previous available contact. +- Down arrow: Next available contact. - User status controls: ------------------------------------ @@ -94,18 +93,19 @@ - Making a call to a normal phone. ---------------------------------------------------------- - - With the remote control you can dial the phone number of a normal phone. - - Alt button: Start/stop the numeric keypad mode. - - Ok button or green phone button: Call selected number. - - Left wing or red phone hangup button: Abort call. - - Backspace button : Delete last entry. + With the remote control you can dial the phone number of a normal phone. +- Alt button: Start/stop the numeric keypad mode. +- Ok button or green phone button: Call selected number. +- Left wing or red phone hangup button: Abort call. +- Backspace button : Delete last entry. Reading text messages: -------------------------------------------- - When Tux says you received a new message and you press the head button shortly after, Tux will read the message. +When Tux says you received a new message and you press the head button shortly after, Tux will read the message. In case of you have a second incoming call when you are already engadget in a conversation: Tux will play a sound and abort the incoming call so you can continue your first call. + When you received a text message while you are calling, Tux will flash his eyes.</help_text> <name_to_read type='str'>Skype controller</name_to_read> <no_dongle type='str'>Dongle is not connected.</no_dongle> Modified: software/gadgets/skype_controller/skype_controller.tgf =================================================================== (Binary files differ) |
From: jerome <c2m...@c2...> - 2008-04-07 07:04:46
|
Author: jerome Date: 2008-04-07 09:04:46 +0200 (Mon, 07 Apr 2008) New Revision: 960 Modified: software/gadgets/skype_controller/skype_controller.tgf software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml software/gadgets/skype_controller/skype_controller/strings.xml Log: * Added tts message entering / quit numeric mode. * Modified some texts. Modified: software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp =================================================================== --- software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp 2008-04-04 15:09:47 UTC (rev 959) +++ software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp 2008-04-07 07:04:46 UTC (rev 960) @@ -159,6 +159,7 @@ """ Using the numeric remote keypad as an old phone. """ + tux.tts.speak_free(_me.string('numeric_mode')) def fract(number): """ Cut the number to have a pretty and correct tts phone number. @@ -263,7 +264,7 @@ def restore(): - + tux.tts.speak_free(_me.string('quit_numeric')) tux.event.on_remote_bt[K_OK] = _me.get_param('ok_context') tux.event.on_remote_bt[K_RECEIVECALL] = _me.get_param('receivecall_context') tux.event.on_remote_bt[K_HANGUP] = _me.get_param('hangup_context') Modified: software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml =================================================================== --- software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml 2008-04-04 15:09:47 UTC (rev 959) +++ software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml 2008-04-07 07:04:46 UTC (rev 960) @@ -117,7 +117,9 @@ <no_dongle type='str'>Le dongle n'est pas connecté.</no_dongle> <no_phonetic_using_normal_list type='str'>Vous devez editer votre liste personnalisée. Le gadget va démarrer avec la liste standart.</no_phonetic_using_normal_list> <no_skype type='str'>Aucune connection Skype. Vérifiez que skype est connecté et votre connexion internet.</no_skype> + <numeric_mode type='str'>Vous etes entrés dans le mode numéric.</numeric_mode> <pseudo_phon_title type='str'>Nom personnalisé</pseudo_phon_title> + <quit_numeric type='str'>Vous êtes sortis du mode numéric.</quit_numeric> <relaunch_skype type='str'>impossible de communiquer avec skype, s'il vous plait, appuyez sur le bouton de tête pour redémarrer skype. Ensuite, relançez le gadget.</relaunch_skype> <skype_busy_call type='str'>votre correspondant est occupé</skype_busy_call> <skype_call_got type='str'>en ligne</skype_call_got> Modified: software/gadgets/skype_controller/skype_controller/strings.xml =================================================================== --- software/gadgets/skype_controller/skype_controller/strings.xml 2008-04-04 15:09:47 UTC (rev 959) +++ software/gadgets/skype_controller/skype_controller/strings.xml 2008-04-07 07:04:46 UTC (rev 960) @@ -103,15 +103,17 @@ Reading text messages: -------------------------------------------- - When Tux says you received a new message and you press the head button shortly after, Tux read the message. + When Tux says you received a new message and you press the head button shortly after, Tux will read the message. -In case of an other call is incomming, Tux will play a sound and will place this call in finished to let you continue your conversation. -When you receive a text message while you are calling, Tux will flash his eyes.</help_text> +In case of you have a second incoming call when you are already engadget in a conversation: Tux will play a sound and abort the incoming call so you can continue your first call. +When you received a text message while you are calling, Tux will flash his eyes.</help_text> <name_to_read type='str'>Skype controller</name_to_read> <no_dongle type='str'>Dongle is not connected.</no_dongle> <no_phonetic_using_normal_list type='str'>You need to edit your customized contact list. Starting with standart skype list.</no_phonetic_using_normal_list> <no_skype type='str'>No skype connection was found. Make sure skype is connected and verify you internet connection.</no_skype> + <numeric_mode type='str'>You are entered in numeric mode.</numeric_mode> <pseudo_phon_title type='str'>Custom name</pseudo_phon_title> + <quit_numeric type='str'>You have quit the numeric mode.</quit_numeric> <relaunch_skype type='str'>cannot communicate with skype, please, push the head button to launch skype again, next restart skype controler gadget.</relaunch_skype> <skype_busy_call type='str'>remote user busy</skype_busy_call> <skype_call_got type='str'>calling</skype_call_got> Modified: software/gadgets/skype_controller/skype_controller.tgf =================================================================== (Binary files differ) |
From: jerome <c2m...@c2...> - 2008-04-04 15:09:49
|
Author: jerome Date: 2008-04-04 17:09:47 +0200 (Fri, 04 Apr 2008) New Revision: 959 Modified: software/gadgets/skype_controller/skype_controller.tgf software/gadgets/skype_controller/skype_controller/Scripts/Python/GUI/skype/other.pyp software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp software/gadgets/skype_controller/skype_controller/Scripts/Python/main.pyp software/gadgets/skype_controller/skype_controller/Scripts/Python/tux_skype.py software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml software/gadgets/skype_controller/skype_controller/strings.xml Log: * Added call normals phones using the remote button pushing alt remote control button. * Updated help file. * Fixed a bug Modified: software/gadgets/skype_controller/skype_controller/Scripts/Python/GUI/skype/other.pyp =================================================================== --- software/gadgets/skype_controller/skype_controller/Scripts/Python/GUI/skype/other.pyp 2008-04-03 11:42:25 UTC (rev 958) +++ software/gadgets/skype_controller/skype_controller/Scripts/Python/GUI/skype/other.pyp 2008-04-04 15:09:47 UTC (rev 959) @@ -295,13 +295,16 @@ if user_to_call == _me.get_param('list_users')[i][1]: skid = _me.get_param('list_users')[i][0] + if skid == None: + skid = user_to_call + name_to_read = None if _me.get_param('custom_names'): for i in range(len(_me.get_param('list_phonetic'))): if skid == _me.get_param('list_phonetic')[i][0]: name_to_read = _me.get_param('list_phonetic')[i][2] break - + if skid != None: self.skype.make_simple_call(skid, to_read=name_to_read) Modified: software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp =================================================================== --- software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp 2008-04-03 11:42:25 UTC (rev 958) +++ software/gadgets/skype_controller/skype_controller/Scripts/Python/init.pyp 2008-04-04 15:09:47 UTC (rev 959) @@ -22,6 +22,11 @@ _me.set_param('posxy', (0, 0)) _me.set_param('dimentions', (0, 0)) _me.set_param('api_error_quit_flag', False) + +_me.set_param('to_call', '') +_me.set_param('flag0', 0) +_me.set_param('mutex', threading.Lock()) + head_pof = None # ---------------------------------------------------------------------------- @@ -148,9 +153,166 @@ _me.gui('skype').hide_from_main() _me.set_param('api_error_quit_flag', False) _me.exit_main_loop() + + +def numeric_keypad_initialization(): + """ + Using the numeric remote keypad as an old phone. + """ + def fract(number): + """ + Cut the number to have a pretty and correct tts phone number. + """ + divided = [] + lenght = len(number) + if (lenght % 2) == 0: + i = 0 + while i != lenght: + hach = '%s%s ' % (number[i], number[i+1]) + divided.append(hach) + i += 2 + else: + hach = '%s ' % (number[:3]) + divided.append(hach) + i = 3 + while i != lenght: + hach = '%s%s ' % (number[i], number[i+1]) + divided.append(hach) + i += 2 - + result = '' + for i in range(len(divided)): + result += divided[i] + + return result + + + def test(): + if _me.get_param('mutex').locked(): + return + _me.get_param('mutex').acquire() + time.sleep(1.0) + if _me.get_param('flag0') >= 2: + _me.set_param('to_call', _me.get_param('to_call') + '+' ) + else: + _me.set_param('to_call', _me.get_param('to_call') + '0' ) + + _me.set_param('flag0', 0) + _me.get_param('mutex').release() + + + + def K0(): + _me.set_param('flag0', _me.get_param('flag0') + 1) + t = threading.Thread(target=test) + t.start() + + + def K1(): + _me.set_param('to_call', _me.get_param('to_call') + '1') + + def K2(): + _me.set_param('to_call', _me.get_param('to_call') + '2') + + def K3(): + _me.set_param('to_call', _me.get_param('to_call') + '3') + + def K4(): + _me.set_param('to_call', _me.get_param('to_call') + '4') + + def K5(): + _me.set_param('to_call', _me.get_param('to_call') + '5') + + def K6(): + _me.set_param('to_call', _me.get_param('to_call') + '6') + + def K7(): + _me.set_param('to_call', _me.get_param('to_call') + '7') + + def K8(): + _me.set_param('to_call', _me.get_param('to_call') + '8') + + def K9(): + _me.set_param('to_call', _me.get_param('to_call') + '9') + + + def tell(): + if _me.get_param('to_call') == '+': + tux.tts.speak('plus') + return + tux.cmd.mouth_open() + if tux.tts.sound_on: + tux.tts.stop() + tux.tts.speak(fract(_me.get_param('to_call'))) + tux.cmd.mouth_close() + + + def kreturn(): + _me.set_param('to_call', _me.get_param('to_call')[:(len(_me.get_param('to_call')) -1) ]) + + + def call(): + _me.get_param('skype_object').make_pstn_call(_me.get_param('to_call')) + _me.set_param('to_call', '') + + + def abort(): + _me.get_param('skype_object').close_active_call() + _me.set_param('to_call', '') + + + def restore(): + + tux.event.on_remote_bt[K_OK] = _me.get_param('ok_context') + tux.event.on_remote_bt[K_RECEIVECALL] = _me.get_param('receivecall_context') + tux.event.on_remote_bt[K_HANGUP] = _me.get_param('hangup_context') + + tux.event.on_remote_bt[K_0] = None + tux.event.on_remote_bt[K_1] = None + tux.event.on_remote_bt[K_2] = None + tux.event.on_remote_bt[K_3] = None + tux.event.on_remote_bt[K_4] = None + tux.event.on_remote_bt[K_5] = None + tux.event.on_remote_bt[K_6] = None + tux.event.on_remote_bt[K_7] = None + tux.event.on_remote_bt[K_8] = None + tux.event.on_remote_bt[K_9] = None + + tux.event.on_remote_bt[K_BACKSPACE] = None + tux.event.on_remote_bt[K_STARTVOIP] = None + tux.event.on_remote_bt[K_ALT] = _me.get_funct('numeric_keypad_initialization') + + if _me.get_param('remote_t9'): + _me.get_param('skype_object').call_t9_object() + + tux.event.on_remote_bt[K_0] = K0 + tux.event.on_remote_bt[K_1] = K1 + tux.event.on_remote_bt[K_2] = K2 + tux.event.on_remote_bt[K_3] = K3 + tux.event.on_remote_bt[K_4] = K4 + tux.event.on_remote_bt[K_5] = K5 + tux.event.on_remote_bt[K_6] = K6 + tux.event.on_remote_bt[K_7] = K7 + tux.event.on_remote_bt[K_8] = K8 + tux.event.on_remote_bt[K_9] = K9 + + + tux.event.on_remote_bt[K_BACKSPACE] = kreturn + tux.event.on_remote_bt[K_STARTVOIP] = tell + + + _me.set_param('ok_context', tux.event.on_remote_bt[K_OK]) + _me.set_param('receivecall_context', tux.event.on_remote_bt[K_RECEIVECALL]) + _me.set_param('hangup_context', tux.event.on_remote_bt[K_HANGUP]) + + tux.event.on_remote_bt[K_OK] = call + tux.event.on_remote_bt[K_RECEIVECALL] = call + tux.event.on_remote_bt[K_HANGUP] = abort + + tux.event.on_remote_bt[K_ALT] = restore + + # ---------------------------------------------------------------------------- # Initialization and finalization shared functions # ---------------------------------------------------------------------------- @@ -176,6 +338,7 @@ _me.insert_funct('attach_strings', attach_strings) _me.insert_funct('quit_gadget', quit_gadget) _me.insert_funct('show_gadget_in_thread', show_gadget_in_thread) +_me.insert_funct('numeric_keypad_initialization', numeric_keypad_initialization) _me.insert_funct('connect_to_skype', connect_to_skype) _me.insert_funct('on_no_rf', on_no_rf) _me.insert_funct('skype_connection_lost', skype_connection_lost) Modified: software/gadgets/skype_controller/skype_controller/Scripts/Python/main.pyp =================================================================== --- software/gadgets/skype_controller/skype_controller/Scripts/Python/main.pyp 2008-04-03 11:42:25 UTC (rev 958) +++ software/gadgets/skype_controller/skype_controller/Scripts/Python/main.pyp 2008-04-04 15:09:47 UTC (rev 959) @@ -8,4 +8,5 @@ _me.get_funct('connect_to_skype')() if _me.get_param('skype_object').connection_state: _me.get_funct('show_gadget_in_thread')() + tux.event.on_remote_bt[K_ALT] = _me.get_funct('numeric_keypad_initialization') _me.run_main_loop() Modified: software/gadgets/skype_controller/skype_controller/Scripts/Python/tux_skype.py =================================================================== --- software/gadgets/skype_controller/skype_controller/Scripts/Python/tux_skype.py 2008-04-03 11:42:25 UTC (rev 958) +++ software/gadgets/skype_controller/skype_controller/Scripts/Python/tux_skype.py 2008-04-04 15:09:47 UTC (rev 959) @@ -888,10 +888,7 @@ def __set_tux_events(self): """ Set all events needed. - """ - def hello(): - print 'coucou' - + """ if not sk_commands.skype_connected(): try: if on_skype_connection_lost != None: @@ -1277,5 +1274,11 @@ self.my_T9.insert_word_in_database(liste[i]) self.my_T9.init_my_word() self.kstop() + + + def call_t9_object(self): + self.my_T9 = t9.tuxdroid_t9() + self.my_T9.clear_database() + self.init_touchs() Modified: software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml =================================================================== --- software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml 2008-04-03 11:42:25 UTC (rev 958) +++ software/gadgets/skype_controller/skype_controller/Strings/fr_ALL.xml 2008-04-04 15:09:47 UTC (rev 959) @@ -37,11 +37,8 @@ d'utiliser ou non l'interface graphique. Astuce: pour profiter pleinement de l'interface sans fil de Tux Droid, vous -pouvez paramétrer skype pour lançer directement votre session, ce qui vous permettra -de n'avoir aucune interaction avec le PC pour faire fonctionner le gadget. +pouvez paramétrer skype pour lançer directement votre session. - Dans cette version alpha, plusieurs options sont offertes: - - Lancement du gadget: -------------------------------------- @@ -56,6 +53,10 @@ - Télécommande, flèches: recherche linéaire de contacts. - Flèche gauche: Recherche vers l'arrière. - Flèche droite: Recherche vers l'avant. + +- Bouton ok: Appeller le contact sélectionné. +- Bouton téléphone vert: Appeller contact sélectionné. + - Fonctions lors d'un appel. ---------------------------------------------- @@ -72,16 +73,18 @@ L'option 'noms personnalisés' vous permettra de corriger la manière dont Tux Droid prononcera le nom de vos contacts, mais permet aussi de renommer n'importe qui de manière amusante. -Pour utilisez cette option, le gadget a besoin d'être initialisé au moins une fois, -ensuite, pour l'utilisez, il vous suffira de cocher l'option dans les paramètres du gadget, -et pui enfin, paramétrer les noms que vous voulez entendre. +Pour utiliser cette option, le gadget a besoin d'être initialisé au moins une fois, +ensuite, pour l'utiliser, vous devez cocher l'option dans les paramètres du gadget, +Enfin, paramétrer les noms que vous voulez entendre. - Mode recherche par 'T9': ----------------------------------------- - -L'option 'T9' vous permettre de réaliser une recherche T9 de vos contacts -via la télécommande. -Sélectionnez votre contact de la meme manière que pour un téléphone portable, pour appeller ce contact, appuyer sur le bouton play/pause de la télécommande. + +Ce mode peut être activé dans la fenêtre des paramètres du gadget. +Une fois activée, vous pourre utiliser la télécommande pour faire une recherche T9. +Sélectionnez une lettre grâce au keypad. + + - Bouton play/pause: Appellez le contact sélectionné. - Bouton stop: Réinitialiser la recherche. - Bouton retour arrière: retirer un caractère. - Flèche haute: Précédent contact possible. @@ -95,6 +98,19 @@ - Bouton bleu: Status 'Ne pas déranger'. - Bouton jaune: Status 'Absent'. +Appeller des téléphones normaux: +------------------------------------------------------- + + - Vous pouvez composer le numéro avec la télécommande + - Bouton alt: Démarrer/ arreter le mode keypad. + - Bouton ok ou téléphone vert: Appeller contact sélectionné. + - Aile gauche ou bouton téléphone rouge: Finir un appel. + - Bouton retour arrière: Effacé le dernier nombre entré. + +Lire les messages texte: +---------------------------------------- + Quand Tux vous dis que vous avez un nouveau message, appuyez sur le bouton de tête pour le faire lire. + Dans le cas d'un double appel, Tux vous le signalera grâce à un son, et coupera automatiquement le nouvel appel pour vous laisser continuer votre conversations. Au cas ou un nouveau message arriverait lors d'une de vos conversation, vous en serez notifié grâce aux yeux de Tux.</help_text> <name_to_read type='str'>Controleur Skype</name_to_read> Modified: software/gadgets/skype_controller/skype_controller/strings.xml =================================================================== --- software/gadgets/skype_controller/skype_controller/strings.xml 2008-04-03 11:42:25 UTC (rev 958) +++ software/gadgets/skype_controller/skype_controller/strings.xml 2008-04-04 15:09:47 UTC (rev 959) @@ -32,16 +32,13 @@ <gui_conf_window_title type='str'>Parameters</gui_conf_window_title> <help_text type='str'> Recommanded skype version : 2.0 - Launch skype controller, if your skype is not detected, gadget will launch it automaticly -First time, you will choose to display or not the gadget graphical interface. + Launch skype controller, if your skype client is not detected, the gadget will launch it automaticlly +When launching the skype controller gadget the gadget graphical interface or not. - To make the Tux Droid wireless interface usefull you can ask to skype -to get automaticly connected to your account that will let you released from the computer. +For the ease of use from a distance, it is advised to configure the skype client to sign in automatically at startup. - With this alpha version, a lot of functions are offers: - -- Launch gadget: --------------------------------------- +- Contact list browsing and calling +--------------------------------------------------- - Tux Droid wings: search contacts. - Right wing: Backward search. @@ -54,12 +51,16 @@ - Remote control, arrows: search contacts - Left arrow: Backward search. - Right arrow: Forward search. + +- Ok button: Call selected contact. + +- Green phone button: Call selected contact. - Functions availables in 'call' mode -------------------------------------------------------- - Tux Droid wings: - - Right wing: Take an incomming call. + - Right wing: Accept incomming call. - Left wing: Refuse/finish an incomming/outgoing call. - Tux Doid head button: @@ -67,18 +68,17 @@ - 'Customized names' mode: --------------------------------------------- -This option let you tell to Tux Droid how you want -he pronounce yours contacts names. - -To use this option, the gadget need to be initialized one time, -next, you just need to activate this function in the parameters side. -Finally, you need to specify what you want tux to say in the 'manage' window. + With this mode you can change the name Tux will use with the TTS for a given contact name. +To use this mode you will need to run the skype controller gadget first to load your contact list. +Next, you need to enable the -use customized names- mode from the settings window of the gadget. +Finally, click the -manage- button to modify the names in your contact list. - 'T9' search mode: ----------------------------------------- -This option let you realize a T9 search with the remote control within yours contacts -Select your, to call him, push the remote control play/pause button. +This mode can be enabled in the settings window of the skype controller gadget. Once enabled you can use the remote control to do a T9 search. Select a letter + - play/pause: Call this contact. + - using the numeric keypad on the remote control. - Stop button: Initialize search. - Backspace button: remove one caracter. - Up arrow: Previous available contact. @@ -91,8 +91,22 @@ - Blue button: Do not disturb mode - Yellow button: Away mode. +- Making a call to a normal phone. +---------------------------------------------------------- + + - With the remote control you can dial the phone number of a normal phone. + - Alt button: Start/stop the numeric keypad mode. + - Ok button or green phone button: Call selected number. + - Left wing or red phone hangup button: Abort call. + - Backspace button : Delete last entry. + +Reading text messages: +-------------------------------------------- + + When Tux says you received a new message and you press the head button shortly after, Tux read the message. + In case of an other call is incomming, Tux will play a sound and will place this call in finished to let you continue your conversation. -In case of a new message detected and you are calling, you will be notified with the Tux Droid eyes.</help_text> +When you receive a text message while you are calling, Tux will flash his eyes.</help_text> <name_to_read type='str'>Skype controller</name_to_read> <no_dongle type='str'>Dongle is not connected.</no_dongle> <no_phonetic_using_normal_list type='str'>You need to edit your customized contact list. Starting with standart skype list.</no_phonetic_using_normal_list> Modified: software/gadgets/skype_controller/skype_controller.tgf =================================================================== (Binary files differ) |
From: jerome <c2m...@c2...> - 2008-04-03 11:42:27
|
Author: jerome Date: 2008-04-03 13:42:25 +0200 (Thu, 03 Apr 2008) New Revision: 958 Modified: software/gadgets/skype_controller/skype_controller.tgf software/gadgets/skype_controller/skype_controller/Scripts/Python/tux_skype.py Log: * Added read message function pushing the head button with stop possibility. * Added ok, receive call and hangup buttons to control calls. Modified: software/gadgets/skype_controller/skype_controller/Scripts/Python/tux_skype.py =================================================================== --- software/gadgets/skype_controller/skype_controller/Scripts/Python/tux_skype.py 2008-04-03 09:26:10 UTC (rev 957) +++ software/gadgets/skype_controller/skype_controller/Scripts/Python/tux_skype.py 2008-04-03 11:42:25 UTC (rev 958) @@ -92,65 +92,67 @@ """ Lanch skype. """ - - if not sk_commands.skype_connected(): - self.__tux.tts.speak_free(TRYING_CONNECT_SKYPE) - thread.start_new_thread(sk_commands.launch_skype, ()) - temp1 = time.time() - timeout = 10 - retour = False - while not retour: - temp2 = time.time() - try: - self.__user_commands.set_online() - result = self.get_own_status() - if result.lower() != 'offline': + try: + if not sk_commands.skype_connected(): + self.__tux.tts.speak_free(TRYING_CONNECT_SKYPE) + thread.start_new_thread(sk_commands.launch_skype, ()) + temp1 = time.time() + timeout = 10 + retour = False + while not retour: + temp2 = time.time() + try: + self.__user_commands.set_online() + result = self.get_own_status() + if result.lower() != 'offline': + retour = True + except: + pass + time.sleep(0.2) + if int((temp2 - temp1)) >= timeout: retour = True - except: - pass - time.sleep(0.2) - if int((temp2 - temp1)) >= timeout: - retour = True - - - self.__skype_connection = skype_dbus.connect() - self.__local_user = infos.local_user(self.__skype_connection) - self.__skype = sk_commands.calls(self.__skype_connection) - self.__user_commands = sk_commands.status(self.__skype_connection) - self.__context = sk_commands.pointers_contexts() - self.__chat = sk_commands.chat_messages(self.__skype_connection) - self.__chat.notify = self.__on_message_status - self.__chat.connect_event() - self.__user_commands.on_remote_user_event = self.__on_online_status_changed - self.__user_commands.connect_remote_user_event() - self.__skype.on_call_event = self.__on_call_event - self.__skype.connect_call_event() + + + self.__skype_connection = skype_dbus.connect() + self.__local_user = infos.local_user(self.__skype_connection) + self.__skype = sk_commands.calls(self.__skype_connection) + self.__user_commands = sk_commands.status(self.__skype_connection) + self.__context = sk_commands.pointers_contexts() + self.__chat = sk_commands.chat_messages(self.__skype_connection) + self.__chat.notify = self.__on_message_status + self.__chat.connect_event() + self.__user_commands.on_remote_user_event = self.__on_online_status_changed + self.__user_commands.connect_remote_user_event() + self.__skype.on_call_event = self.__on_call_event + self.__skype.connect_call_event() - #We put tux and remote in their new context. - self.__set_tux_events() - - #publics variables. - self.on_contact_change_state = None + #We put tux and remote in their new context. + self.__set_tux_events() - self.__on_screen = None - self.current_remote_user = None - self.connection_state = False - self.dongle = self.__detect_dongle() - - if not self.dongle: - if on_no_radio != None: - on_no_radio() - time.sleep(1.0) - self.connection_state = self.__skype_connection.connection_state - - if self.connection_state and (on_api_attach_success != None): - time.sleep(3.0) - on_api_attach_success() + #publics variables. + self.on_contact_change_state = None + + self.__on_screen = None + self.current_remote_user = None + self.connection_state = False + self.dongle = self.__detect_dongle() - if self.__remote_t9: - self.my_T9 = t9.tuxdroid_t9() - self.my_T9.clear_database() - self.init_touchs() + if not self.dongle: + if on_no_radio != None: + on_no_radio() + time.sleep(1.0) + self.connection_state = self.__skype_connection.connection_state + + if self.connection_state and (on_api_attach_success != None): + time.sleep(3.0) + on_api_attach_success() + + if self.__remote_t9: + self.my_T9 = t9.tuxdroid_t9() + self.my_T9.clear_database() + self.init_touchs() + except: + pass @@ -231,6 +233,12 @@ """ when a chat is started up. """ + def stop_notification(): + if self.__tux.tts.sound_on: + self.__tux.tts.stop() + + current_message = message.Body + if not self.connection_state: return @@ -260,8 +268,21 @@ if message_from.find('_') > -1: message_from = message_from.replace('_', ' ') + #Ask if user want to hear the incoming message. + head_context = self.__tux.event.on_head_bt_pushed + stop_context = self.__tux.event.on_remote_bt[tuxapi_const.K_STOP] + self.__tux.event.on_head_bt_pushed = None self.__tux.tts.stop() self.__tux.tts.speak_free(message_from) + ret = self.__tux.event.wait_head_bt_pushed(6) + if ret: + self.__tux.event.on_remote_bt[tuxapi_const.K_STOP] = stop_notification + self.__tux.event.on_head_bt_pushed = stop_notification + u = unicode(message.Body) + to = u.encode('utf-8', 'replace') + self.__tux.tts.speak(to) + self.__tux.event.on_head_bt_pushed = head_context + self.__tux.event.on_remote_bt[tuxapi_const.K_STOP] = stop_context @@ -860,13 +881,7 @@ except: pass else: - temp1 = time.time() - self.__tux.event.wait_head_bt_released(10) - if (time.time() - temp1) >= 1.5: - thread.start_new_thread(self.__launch_skype, ()) - time.sleep(1.0) - else: - self.__call() + self.__call() @@ -874,6 +889,9 @@ """ Set all events needed. """ + def hello(): + print 'coucou' + if not sk_commands.skype_connected(): try: if on_skype_connection_lost != None: @@ -887,7 +905,8 @@ #Tux buttons events. self.__tux.event.on_head_bt_pushed = self.__test - self.__tux.event.on_remote_bt[tuxapi_const.K_OK] = self.__tux.event.on_head_bt_pushed + self.__tux.event.on_remote_bt[tuxapi_const.K_OK] = self.__test + self.__tux.event.on_remote_bt[tuxapi_const.K_RECEIVECALL] = self.__test if self.tux_wings: self.__tux.event.on_lwing_bt_pushed = self.__previous self.__tux.event.on_rwing_bt_pushed = self.__next Modified: software/gadgets/skype_controller/skype_controller.tgf =================================================================== (Binary files differ) |
From: jerome <c2m...@c2...> - 2008-04-03 09:26:08
|
Author: jerome Date: 2008-04-03 11:26:10 +0200 (Thu, 03 Apr 2008) New Revision: 957 Modified: software/gadgets/skype_controller/skype_controller.tgf software/gadgets/skype_controller/skype_controller/Scripts/Python/GUI/skype/other.glade Log: * Disabled skype gui resizable mode. Modified: software/gadgets/skype_controller/skype_controller/Scripts/Python/GUI/skype/other.glade =================================================================== --- software/gadgets/skype_controller/skype_controller/Scripts/Python/GUI/skype/other.glade 2008-04-03 09:22:23 UTC (rev 956) +++ software/gadgets/skype_controller/skype_controller/Scripts/Python/GUI/skype/other.glade 2008-04-03 09:26:10 UTC (rev 957) @@ -9,7 +9,7 @@ <property name="type">GTK_WINDOW_TOPLEVEL</property> <property name="window_position">GTK_WIN_POS_CENTER</property> <property name="modal">False</property> - <property name="resizable">True</property> + <property name="resizable">False</property> <property name="destroy_with_parent">False</property> <property name="decorated">True</property> <property name="skip_taskbar_hint">False</property> Modified: software/gadgets/skype_controller/skype_controller.tgf =================================================================== (Binary files differ) |