- Timestamp:
- 01/09/11 00:38:10 (2 years ago)
- Location:
- trunk/core
- Files:
-
- 5 edited
-
action_stack.c (modified) (1 diff)
-
action_stack.h (modified) (1 diff)
-
kbd.c (modified) (1 diff)
-
luascript.c (modified) (1 diff)
-
script.c (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/core/action_stack.c
r1004 r1032 143 143 } 144 144 145 void action_wait_for_click(int timeout) 146 { 147 action_push(timeout); 148 action_push(AS_WAIT_CLICK); 149 } 150 145 151 // Can only be called from an action stack 146 152 void action_push(long p) -
trunk/core/action_stack.h
r1000 r1032 30 30 void action_push_release(long key); 31 31 void action_push_click(long key); 32 void action_wait_for_click(int timeout); 32 33 void action_pop(); 33 34 long action_get_prev(int p); -
trunk/core/kbd.c
r1021 r1032 107 107 #endif 108 108 109 void camera_press(const char *s)110 {111 long k = keyid_by_name(s);112 if (k > 0) {113 action_push_press(k);114 } else {115 ubasic_error = 3;116 }117 }118 119 void camera_release(const char *s)120 {121 long k = keyid_by_name(s);122 if (k > 0) {123 action_push_release(k);124 } else {125 ubasic_error = 3;126 }127 }128 129 void camera_click(const char *s)130 {131 long k = keyid_by_name(s);132 if (k > 0) {133 action_push_click(k);134 } else {135 ubasic_error = 3;136 }137 }138 139 void camera_wait_click(int timeout)140 {141 action_push(timeout);142 action_push(AS_WAIT_CLICK);143 }144 145 int camera_is_pressed(const char *s)146 {147 long k = keyid_by_name(s);148 if (k==0xFF) return get_usb_power(1);149 if (k > 0) {150 return (kbd_is_key_pressed(k));151 } else {152 ubasic_error = 3;153 }154 return 0;155 }156 157 int camera_is_clicked(const char *s)158 {159 long k = keyid_by_name(s);160 if (k==0xFF) return get_usb_power(1);161 if (k > 0) {162 return (kbd_last_clicked == k);163 } else {164 ubasic_error = 3;165 }166 return 0;167 }168 169 void camera_sleep(long v)170 {171 action_push_delay(v);172 }173 174 void camera_shoot()175 {176 action_push(AS_SHOOT);177 }178 109 // remote autostart 179 110 void script_autostart() -
trunk/core/luascript.c
r1021 r1032 510 510 { 511 511 int timeout = luaL_optnumber( L, 1, 0 ); 512 camera_wait_click(timeout);512 action_wait_for_click(timeout); 513 513 return lua_yield( L, 0 ); 514 514 } -
trunk/core/script.c
r1020 r1032 10 10 #include "action_stack.h" 11 11 #include "luascript.h" 12 #include "lauxlib.h" 12 13 #include "motion_detector.h" 13 14 #include "shot_histogram.h" … … 651 652 } 652 653 654 int camera_is_pressed(const char *s) 655 { 656 long k = keyid_by_name(s); 657 if (k==0xFF) return get_usb_power(1); 658 if (k > 0) { 659 return (kbd_is_key_pressed(k)); 660 } else { 661 if (is_lua()) 662 luaL_error( L, "unknown key" ); 663 else 664 ubasic_error = UBASIC_E_UNK_KEY; 665 } 666 return 0; 667 } 668 669 int camera_is_clicked(const char *s) 670 { 671 long k = keyid_by_name(s); 672 if (k==0xFF) return get_usb_power(1); 673 if (k > 0) { 674 return (kbd_last_clicked == k); 675 } else { 676 if (is_lua()) 677 luaL_error( L, "unknown key" ); 678 else 679 ubasic_error = UBASIC_E_UNK_KEY; 680 } 681 return 0; 682 } 683 684 685 void camera_press(const char *s) 686 { 687 // For Lua, luaCB_keyfunc handles this command. 688 689 long k = keyid_by_name(s); 690 if (k > 0) { 691 action_push_press(k); 692 } else { 693 ubasic_error = UBASIC_E_UNK_KEY; 694 } 695 } 696 697 void camera_release(const char *s) 698 { 699 // For Lua, luaCB_keyfunc handles this command. 700 701 long k = keyid_by_name(s); 702 if (k > 0) { 703 action_push_release(k); 704 } else { 705 ubasic_error = UBASIC_E_UNK_KEY; 706 } 707 } 708 709 void camera_click(const char *s) 710 { 711 // For Lua, luaCB_keyfunc handles this command. 712 713 long k = keyid_by_name(s); 714 if (k > 0) { 715 action_push_click(k); 716 } else { 717 ubasic_error = UBASIC_E_UNK_KEY; 718 } 719 } 720 721 void camera_shoot() 722 { 723 action_push(AS_SHOOT); 724 } 725 726 void camera_sleep(long v) 727 { 728 action_push_delay(v); 729 } 730 731 void camera_wait_click(int t) 732 { 733 action_wait_for_click(t); 734 } 735
Note: See TracChangeset
for help on using the changeset viewer.