libvpb
4.2.61
|
Implementation support found in vpbapi.cpp
.
More...
Classes | |
struct | soft_bridge_info |
struct | VPB_DEV |
Container type for device information. More... | |
Enumerations | |
enum | DevState { VPB_OFF , VPB_ON } |
Device state flags. More... | |
Functions | |
static soft_bridge_info *WINAPI | soft_bridge_new (void) |
static soft_bridge_info *WINAPI | soft_bridge_find (int h1, int h2) |
static soft_bridge_info *WINAPI | soft_bridge_find (int h1) |
static void WINAPI | soft_bridge_delete (soft_bridge_info *bp) |
void | CheckHandle (VPBPortHandle handle, const char *where) |
Check for a valid device handle. More... | |
void | ValidHandleCheck (VPBPortHandle handle) |
const char *WINAPI | vpb_get_driver_version () |
Return the driver version as a string. | |
void WINAPI | vpb_get_driver_version (int *major, int *minor, int *patchlevel) |
Return the driver version as major, minor, and patchlevel components. | |
void WINAPI | vpb_set_global_apiq_size (int size) |
Set the maximum number of events the global APIQ may hold. | |
void WINAPI | vpb_set_channel_apiq_size (int size) |
Set the maximum number of events per-channel APIQ's may hold. | |
void | set_country (int board, int port, const Country *country) |
Set the country data for port on board. | |
static void | set_country (VPBPortHandle handle, const Country *country) |
const Country * | get_country (int board, int port) |
Return the country data for port on board. | |
static const Country * | get_country (VPBPortHandle handle) |
void WINAPI | vpb_set_country (const Country *country) |
Set the global default country specific information. More... | |
int WINAPI | vpb_set_country (VPBPortHandle handle, const Country *country) |
Set the country specific information for an individual port. More... | |
const Country *WINAPI | vpb_get_port_country (VPBPortHandle handle) |
Get the current country data for port handle. | |
const Country *WINAPI | vpb_get_country_data (const std::string &name) |
Get country specific data by name. More... | |
const Country *WINAPI | vpb_get_country_data (int code) |
Get country specific data by numeric country code. More... | |
void | set_ps_impedance (int board, int port, int impedance) |
void | set_vdaa_impedance (int board, int port, int impedance) |
static void | ProcessVPBMessage (uint16_t mess[], unsigned short board) |
static void * | MonitorMessageQueue (void *unused) |
static void | ConfigVPB4 (Comm *c, int b) |
static void | ConfigureVPB (Comm *c, unsigned short numboards) |
static void | init_vpb () |
VPBPortHandle WINAPI | vpb_open (unsigned int board, unsigned int port, VPBOpenMode flags) |
Open a port on some board for use. More... | |
void WINAPI | vpb_reset (VPBPortHandle handle) |
Reset a port back to its idle state (on-hook, not ringing etc.) More... | |
static void | close_port (VPBPortHandle handle) |
static void | CloseVPB (Comm *c, unsigned short numboards) |
int WINAPI | vpb_close (VPBPortHandle handle) |
Close a previously opened port using the handle returned by vpb_open() . More... | |
int WINAPI | vpb_set_event_callback (VPBPortHandle handle, vpb_event_callback callback, void *context) |
Sets an event callback function to use instead of the APIQ . More... | |
int WINAPI | vpb_set_event_mask (VPBPortHandle handle, unsigned long mask) |
Set the event mask for handle. | |
unsigned long WINAPI | vpb_get_event_mask (VPBPortHandle handle) |
Return the current event mask for handle. | |
int WINAPI | vpb_enable_event (VPBPortHandle handle, unsigned long mask) |
Enable the events specified by mask for handle. More... | |
int WINAPI | vpb_disable_event (VPBPortHandle handle, unsigned long mask) |
Disable the events specified by mask for handle. More... | |
int WINAPI | vpb_set_tone_event_mask (VPBPortHandle handle, unsigned long mask) |
Set the TONE event mask. The previous mask value will be overwritten. | |
unsigned long WINAPI | vpb_get_tone_event_mask (VPBPortHandle handle) |
Return the current TONE event mask for handle. | |
int WINAPI | vpb_enable_tone_event (VPBPortHandle handle, unsigned long mask) |
Enable the TONE events specified by mask for handle. More... | |
int WINAPI | vpb_disable_tone_event (VPBPortHandle handle, unsigned long mask) |
Disable the TONE events specified by mask for handle. More... | |
int WINAPI | vpb_put_event (VPB_EVENT *e) |
Places an event on the global and port specific event queues. | |
int WINAPI | vpb_get_event_count_ch (VPBPortHandle handle) |
Returns the number of events on the port specific event queue for handle. | |
int WINAPI | vpb_get_event_count () |
Returns the number of events on the global event queue. | |
void WINAPI | vpb_flush_events (VPBPortHandle handle) |
Clear all unread events from the queue for handle. | |
void WINAPI | vpb_flush_events () |
Clear all unread events from the global event queue. | |
int | putevt (VPB_EVENT *e, unsigned long mask) |
Internal function to place an event on the API event queue. More... | |
int WINAPI | vpb_get_event_async (VPB_EVENT *e) |
Fetch the next event from the global event queue. More... | |
int WINAPI | vpb_get_event_sync (VPB_EVENT *e, unsigned int time_out) |
Wait for an event on the global event queue. More... | |
int WINAPI | vpb_get_event_ch_sync (VPBPortHandle h, VPB_EVENT *e, unsigned int time_out) |
Wait for an event on a port specific event queue. More... | |
int WINAPI | vpb_get_event_ch_async (VPBPortHandle h, VPB_EVENT *e) |
Fetch the next event from a port specific event queue. More... | |
void WINAPI | vpb_sethook_async (VPBPortHandle handle, HookState hookstate) |
Signal a port to set its hook state. Returns immediately. | |
void WINAPI | vpb_sethook_sync (VPBPortHandle handle, HookState hookstate) |
Set the hook state of a port. Waits for it to change before returning. | |
void WINAPI | vpb_set_flashtime (VPBPortHandle handle, uint16_t min, uint16_t max) |
Set the window for detecting flash events on OpenPCI cards. More... | |
void | ring_station_async (int board, int port, int cadence) |
Internal function to control ringing on port of board. | |
void WINAPI | vpb_ring_station_async (VPBPortHandle handle, int cadence) |
Start or stop a station port ringing. More... | |
void WINAPI | vpb_sleep (long time) |
Put the current thread to sleep for some number of milliseconds. | |
int WINAPI | vpb_adpcm_open (void **pv) |
void WINAPI | vpb_adpcm_close (void *pv) |
void WINAPI | vpb_adpcm_reset (void *pv) |
int WINAPI | vpb_adpcm_decode (void *pv, short linear[], unsigned short *size_lin, char adpcm[], unsigned short size_adpcm) |
int WINAPI | vpb_adpcm_encode (void *pv, char adpcm[], unsigned short *size_adpcm, short linear[], unsigned short size_linear) |
int WINAPI | vpb_comp_load (unsigned short board) |
int WINAPI | vpb_echo_canc_force_adapt_on () |
int WINAPI | vpb_echo_canc_force_adapt_off () |
int WINAPI | vpb_echo_canc_enable () |
int WINAPI | vpb_echo_canc_disable () |
int WINAPI | vpb_echo_canc_get_sup_thresh (int handle, short *thresh) |
Get the current echo suppressor threshold. More... | |
int WINAPI | vpb_echo_canc_set_sup_thresh (int handle, short *thresh) |
Set the echo suppressor threshold. More... | |
int | get_driver_type (int board) |
Return the symbolic type of the driver for board. | |
VPB_MODEL | get_board_type (int board) |
Return the symbolic VPB_MODEL type of a board. | |
VPB_MODEL WINAPI | vpb_get_card_type (VPBPortHandle handle) |
Return the board model type for handle. | |
int WINAPI | vpb_get_type (int handle) |
HookState WINAPI | vpb_get_hookstate (VPBPortHandle handle) |
Return the hook state of a port. More... | |
VPB_PORT | get_port_type (int board, int port) |
Return the type of a port on some board. VPB_FXO or VPB_FXS . | |
VPB_PORT WINAPI | vpb_get_port_type (VPBPortHandle handle) |
Return the VPB_PORT type for handle. | |
void | get_board_model (int board, char *s) |
Return a descriptive model name for board in s. | |
std::string WINAPI | vpb_get_model (VPBPortHandle handle) |
Return a string indicating the board model. More... | |
int WINAPI | vpb_get_model (VPBPortHandle handle, char *s) |
Return a string indicating the board model. More... | |
int WINAPI | vpb_get_model (char *s) |
int WINAPI | vpb_get_num_cards () |
Return the number of cards in the system. More... | |
int WINAPI | vpb_get_ports_per_card (int board) |
Return the number of ports on board. More... | |
int WINAPI | vpb_get_ports_per_card () |
void | set_codec_reg (int handle, unsigned short addr, unsigned short data, Comm *c) |
Write directly to a V4PCI codec register. More... | |
void WINAPI | vpb_set_codec_reg (int chdev, unsigned short addr, unsigned short data) |
int WINAPI | vpb_bridge (VPBPortHandle h1, VPBPortHandle h2, BridgeMode mode) |
Create a full duplex bridge between ports h1 and h2. | |
int WINAPI | vpb_bridge (int h1, int h2, BridgeMode mode, int resource) |
int WINAPI | vpb_soft_bridge (int h1, int h2, int mode) |
int WINAPI | vpb_listen (VPBPortHandle h1, VPBPortHandle h2, BridgeMode mode) |
Create a half duplex bridge routing audio from src to dest. | |
int WINAPI | vpb_conf (int h, int resource, int mode) |
int WINAPI | vpb_get_card_info (int board, VPB_CARD_INFO *detail) |
Return detail of the card model and revision for board. | |
int WINAPI | vpb_loopback_on (int h) |
Turns on software loop-back of tx->rx in the kernel. More... | |
int WINAPI | vpb_loopback_off (int h) |
Turns off software loop-back of tx->rx in the kernel. More... | |
int WINAPI | vpb_hostecho_on (int h) |
Enable the host echo canceller for handle. | |
int WINAPI | vpb_hostecho_off (int h) |
Disable the host echo canceller for handle. | |
int WINAPI | vpb_isdn_call (int h, char *number, char *cid, int layer1, int transcap, unsigned char *lowlayercompatibility) |
int WINAPI | vpb_isdn_get_cinfo (int h, VPB_CALL_INFO *cinfo) |
int WINAPI | vpb_isdn_get_layer1 (int h) |
int WINAPI | vpb_isdn_get_transcap (int h) |
int WINAPI | vpb_isdn_get_lowlayercompatibility (int h, unsigned char *lowlayercompatibility) |
int WINAPI | vpb_isdn_get_cause (int h) |
int WINAPI | vpb_isdn_proceeding (int h) |
int WINAPI | vpb_loopvolt_get (int h, short *volts) |
int WINAPI | vpb_loopvolt_get_threshold (int h, short *volts) |
int WINAPI | vpb_loopvolt_set_threshold (int h, short volts) |
int WINAPI | vpb_loopvolt_get_lowlimit (int h, short *volts) |
int WINAPI | vpb_loopvolt_set_lowlimit (int h, short volts) |
int WINAPI | vpb_loop_get_onhookwindow (int h, int *ms) |
int WINAPI | vpb_loop_set_onhookwindow (int h, int ms) |
int WINAPI | vpb_loop_get_offhookwindow (int h, int *ms) |
int WINAPI | vpb_loop_set_offhookwindow (int h, int ms) |
void WINAPI | vpb_set_mprintf (void(*func)(const char *format,...)) |
Specify a function to handle mprintf() logging output. | |
const char * | vpb_model_desc (VPB_MODEL model) |
Return a descriptive string for a VPB_MODEL type. | |
Variables | |
int | soft_bridge_info::h1 |
int | soft_bridge_info::h2 |
Fifo * | soft_bridge_info::txdf1 |
Fifo * | soft_bridge_info::txdf2 |
soft_bridge_info * | soft_bridge_info::next |
DevState | VPB_DEV::devstate |
Flag to indicate if this device has been opened or not. | |
unsigned long | VPB_DEV::evtmask |
The current event mask. | |
unsigned long | VPB_DEV::tonemask |
The current tone event mask. | |
vpb_event_callback | VPB_DEV::event_callback |
Optional event callback. | |
void * | VPB_DEV::context |
User defined context info for event_callback . | |
HostFifo | VPB_DEV::APIQ |
Per channel API event Q object. | |
pthread_mutex_t | VPB_DEV::callback_mutex |
Mutex for atomic access to event_callback and context . | |
static pthread_t | mmq_thread |
GENERIC_CRITICAL_SECTION | SoftBridgeSect |
GENERIC_CRITICAL_SECTION | PutEvtSect |
static VPB_DETECT | toned_dial |
static VPB_DETECT | toned_ringback_aust |
static VPB_DETECT | toned_ringback_308 |
static VPB_DETECT | toned_busy_308 |
static VPB_DETECT | toned_busy_aust |
static VPB_DETECT | toned_grunt |
static VPB_DETECT | toned_ringback_us |
static VPB_DETECT | toned_busy_us |
static VPB_DETECT | toned_fax |
static VPB_TONE | au_ring2 = {400, 425, 450, -13, -13, -13, 400, 2000, &au_ring2} |
static VPB_TONE | au_ring = {400, 425, 450, -13, -13, -13, 400, 200, &au_ring2} |
static VPB_TONE | au_callwaiting2 = {425, 0, 0, -18, 0, 0, 200, 4400, &au_callwaiting2} |
static VPB_TONE | au_callwaiting = {425, 0, 0, -18, 0, 0, 200, 200, &au_callwaiting2} |
static VPB_TONE | au_tones [] |
static VPB_TONE | jp_callwaiting2 = {392, 408, 0, -18, -18, 0, 100, 3000, &jp_callwaiting2} |
static VPB_TONE | jp_callwaiting = {392, 408, 0, -18, -18, 0, 100, 100, &jp_callwaiting2} |
static VPB_TONE | jp_tones [] |
static VPB_TONE | uk_ring2 = {400, 450, 0, -13, -13, 0, 400, 2000, &uk_ring2} |
static VPB_TONE | uk_ring = {400, 450, 0, -13, -13, 0, 400, 200, &uk_ring2} |
static VPB_TONE | uk_congestion2 = {400, 0, 0, -13, 0, 0, 225, 525, &uk_congestion2} |
static VPB_TONE | uk_congestion = {400, 0, 0, -13, 0, 0, 400, 350, &uk_congestion2} |
static VPB_TONE | uk_tones [] |
static VPB_TONE | sg_dial = {425, 0, 0, -15, 0, 0, 0, 0, NULL} |
static VPB_TONE | sg_ring2 = {400, 450, 0, -10, -10, 0, 400, 2000, &sg_ring2} |
static VPB_TONE | sg_ring = {400, 450, 0, -10, -10, 0, 400, 200, &sg_ring2} |
static VPB_TONE | sg_callwaiting2 = {425, 0, 0, -18, 0, 0, 300, 3200, &sg_callwaiting2} |
static VPB_TONE | sg_callwaiting = {425, 0, 0, -18, 0, 0, 300, 200, &sg_callwaiting2} |
static VPB_TONE | sg_stutter8 = {425, 0, 0, -15, 0, 0, 100, 100, &sg_dial} |
static VPB_TONE | sg_stutter7 = {425, 0, 0, -15, 0, 0, 600, 200, &sg_stutter8} |
static VPB_TONE | sg_stutter6 = {425, 0, 0, -15, 0, 0, 200, 200, &sg_stutter7} |
static VPB_TONE | sg_stutter5 = {425, 0, 0, -15, 0, 0, 600, 200, &sg_stutter6} |
static VPB_TONE | sg_stutter4 = {425, 0, 0, -15, 0, 0, 200, 200, &sg_stutter5} |
static VPB_TONE | sg_stutter3 = {425, 0, 0, -15, 0, 0, 600, 200, &sg_stutter4} |
static VPB_TONE | sg_stutter2 = {425, 0, 0, -15, 0, 0, 200, 200, &sg_stutter3} |
static VPB_TONE | sg_stutter1 = {425, 0, 0, -15, 0, 0, 600, 200, &sg_stutter2} |
static VPB_TONE | sg_stutter = {425, 0, 0, -15, 0, 0, 200, 200, &sg_stutter1} |
static VPB_TONE | sg_tones [] |
static VPB_TONE | us_dial = { 350, 440, 0, -13, -13, 0, 0, 0, NULL } |
static VPB_TONE | us_sit2 = {1800, 0, 0, -13, 0, 0, 330, 0, NULL} |
static VPB_TONE | us_sit1 = {1400, 0, 0, -13, 0, 0, 330, 0, &us_sit2} |
static VPB_TONE | us_sit = { 950, 0, 0, -13, 0, 0, 330, 0, &us_sit1} |
static VPB_TONE | us_stutter2 = { 350, 440, 0, -13, -13, 0, 100, 100, &us_dial } |
static VPB_TONE | us_stutter1 = { 350, 440, 0, -13, -13, 0, 100, 100, &us_stutter2 } |
static VPB_TONE | us_stutter = { 350, 440, 0, -13, -13, 0, 100, 100, &us_stutter1 } |
static VPB_TONE | us_tones [] |
static Country | Countries [] |
static const Country * | default_country = &Countries[0] |
Global variables | |
Comm * | vpb_c |
Global Comm object. More... | |
static VPB_DEV * | vpb_dev |
Global VPB_DEV array. | |
static soft_bridge_info * | soft_bridges |
Global soft bridge list head. | |
static HostFifo * | APIQ |
Global API event Q object. | |
static int | Init |
Device initialisation flag. | |
static unsigned short | numboards |
Total number of boards. | |
static unsigned short | Totalchans |
Total number of ports on all boards. | |
static unsigned short | sleepms |
sleep period for threads | |
Constructors | |
VPB_DEV::VPB_DEV () | |
Default constructor. | |
VPB_DEV::~VPB_DEV () | |
Default destructor. | |
Implementation support found in vpbapi.cpp
.
enum DevState |
void CheckHandle | ( | VPBPortHandle | handle, |
const char * | where | ||
) |
Check for a valid device handle.
The handle is valid if the device has been opened with a prior call to vpb_open()
.
VpbException | will be thrown, stating where, if handle is invalid. |
References Totalchans, vpb_dev, and VPB_OFF.
int putevt | ( | VPB_EVENT * | event, |
unsigned long | mask = 0 |
||
) |
Internal function to place an event on the API event queue.
event | The event to place on the API queue. |
mask | The mask to use for this event (set to 0 if not required). |
References APIQ, VPB_DEV::callback_mutex, VPB_DEV::context, VPB_DEV::devstate, VPB_DEV::event_callback, VPB_DEV::evtmask, VPB_EVENT::handle, vpb_dev, and VPB_ON.
void set_codec_reg | ( | int | handle, |
unsigned short | addr, | ||
unsigned short | data, | ||
Comm * | comm | ||
) |
Write directly to a V4PCI
codec register.
handle | The handle returned by a call to vpb_open() . |
addr | 8-bit address of the codec register. |
data | 8-bit data to write to the register. |
comm | The comm object used to send the message. |
Used to set a register of the TS5070 codecs, allows driver-level config of codec, rather than hard-coding in DSP firmware.
References Comm::PutMessageVPB().
Referenced by playrec_open().
int WINAPI vpb_close | ( | VPBPortHandle | handle = VPB_PORTHANDLE_NULL | ) |
Close a previously opened port using the handle returned by vpb_open()
.
handle | The handle returned by a call to vpb_open() . If not specified, this will close all currently open ports. |
VPB_OK
if all goes well. various | exceptions may be thrown in the event of an error. |
int WINAPI vpb_disable_event | ( | VPBPortHandle | handle, |
unsigned long | mask | ||
) |
Disable the events specified by mask for handle.
Events not included in the mask are unaffected.
int WINAPI vpb_disable_tone_event | ( | VPBPortHandle | handle, |
unsigned long | mask | ||
) |
Disable the TONE
events specified by mask for handle.
Events not included in the mask are unaffected.
int WINAPI vpb_echo_canc_get_sup_thresh | ( | int | handle, |
short * | thresh | ||
) |
Get the current echo suppressor threshold.
This threshold is the same for all channels on all cards.
handle | A handle to an open port on the card. |
thresh | The returned echo suppressor threshold value. |
V4PCI
cards. VpbException | will be thrown in the event of an error. |
int WINAPI vpb_echo_canc_set_sup_thresh | ( | int | handle, |
short * | thresh | ||
) |
Set the echo suppressor threshold.
This threshold is the same for all channels on all cards.
handle | A handle to an open port on the card. |
thresh | The echo suppressor threshold value. 0x1000 gives -18db , 0x800 gives -24db , 0x0 for no suppressor. |
V4PCI
cards. VpbException | will be thrown in the event of an error. |
int WINAPI vpb_enable_event | ( | VPBPortHandle | handle, |
unsigned long | mask | ||
) |
Enable the events specified by mask for handle.
Events not included in the mask are unaffected.
int WINAPI vpb_enable_tone_event | ( | VPBPortHandle | handle, |
unsigned long | mask | ||
) |
Enable the TONE
events specified by mask for handle.
Events not included in the mask are unaffected.
const Country* WINAPI vpb_get_country_data | ( | const std::string & | name | ) |
Get country specific data by name.
name | A country name from the list here. |
NULL
if name is not a pre-defined country name. Referenced by VTCore::Reset().
const Country* WINAPI vpb_get_country_data | ( | int | code | ) |
Get country specific data by numeric country code.
code | The ITU-T numeric country calling code. A comprehensive list of the numeric country codes is available here: http://wikipedia.org/wiki/List_of_country_calling_codes |
NULL
if code is not a pre-defined numeric country code. int WINAPI vpb_get_event_async | ( | VPB_EVENT * | event | ) |
Fetch the next event from the global event queue.
This function will always return immediately whether there is an event on the queue or not.
event | The returned event from the queue, if any. |
VPB_OK
if an event is returned, or VPB_NO_EVENTS
if the queue is currently empty.int WINAPI vpb_get_event_ch_async | ( | VPBPortHandle | handle, |
VPB_EVENT * | event | ||
) |
Fetch the next event from a port specific event queue.
This function will always return immediately whether there is an event on the queue or not.
handle | The handle to the port of interest. |
event | The returned event from the queue. |
VPB_OK
if an event is returned, or VPB_NO_EVENTS
if the queue is currently empty.int WINAPI vpb_get_event_ch_sync | ( | VPBPortHandle | handle, |
VPB_EVENT * | event, | ||
unsigned int | time_out = 0 |
||
) |
Wait for an event on a port specific event queue.
This function will return immediately if there is already an event on the queue, else it will block until one arrives or the time out expires.
handle | The handle to the port of interest. |
event | The returned event from the queue. |
time_out | An optional maximum time to wait, in milliseconds. If the time_out is set to 0 this function will block indefinitely until an event arrives. |
VPB_OK
if an event occurred, or VPB_TIME_OUT
if time_out elapsed with no event to return.int WINAPI vpb_get_event_sync | ( | VPB_EVENT * | event, |
unsigned int | time_out = 0 |
||
) |
Wait for an event on the global event queue.
This function will return immediately if there is already an event on the queue, else it will block until one arrives or the time out expires.
event | The returned event from the queue. |
time_out | An optional maximum time to wait, in milliseconds. If the time_out is set to 0 this function will block indefinitely until an event arrives. |
VPB_OK
if an event occurred, or VPB_TIME_OUT
if time_out elapsed with no event to return.HookState WINAPI vpb_get_hookstate | ( | VPBPortHandle | handle | ) |
Return the hook state of a port.
handle | The handle of the port to query. |
VPB_ONHOOK
or VPB_OFFHOOK
if the query succeeds. VpbException | will be thrown in the event of an error. |
std::string WINAPI vpb_get_model | ( | VPBPortHandle | handle | ) |
Return a string indicating the board model.
handle | The handle to a port on the board to query. |
VpbException | will be thrown if the handle is invalid. |
vpb_get_card_type()
function instead. int WINAPI vpb_get_model | ( | VPBPortHandle | handle, |
char * | str | ||
) |
Return a string indicating the board model.
handle | The handle to a port on the board to query. |
str | The returned model string. |
VPB_OK
if the handle is valid. VpbException | may be thrown if the handle is invalid. |
vpb_get_card_type()
function instead. int WINAPI vpb_get_num_cards | ( | ) |
Return the number of cards in the system.
vpb_open()
. Referenced by get_total_port_count().
int WINAPI vpb_get_ports_per_card | ( | int | board | ) |
Return the number of ports on board.
board | The board number, starting from 0. |
vpb_open()
. Referenced by get_total_port_count().
int WINAPI vpb_loopback_off | ( | int | handle | ) |
Turns off software loop-back of tx->rx in the kernel.
Useful for echo testing.
handle | The handle of the port to disable loopback operations. |
VPB_OK
if all went well. various | exceptions may be thrown if all did not go well. |
int WINAPI vpb_loopback_on | ( | int | handle | ) |
Turns on software loop-back of tx->rx in the kernel.
Useful for echo testing.
handle | The handle of the port to enable loopback operations. |
VPB_OK
if all went well. various | exceptions may be thrown if all did not go well. |
VPBPortHandle WINAPI vpb_open | ( | unsigned int | board, |
unsigned int | port, | ||
VPBOpenMode | flags = VPB_OPEN_DEFAULTS |
||
) |
Open a port on some board for use.
board | The board number, starting from 0. |
port | The port number on board, starting from 0. |
flags | The VPBOpenMode flags which indicate additional operations to perform when opening the port. |
vpb_open
is called to open the first port it performs a number of static initialisation tasks that will run in the background. Those tasks may not have completed by the time vpb_open returns to the caller. For most applications, they will have had plenty of time to complete by the time any other ports have been opened and any app specific initialisation has been performed, but for very trivial applications you may need to delay briefly before performing subsequent operations on the port. You should likewise avoid repeatedly opening and closing single ports in a tight loop. Such code will perform much more efficiently if you simply open all the ports that you require to access, then call vpb_close()
(without any handle parameter) to close them all again when you are done with them, as the bulk of the initialisation will only be run for the first call to vpb_open
in that case, and will not need to be repeated while any ports continue to remain open. void WINAPI vpb_reset | ( | VPBPortHandle | handle = VPB_PORTHANDLE_NULL | ) |
Reset a port back to its idle state (on-hook, not ringing etc.)
handle | The handle returned by a call to vpb_open() . If not specified, then all open ports will be reset. |
The precise action performed depends on the type of port that handle refers to, but after this call it should be in the same state as it would be when initially powered up from a cold start.
Any hardware gains will be restored to their default levels, or to the levels specified if configuration files are present.
The locale specific hardware configuration will be reset according to (in order of priority):
vpb_set_country()
.country
value specified in the configuration files.VPB_COUNTRY
environment variable.AUSTRALIA
). void WINAPI vpb_ring_station_async | ( | VPBPortHandle | handle, |
int | cadence = -1 |
||
) |
Start or stop a station port ringing.
handle | The handle of the port to control. |
cadence | The ring cadence value. |
If the cadence parameter is not specified, the default cadence for a normal ring according to the port's country setting will be used. The valid cadence values are defined as follows:
0
- Stop ringing.1
- Ring a guard tone cadence. Often used before sending caller id.2
- Normal ring for Australian phone networks. (DR0
)3-9
- DR1
to DR7
of the AS/ACIF
S002:2001 distinctive ring series.10
- US ring cadence.There is an additional special ring cadence 255
, which like 0
, stops the station ringing, but in addition will signal an OpenPCI FXS
port to enter a mode where caller id information can be transmitted to a handset that is still on hook. ie. for US style caller id, you would generate one second of cadence 1
tone, stopped by a cadence 255
signal. The caller id tones can then be sent, and normal ringing commenced using cadence 2
- 10
. Convenience functions to do this are provided with the CTPort interface to ctserver.
1
- 10
will all cause its normal ring cadence to be generated.void WINAPI vpb_set_country | ( | const Country * | country | ) |
Set the global default country specific information.
This data will be used for ports that have not had their country data set individually. If country is NULL
it will restore the initial hardcoded default country settings (ie. AUSTRALIA
).
int WINAPI vpb_set_country | ( | VPBPortHandle | handle, |
const Country * | country | ||
) |
Set the country specific information for an individual port.
This will override the default country data for handle. If country is NULL
, then handle will revert to using the global default data.
int WINAPI vpb_set_event_callback | ( | VPBPortHandle | handle, |
vpb_event_callback | callback, | ||
void * | context = NULL |
||
) |
Sets an event callback function to use instead of the APIQ
.
handle | The handle returned by a call to vpb_open() . |
callback | A pointer to the function to call, or NULL to disable the use of a callback for this port again. |
context | An optional pointer to user defined data that will be passed to the callback function. |
By default no event callback functions are set, and events are posted to the API event queues. If a callback is set using this function for some port, it will be called with the event as an argument instead of placing it in the queue.
Any event which is processed after this function returns will be subject to the new callback state, however since events are buffered at the kernel driver level, this may also include some events that occurred before the call was made, but which had not been processed at that time.
void WINAPI vpb_set_flashtime | ( | VPBPortHandle | handle, |
uint16_t | min, | ||
uint16_t | max | ||
) |
Set the window for detecting flash events on OpenPCI cards.
For FXS ports, this is automatically configured according to the locale specific values in the Country
structure. For FXO ports, flash events are only generated if this function has been explicitly called (this is to maintain compatibility with older applications which manually processed the raw on/off hook events themselves).
handle | The handle of the port to configure. |
min | The minimum on-hook time for a valid flash signal in ms . |
max | The maximum on-hook time for a valid flash signal in ms . |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
|
static |
Comm* vpb_c |
Global Comm
object.
Pointer to the global comm object.
Referenced by get_board_model(), get_board_type(), get_country(), get_driver_type(), get_port_type(), play_reset_hw_gain(), playrec_open(), record_reset_hw_gain(), VTCore::Reset(), ring_station_async(), set_country(), V4PCI_DSP::SetHookState(), and OpenPri::SetHookState().