Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

mem.c File Reference

Memory and channel interface. More...

#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <hamlib/rig.h>

Functions

int rig_set_mem (RIG *rig, vfo_t vfo, int ch)
 set the current memory channel number
int rig_get_mem (RIG *rig, vfo_t vfo, int *ch)
 get the current memory channel number
int rig_set_bank (RIG *rig, vfo_t vfo, int bank)
 set the current memory bank
int rig_set_channel (RIG *rig, const channel_t *chan)
 set channel data
int rig_get_channel (RIG *rig, channel_t *chan)
 get channel data
int rig_set_chan_all_cb (RIG *rig, chan_cb_t chan_cb, char *arg)
 set all channel data, by callback
int rig_get_chan_all_cb (RIG *rig, chan_cb_t chan_cb, char *arg)
 get all channel data, by callback
int rig_set_chan_all (RIG *rig, const channel_t chans[])
 set all channel data
int rig_get_chan_all (RIG *rig, channel_t chans[])
 get all channel data
int rig_set_mem_all_cb (RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, char *arg)
 set all channel and non-channel data by call-back
int rig_get_mem_all_cb (RIG *rig, chan_cb_t chan_cb, confval_cb_t parm_cb, char *arg)
 get all channel and non-channel data by call-back
int rig_set_mem_all (RIG *rig, const channel_t chans[], const struct confparams cfgps[], const value_t vals[])
 set all channel and non-channel data
int rig_get_mem_all (RIG *rig, channel_t chans[], const struct confparams cfgps[], value_t vals[])
 get all channel and non-channel data


Detailed Description

Memory and channel interface.

Author:
Stephane Fillod
Date:
2000-2006
Hamlib interface is a frontend implementing wrapper functions.

Function Documentation

int rig_get_chan_all RIG rig,
channel_t  chans[]
 

get all channel data

Parameters:
rig The rig handle
chan The location where to store all the channel data
Retrieves the data associated with all the memory channels.

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:
rig_get_chan_all_cb(), rig_set_chan_all()

int rig_get_chan_all_cb RIG rig,
chan_cb_t  chan_cb,
char *  arg
 

get all channel data, by callback

Parameters:
rig The rig handle
chan_cb Pointer to a callback function to retrieve channel data
arg Arbitrary argument passed back to chan_cb
Retrieves the data associated with a all the memory channels.

chan_cb is called first with no data in (chan equals NULL). This means the application has to provide a struct where to store future data for channel channel_num. If channel_num == chan->channel_num, the application does not need to provide a new allocated structure.

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:
rig_get_chan_all(), rig_set_chan_all_cb()

int rig_get_channel RIG rig,
channel_t chan
 

get channel data

Parameters:
rig The rig handle
chan The location where to store the channel data
Retrieves the data associated with a channel. This channel can either be the state of a VFO specified by chan->vfo, or a memory channel specified with chan->vfo = RIG_VFO_MEM and chan->channel_num. See channel_t for more information.

Example:

  channel_t chan;
  int err;

  chan->vfo = RIG_VFO_MEM;
  chan->channel_num = 10;
  err = rig_get_channel(rig, &chan);
  if (err != RIG_OK)
        error("get_channel failed: %s", rigerror(err));

The rig_get_channel is supposed to have no impact on the current VFO and memory number selected. Depending on backend and rig capabilities, the chan struct may not be filled in completely.

Note: chan->ext_levels is a pointer to a newly mallocated memory. This is the responsability of the caller to manage and eventually free it.

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:
rig_set_channel()

int rig_get_mem RIG rig,
vfo_t  vfo,
int *  ch
 

get the current memory channel number

Parameters:
rig The rig handle
vfo The target VFO
ch The location where to store the current memory channel number
Retrieves the current memory channel number. It is not mandatory for the radio to be in memory mode. Actually it depends on rigs. YMMV.

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:
rig_set_mem()

int rig_get_mem_all RIG rig,
channel_t  chans[],
const struct confparams  cfgps[],
value_t  vals[]
 

get all channel and non-channel data

Parameters:
rig The rig handle
chans Array of channels where to store the data
cfgps Array of config parameters to retrieve
vals Array of values where to store the data
Retrieves the data associated with all the memory channels, and rigs memory parameters.

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:
rig_get_mem_all(), rig_set_mem_all_cb()
Todo:
finish coding and testing of mem_all functions

int rig_get_mem_all_cb RIG rig,
chan_cb_t  chan_cb,
confval_cb_t  parm_cb,
char *  arg
 

get all channel and non-channel data by call-back

Parameters:
rig The rig handle
chan_cb The callback for channel data
parm_cb The callback for non-channel(aka parm) data
arg Cookie passed to chan_cb and parm_cb
Retrieves the data associated with all the memory channels, and rigs memory parameters, by callback.

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:
rig_get_mem_all_cb(), rig_set_mem_all()
Todo:
get all parm's

finish coding and testing of mem_all functions

int rig_set_bank RIG rig,
vfo_t  vfo,
int  bank
 

set the current memory bank

Parameters:
rig The rig handle
vfo The target VFO
bank The memory bank
Sets the current memory bank number. It is not mandatory for the radio to be in memory mode. Actually it depends on rigs. YMMV.

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:
rig_set_mem()

int rig_set_chan_all RIG rig,
const channel_t  chans[]
 

set all channel data

Parameters:
rig The rig handle
chan The location of data to set for all channels
Write the data associated with all the memory channels.

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:
rig_set_chan_all_cb(), rig_get_chan_all()

int rig_set_chan_all_cb RIG rig,
chan_cb_t  chan_cb,
char *  arg
 

set all channel data, by callback

Parameters:
rig The rig handle
chan_cb Pointer to a callback function to provide channel data
arg Arbitrary argument passed back to chan_cb
Write the data associated with a all the memory channels.

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:
rig_set_chan_all(), rig_get_chan_all_cb()

int rig_set_channel RIG rig,
const channel_t chan
 

set channel data

Parameters:
rig The rig handle
chan The location of data to set for this channel
Sets the data associated with a channel. This channel can either be the state of a VFO specified by chan->vfo, or a memory channel specified with chan->vfo = RIG_VFO_MEM and chan->channel_num. See channel_t for more information.

The rig_set_channel is supposed to have no impact on the current VFO and memory number selected. Depending on backend and rig capabilities, the chan struct may not be set completely.

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:
rig_get_channel()

int rig_set_mem RIG rig,
vfo_t  vfo,
int  ch
 

set the current memory channel number

Parameters:
rig The rig handle
vfo The target VFO
ch The memory channel number
Sets the current memory channel number. It is not mandatory for the radio to be in memory mode. Actually it depends on rigs. YMMV.

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:
rig_get_mem()

int rig_set_mem_all RIG rig,
const channel_t  chans[],
const struct confparams  cfgps[],
const value_t  vals[]
 

set all channel and non-channel data

Parameters:
rig The rig handle
chan_cb The callback for channel data
parm_cb The callback for non-channel(aka parm) data
arg Cookie passed to chan_cb and parm_cb
Writes the data associated with all the memory channels, and rigs memory parameters.

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:
rig_get_mem_all(), rig_set_mem_all_cb()
Todo:
set all parm's

finish coding and testing of mem_all functions

int rig_set_mem_all_cb RIG rig,
chan_cb_t  chan_cb,
confval_cb_t  parm_cb,
char *  arg
 

set all channel and non-channel data by call-back

Parameters:
rig The rig handle
chan_cb The callback for channel data
parm_cb The callback for non-channel(aka parm) data
arg Cookie passed to chan_cb and parm_cb
Writes the data associated with all the memory channels, and rigs memory parameters, by callback.

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:
rig_get_mem_all_cb(), rig_set_mem_all()
Todo:
finish coding and testing of mem_all functions


Generated on Sat Sep 30 15:49:37 2006 for Hamlib - the C library reference by  doxygen 1.4.4