devmonitor.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  $RCSfile$
00003                              -------------------
00004     cvs         : $Id: devmonitor.h 376 2007-05-01 12:46:06Z christian $
00005     begin       : Mon Mar 01 2004
00006     copyright   : (C) 2004 by Martin Preuss
00007     email       : martin@libchipcard.de
00008 
00009  ***************************************************************************
00010  *          Please see toplevel file COPYING for license details           *
00011  ***************************************************************************/
00012 
00013 
00014 #ifndef CHIPCARD_SERVER_DEVMONITOR_H
00015 #define CHIPCARD_SERVER_DEVMONITOR_H
00016 
00017 
00018 typedef struct LC_DEVICE LC_DEVICE;
00019 typedef struct LC_DEVSCANNER LC_DEVSCANNER;
00020 typedef struct LC_DEVMONITOR LC_DEVMONITOR;
00021 
00022 
00023 #include <gwenhywfar/idlist.h>
00024 #include <gwenhywfar/misc.h>
00025 #include <gwenhywfar/inherit.h>
00026 #include <gwenhywfar/buffer.h>
00027 
00028 
00029 typedef enum {
00030   LC_Device_BusType_Unknown=-1,
00031   LC_Device_BusType_Any=0,
00032   LC_Device_BusType_UsbRaw,
00033   LC_Device_BusType_UsbTty,
00034   LC_Device_BusType_Pci,
00035   LC_Device_BusType_Pcmcia,
00036   LC_Device_BusType_Serial
00037 } LC_DEVICE_BUSTYPE;
00038 
00039 LC_DEVICE_BUSTYPE LC_Device_BusType_fromString(const char *s);
00040 const char *LC_Device_BusType_toString(LC_DEVICE_BUSTYPE i);
00041 
00042 
00043 GWEN_LIST_FUNCTION_DEFS(LC_DEVICE, LC_Device)
00044 GWEN_INHERIT_FUNCTION_DEFS(LC_DEVSCANNER)
00045 GWEN_LIST_FUNCTION_DEFS(LC_DEVSCANNER, LC_DevScanner)
00046 
00047 
00048 typedef int (*LC_DEVSCANNER_READ_DEVS_FN)(LC_DEVSCANNER *um,
00049                                           LC_DEVICE_LIST *dl);
00050 
00051 
00052 LC_DEVSCANNER *LC_DevScanner_new();
00053 void LC_DevScanner_SetReadDevsFn(LC_DEVSCANNER *um,
00054                                  LC_DEVSCANNER_READ_DEVS_FN fn);
00055 
00056 void LC_DevScanner_free(LC_DEVSCANNER *um);
00057 
00058 int LC_DevScanner_Scan(LC_DEVSCANNER *um,
00059                        LC_DEVICE_LIST *devList);
00060 
00061 
00062 LC_DEVMONITOR *LC_DevMonitor_new();
00063 void LC_DevMonitor_free(LC_DEVMONITOR *um);
00064 
00065 void LC_DevMonitor_AddScanner(LC_DEVMONITOR *um, LC_DEVSCANNER *sc);
00066 
00067 int LC_DevMonitor_Scan(LC_DEVMONITOR *um);
00068 
00069 LC_DEVICE_LIST *LC_DevMonitor_GetNewDevices(const LC_DEVMONITOR *um);
00070 LC_DEVICE_LIST *LC_DevMonitor_GetLostDevices(const LC_DEVMONITOR *um);
00071 LC_DEVICE_LIST *LC_DevMonitor_GetCurrentDevices(const LC_DEVMONITOR *um);
00072 
00073 
00074 
00075 
00076 LC_DEVICE *LC_Device_new(LC_DEVICE_BUSTYPE busType,
00077                          GWEN_TYPE_UINT32 busId,
00078                          GWEN_TYPE_UINT32 deviceId,
00079                          GWEN_TYPE_UINT32 vendorId,
00080                          GWEN_TYPE_UINT32 productId);
00081 void LC_Device_free(LC_DEVICE *ud);
00082 LC_DEVICE *LC_Device_dup(const LC_DEVICE *od);
00083 
00084 
00085 LC_DEVICE *LC_Device_List_Find(LC_DEVICE_LIST *dl,
00086                                LC_DEVICE_BUSTYPE busType,
00087                                GWEN_TYPE_UINT32 busId,
00088                                GWEN_TYPE_UINT32 deviceId,
00089                                GWEN_TYPE_UINT32 vendorId,
00090                                GWEN_TYPE_UINT32 productId);
00091 
00092 LC_DEVICE *LC_Device_Get(LC_DEVICE_LIST *dl,
00093                          LC_DEVICE_BUSTYPE busType,
00094                          GWEN_TYPE_UINT32 dpos);
00095 
00096 
00097 GWEN_TYPE_UINT32 LC_Device_GetDevicePos(const LC_DEVICE *ud);
00098 void LC_Device_SetDevicePos(LC_DEVICE *ud, GWEN_TYPE_UINT32 i);
00099 
00100 const char *LC_Device_GetPath(const LC_DEVICE *ud);
00101 void LC_Device_SetPath(LC_DEVICE *ud, const char *s);
00102 
00103 LC_DEVICE_BUSTYPE LC_Device_GetBusType(const LC_DEVICE *ud);
00104 GWEN_TYPE_UINT32 LC_Device_GetBusId(const LC_DEVICE *ud);
00105 GWEN_TYPE_UINT32 LC_Device_GetDeviceId(const LC_DEVICE *ud);
00106 GWEN_TYPE_UINT32 LC_Device_GetVendorId(const LC_DEVICE *ud);
00107 GWEN_TYPE_UINT32 LC_Device_GetProductId(const LC_DEVICE *ud);
00108 
00109 const char *LC_Device_GetBusName(const LC_DEVICE *ud);
00110 void LC_Device_SetBusName(LC_DEVICE *ud, const char *s);
00111 
00112 const char *LC_Device_GetDeviceName(const LC_DEVICE *ud);
00113 void LC_Device_SetDeviceName(LC_DEVICE *ud, const char *s);
00114 
00115 const char *LC_Device_GetDriverType(const LC_DEVICE *ud);
00116 void LC_Device_SetDriverType(LC_DEVICE *ud, const char *s);
00117 
00118 const char *LC_Device_GetReaderType(const LC_DEVICE *ud);
00119 void LC_Device_SetReaderType(LC_DEVICE *ud, const char *s);
00120 
00121 int LC_Device_ReplaceVars(const LC_DEVICE *d, const char *tmpl,
00122                           GWEN_BUFFER *buf);
00123 
00124 
00125 #endif /* CHIPCARD_SERVER_DEVMONITOR_H */

Generated on Sat Sep 22 04:43:21 2007 for libchipcard2 by  doxygen 1.5.3