HMP学习-srl相关函数-sr_getboardcnt( ) |
函数原型:long sr_getboardcnt(char* class_namep,int* boardcntp)
参数:指向类名的指针,记录主板卡的数目
返回值:0成功 -1失败
作用:仅仅用在windows平台。返回特定类型的板卡资源数量。
#include <windows.h> #include <srllib.h> #include <dxxxlib.h> long chdev[MAXDEVS]; long evt_handle; main( ... ) { char channel_name[12], board_name[12]; int brd_handle; int brd, ch, devcnt = 0; int numvoxbrds = 0; if ( sr_getboardcnt(DEV_CLASS_VOICE, &numvoxbrds) == -1) { /* erro
|
阅读全文(2489) | 回复(0) | 编辑 | 精华 | 删除 |
HMP学习-srl相关函数-sr_enbhdlr( ) |
函数原型:long sr_enbhdlr(long dev,long evt_type, handler)
Linux: long (*handler)( ) Windows: long (*handler) (unsigned long parm)
参数:设备句柄,事件类型,事件处理函数
返回值:0成功 -1失败
作用:让事件处理函数开始监听事件
示例程序:
#include <srllib.h> #include <dxxxlib.h> /* LINUX: set up handler */ long int dx_handler(void* pData) { printf( "dx_handler() called, event is 0x%x\n", sr_getevttype()); return( 0 ); /* tell SRL to dispose of the event */ } m
|
阅读全文(2566) | 回复(0) | 编辑 | 精华 | 删除 |
HMP学习-srl相关函数-sr_dishdlr( ) |
函数原型:long sr_dishdlr(long dev,long evt_type, handler)
Linux: long (*handler)( ) Windows: long (*handler) (unsigned long parm)
参数:设备句柄,事件类型,事件处理函数
返回值:0成功 -1失败
作用:让一个事件处理函数不在起作用。
示例程序:
#include <srllib.h> #include <dxxxlib.h> #include <cstdio> using namespace std; /* LINUX: set up handler */ long int dx_handler(void * pdata){ printf( "dx_handler() called, event is 0x%x\n", sr_getevttype())
|
阅读全文(2164) | 回复(0) | 编辑 | 精华 | 删除 |
HMP学习-srl相关函数-sr_GetThreadDeviceGroup( ) |
函数原型:
Linux long sr_GetThreadDeviceGroup (long *Devices,int *NumDevices) Windows int sr_GetThreadDeviceGroup (long *Devices,int *NumDevices)
参数:设备指针,设备个数
返回值:0成功 -1失败
作用:返回该线程创建的所有设备句柄。
示例程序:
#define MAX_DEVICES 96 #define DEVICES_PER_TRUNK 24
EventPollThread () { long Devices [MAX_DEVICES]; int DevNum, index; long EventHandle; for (DevNum = 0; DevNum < DEVICES_PER_TRUNK; DevNum++) { Devices [Dev
|
阅读全文(1642) | 回复(0) | 编辑 | 精华 | 删除 |
HMP学习-srl相关函数-sr_DeleteThreadDeviceGroup( ) |
函数原型:
Linux long sr_DeleteThreadDeviceGroup(void) Windows int sr_DeleteThreadDeviceGroup(void)
参数:空
返回值:0成功 -1 失败
作用:移除所有的该线程创建的设备句柄组。
示例程序:
EventPollThread () long Devices [24]; int DevNum; long EventHandle; for (DevNum = 0; DevNum < 24; DevNum++) Devices [DevNum] = dx_open(...); sr_CreateThreadDeviceGroup (Devices); while (1) sr_WaitThreadDeviceGroup (-1); // do something with the event if (done
|
阅读全文(2024) | 回复(0) | 编辑 | 精华 | 删除 |
HMP学习-srl相关函数-sr_CreateThreadDeviceGroup( ) |
函数原型:
Linux long sr_CreateThreadDeviceGroup (long *Devices,int NumDevices) Windows int sr_CreateThreadDeviceGroup (long *Devices,int NumDevices)
参数:设备句柄指针。设备句柄个数。
返回值:0成功 -1失败
示例程序:
EventPollThread () { long Devices [24]; int DevNum; long EventHandle; for (DevNum = 0; DevNum < 24; DevNum++) { Devices [DevNum] = dx_open(...); } sr_CreateThreadDeviceGroup (Devices, 24); while (1) { sr_WaitThreadDeviceGroup (-1); |
阅读全文(1694) | 回复(0) | 编辑 | 精华 | 删除 |
HMP学习-srl相关函数-sr_AddToThreadDeviceGroup( ) |
函数原型:
Linux long sr_AddToThreadDeviceGroup (long *evices, int NumDevices) Windows: int sr_AddToThreadDeviceGroup (long *evices,int NumDevices)
参数:一列设备句柄列表的头指针。设备列表中设备句柄的个数。
返回值:0成功 -1失败
示例程序;
EventPollThread () { long Devices [24]; int DevNum; long EventHandle; for (DevNum = 0; DevNum < 24; DevNum++) { Devices [DevNum] = dx_open(...); } sr_CreateThreadDeviceGroup (Devices); while (1) { sr_WaitThreadDeviceG
|
阅读全文(2046) | 回复(0) | 编辑 | 精华 | 删除 |
HMP学习-srl相关函数-ATDV_SUBDEVS() |
函数原型:long ATDV_SUBDEVS(int dev)
参数:设备句柄
返回值:设备句柄的子设备的数目
示例程序:
#include <srllib.h> #include <dxxxlib.h> int main() { int dxxxdev; /* Open a dxxx channel device */ if(( dxxxdev = dx_open( "dxxxB1", 0 )) == -1 ) { &n
|
阅读全文(1643) | 回复(0) | 编辑 | 精华 | 删除 |
HMP学习-srl相关函数-ATDV_NAMEP() |
函数原型:char * ATDV_NAMEP(int dev)
参数:设备句柄
返回值:用来打开这个设备的字符串。设备名例如: • dxxxBbCc
• dtiBbTt
b 代表系统中的板卡号。
c 代表真实或虚拟D/4x板卡中的频道号
t 表示数字网络接口中的时间片序号
示例程序:
#include <srllib.h> #include <dxxxlib.h> int main(){ int dxxxdev; /* Open a dxxx channel device */ if(( dxxxdev =
|
阅读全文(1634) | 回复(0) | 编辑 | 精华 | 删除 |
HMP学习-srl相关函数-ATDV_LASTERR() |
函数原型:long ATDV_LASTERR(int dev)
参数:设备句柄
返回值:句柄无效Linux返回EDV_BADDESC Windows返回 AT_FAILURE,否则返回一个错误代码。错误代码在DEVICElib.h中定义。
示例程序:
#include <srllib.h> #include <dxxxlib.h> int main(){ int dxxxdev; int parm = ET_RON; /* Open dxxx channel device */ if(( dxxxdev = dx_
|
阅读全文(1679) | 回复(0) | 编辑 | 精华 | 删除 |
|
« | September 2025 | » | 日 | 一 | 二 | 三 | 四 | 五 | 六 | | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | | | | | |
|
Blog信息 |
blog名称: 日志总数:33 评论数量:61 留言数量:-8 访问次数:236455 建立时间:2006年4月27日 | |

|