Logo Search packages:      
Sourcecode: hamlib version File versions

vprintf_cb_t HAMLIB_API rig_set_debug_callback ( vprintf_cb_t  cb,
rig_ptr_t  arg 
)

set callback to handle debug messages

Parameters:
cb The callback to install
arg A Pointer to some private data to pass later on to the callback
Install a callback for rig_debug messages.
int
rig_message_cb   (enum rig_debug_level_e debug_level,
              rig_ptr_t user_data,
              const char *fmt,
              va_list ap)
{
      char buf[1024];

      sprintf (buf, "Message(%s) ", (char*)user_data);
      syslog (LOG_USER, buf);
      vsprintf (buf, fmt, ap);
      syslog (LOG_USER, buf);

      return RIG_OK;
}

      . . .

      char *cookie = "Foo";
      rig_set_debug_callback (rig_message_cb, (rig_ptr_t)cookie);

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_debug()

Definition at line 185 of file debug.c.

{
      vprintf_cb_t prev_cb = rig_vprintf_cb;

      rig_vprintf_cb = cb;
      rig_vprintf_arg = arg;

      return prev_cb;
}


Generated by  Doxygen 1.6.0   Back to index