Further to the getp/setp/gets I was encouraged to come up with a more complete 
list of halcmd-like functionality for the Python hal.so module.

Below is what I've cooked up so far.

some questions for discussion:

- I'm not totally happy with the hal.XXX_info() dissector functions returning 
tuples - I'm open to suggestions
- are name lists ok or do we need iterators, yield or what have you?
- what to do if any hal.xx() function called and no component created yet:
        - fail
        - autocreate hal<pid> component
        - what happens if autocreated and hal.component("foo") is called?
- are aliases deprecated? they appear in halcmd code but not in the man page.

-Michael


# accessing and dissecting pins, params, signals,components, functions and 
threads:

hal.pins([prefix]) - return list of pin names, optionally selected by prefix
hal.pin_info(name) - return tuple (owner,type,direction,value)

hal.parameters([prefix]) - return list of parameter names, optionally selected 
by prefix
hal.pin_info(name) - return tuple (owner,type,direction,value)

hal.signals() - return list of signal names
hal.signal_info(name) - return a tuple (type,value,sourcepin,readers) 
                                        types: (int,<as per sigtype>,string, 
list of strings)

hal.functions() - return list of function names
hal.function_info(name) - return a tuple (owner,code,args,usesFP,nusers) 
describing the function

hal.components() - return list of components
hal.component_info(name) - return a tuple (id,type,pid,isready) describing 
component state
                                                types: (int, string,int,boolean)
                                                
hal.threads() - return list of threads
hal.thread_info(name) - return tuple(period,isFP,time,maxtime,list of function 
names)
                                types: (int,bool,int,int, list of strings)

# the rest is pretty much copy & paste from halcmd.1

hal.loadrt(name) - load the <name> realtime module

hal.unloadrt(name) - unload the <name> realtime module; unload all if <name> is 
"all"

hal.loadusr(command [,wait=<boolean>] [,waitfor=<componentname>] 
[,waitforexit=<boolean>] [,ignore=<boolean>])
                                as per halcmd.1
                                
hal.waitusr(name) - waits for user space component name to disconnect from HAL

hal.unloadusr(name) - unloads a userspace component called compname. 
        If compname is "all", it will unload all userspace components.
        
hal.unload(name) - unloads a userspace component or realtime module. 
        If compname is "all", it will unload all userspace components and 
realtime modules.

hal.newsig(signame,type) - creates a new HAL signal called signame. 
        type must be one of hal.HAL_BIT, hal.HAL_FLOAT, hal.HAL_S32 or 
hal.HAL_U32 .

hal.delsig(signame) - deletes HAL signal signame. 

hal.sets(signame,value) - sets the value of signal signame to value. 

hal.stype(signame) - return type of signame as one of hal.HAL_BIT, 
hal.HAL_FLOAT, hal.HAL_S32 or hal.HAL_U32 .
        backwards compatibility with halcmd - subset of hal.signal_info()
        
hal.gets(signame) - gets the value of signal signame. 

hal.link(signal,pin) - link pin to signal

hal.net(signame,pinname,*pins) - create signname to match the type of pinname 
if it does not yet exist. 
        Then, link signame to each pin in pins.
        pins may be a tuple or list

hal.unlinkp(pinname) - breaks any previous link to pinname. 

hal.setp(name,value) - Sets the value of parameter or pin name to value. 

hal.param[paramname] = value - Identical to setp 

hal.pin[pinname] = value - Identical to setp

hal.ptype(name) - gets the type of parameter or pin name. 
        backwards compatibility with halcmd - subset of hal.param_info() or 
hal.pin_info()

hal.getp(name) - gets the value of parameter or pin name. 

hal.addf(functname,threadname) - Adds function functname to realtime thread 
threadname.
hal.delf(functname,threadname) - removes function functname from realtime 
thread threadname. 
hal.start() - starts execution of realtime threads. 
hal.stop() - stops execution of realtime threads. 






------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Emc-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/emc-developers

Reply via email to