Rotator API

Files

file  rot_conf.c
 

Rotator Configuration Interface.


file  rotator.c
 

Rotator interface.


Functions

int frontrot_set_conf (ROT *rot, token_t token, const char *val)
 Set rotator state info from alpha input.
int frontrot_get_conf (ROT *rot, token_t token, char *val)
 Get data from rotator state in alpha form.
int rot_token_foreach (ROT *rot, int(*cfunc)(const struct confparams *, char *), char *data)
 Executes cfunc on all the elements stored in the conf table.
struct confparams * rot_confparam_lookup (ROT *rot, const char *name)
 lookup conf token by its name, return pointer to confparams struct.
token_t rot_token_lookup (ROT *rot, const char *name)
 Simple lookup returning token id associated with name.
int foreach_opened_rot (int(*cfunc)(ROT *, char *), char *data)
 execs cfunc() on each opened rot
ROT * rot_init (rot_model_t rot_model)
 allocate a new ROT handle
int rot_open (ROT *rot)
 open the communication to the rot
int rot_close (ROT *rot)
 close the communication to the rot
int rot_cleanup (ROT *rot)
 release a rot handle and free associated memory
int rot_set_conf (ROT *rot, token_t token, const char *val)
 set a rotator configuration parameter
int rot_get_conf (ROT *rot, token_t token, char *val)
 get the value of a configuration parameter
int rot_set_position (ROT *rot, azimuth_t azimuth, elevation_t elevation)
 set the azimuth and elevation of the rotator
int rot_get_position (ROT *rot, azimuth_t *azimuth, elevation_t *elevation)
 get the azimuth and elevation of the rotator
int rot_park (ROT *rot)
 park the antenna
int rot_stop (ROT *rot)
 stop the rotator
int rot_reset (ROT *rot, rot_reset_t reset)
 reset the rotator
int rot_move (ROT *rot, int direction, int speed)
 move the rotator in the specified direction
const char * rot_get_info (ROT *rot)
 get general information from the rotator

Rotator interface

Rotator can be any kind of azimuth or azimuth and elevation controlled antenna system.


Function Documentation

int foreach_opened_rot ( int(*)(ROT *, char *)  cfunc,
char *  data 
)

execs cfunc() on each opened rot

Parameters:
cfunc The function to be executed on each rot
data Data pointer to be passed to cfunc()

Calls cfunc() function for each opened rot. The contents of the opened rot table is processed in random order according to a function pointed to by cfunc, whic is called with two arguments, the first pointing to the ROT handle, the second to a data pointer data. If data is not needed, then it can be set to NULL. The processing of the opened rot table is stopped when cfunc() returns 0.

int frontrot_get_conf ( ROT *  rot,
token_t  token,
char *  val 
)

Get data from rotator state in alpha form.

Parameters:
rot non-null
token TOK_... specifying which data to get
val result non-null
Returns:
RIG_OK or < 0 if error
int frontrot_set_conf ( ROT *  rot,
token_t  token,
const char *  val 
)

Set rotator state info from alpha input.

Parameters:
rot 
token TOK_... specifying which info to set
val input
Returns:
RIG_OK or < 0 error

assumes rot!=NULL, val!=NULL

int rot_cleanup ( ROT *  rot  ) 

release a rot handle and free associated memory

Parameters:
rot The ROT handle of the radio to be closed

Releases a rot struct which port has eventualy been closed already with rot_close().

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
See also:
rot_init(), rot_close()
int rot_close ( ROT *  rot  ) 

close the communication to the rot

Parameters:
rot The ROT handle of the rotator to be closed

Closes communication to a rotator which ROT handle has been passed by argument that was previously open with rot_open().

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
See also:
rot_cleanup(), rot_open()
struct confparams* rot_confparam_lookup ( ROT *  rot,
const char *  name 
) [read]

lookup conf token by its name, return pointer to confparams struct.

Parameters:
rot 
name 
Returns:
confparams or NULL

lookup backend config table first, then fall back to frontend. TODO: should use Lex to speed it up, strcmp hurts!

int rot_get_conf ( ROT *  rot,
token_t  token,
char *  val 
)

get the value of a configuration parameter

Parameters:
rot The rot handle
token The parameter
val The location where to store the value of config token

Retrieves the value of a configuration paramter associated with token.

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
See also:
rot_set_conf()
const char* rot_get_info ( ROT *  rot  ) 

get general information from the rotator

Parameters:
rot The rot handle

Retrieves some general information from the rotator. This can include firmware revision, exact model name, or just nothing.

Returns:
a pointer to static memory containing the ASCIIZ string if the operation has been sucessful, otherwise NULL if an error occured or get_info not part of capabilities.
int rot_get_position ( ROT *  rot,
azimuth_t *  azimuth,
elevation_t *  elevation 
)

get the azimuth and elevation of the rotator

Parameters:
rot The rot handle
azimuth The location where to store the current azimuth
elevation The location where to store the current elevation

Retrieves the current azimuth and elevation of the rotator.

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
See also:
rot_set_position()
ROT* rot_init ( rot_model_t  rot_model  ) 

allocate a new ROT handle

Parameters:
rot_model The rot model for this new handle

Allocates a new ROT handle and initializes the associated data for rot_model.

Returns:
a pointer to the ROT handle otherwise NULL if memory allocation failed or rot_model is unknown (e.g. backend autoload failed).
See also:
rot_cleanup(), rot_open()
int rot_move ( ROT *  rot,
int  direction,
int  speed 
)

move the rotator in the specified direction

Parameters:
rot The rot handle
direction Direction of movement
speed Speed of movement

Move the rotator in the specified direction. The speed is a value between 1 and 100.

int rot_open ( ROT *  rot  ) 

open the communication to the rot

Parameters:
rot The ROT handle of the rotator to be opened

Opens communication to a rotator which ROT handle has been passed by argument.

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
Return values:
RIG_EINVAL rot is NULL or unconsistent.
RIG_ENIMPL port type communication is not implemented yet.
See also:
rot_init(), rot_close()
int rot_park ( ROT *  rot  ) 

park the antenna

Parameters:
rot The rot handle

Park the antenna.

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
int rot_reset ( ROT *  rot,
rot_reset_t  reset 
)

reset the rotator

Parameters:
rot The rot handle
reset The reset operation to perform

Resets the rotator.

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
int rot_set_conf ( ROT *  rot,
token_t  token,
const char *  val 
)

set a rotator configuration parameter

Parameters:
rot The rot handle
token The parameter
val The value to set the parameter to

Sets a configuration parameter.

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
See also:
rot_get_conf()
int rot_set_position ( ROT *  rot,
azimuth_t  azimuth,
elevation_t  elevation 
)

set the azimuth and elevation of the rotator

Parameters:
rot The rot handle
azimuth The azimuth to set to
elevation The elevation to set to

Sets the azimuth and elevation of the rotator.

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
See also:
rot_get_position()
int rot_stop ( ROT *  rot  ) 

stop the rotator

Parameters:
rot The rot handle

Stop the rotator.

Returns:
RIG_OK if the operation has been sucessful, otherwise a negative value if an error occured (in which case, cause is set appropriately).
int rot_token_foreach ( ROT *  rot,
int(*)(const struct confparams *, char *)  cfunc,
char *  data 
)

Executes cfunc on all the elements stored in the conf table.

Parameters:
rot non-null
cfunc function(..)
data start first with backend conf table, then finish with frontend table
token_t rot_token_lookup ( ROT *  rot,
const char *  name 
)

Simple lookup returning token id associated with name.

Parameters:
rot 
name 
Returns:
token enum
 All Data Structures Files Functions Variables Defines

Hamlib documentation for version 1.2.10 -- Tue Mar 23 02:05:48 2010
Project page: http://hamlib.org