/* Lights Plugin - DMS - sept 99 - by Sylvain HUET */ /* REV: Arkeon */ /* Last update: 07.04.02 */ typeof class=S;; fun cbcomm(ui, cli, action, param, z) = let z->[o state] in if !strcmp action "state?" then UsendCli this cli ui "setState" itoa state else nil ;; fun activate(o, from, cli, action, param, rep, z) = let z->[_ state] in let 1-state -> newstate in ( mutate z<-[_ newstate]; UsendCli this nil ObUi o "setState" itoa newstate ); 0 ;; fun activate_on(o, from, cli, action, param, rep, z) = let z->[_ state] in let 1 -> newstate in ( mutate z<-[_ newstate]; UsendCli this nil ObUi o "setState" itoa newstate ); 0 ;; fun activate_off(o, from, cli, action, param, rep, z) = let z->[_ state] in let 0-> newstate in ( mutate z<-[_ newstate]; UsendCli this nil ObUi o "setState" itoa newstate ); 0 ;; fun newOb(o) = let [o if !strcmp hd UgetParam ObUi o "init" "on" then 1 else 0] -> z in ( ObRegisterAction o strcat ObName o ".switch" mkfun7 @activate z; ObRegisterAction o strcat ObName o ".on" mkfun7 @activate_on z; ObRegisterAction o strcat ObName o ".off" mkfun7 @activate_off z; UcbComm this ObUi o mkfun5 @cbcomm z ); 0 ;; fun IniPlug(file)= set class=getInfo strextr _getpack _checkpack file "name"; PlugRegister class @newOb nil; 0 ;;