メインページ | ネームスペース一覧 | クラス階層 | 構成 | Directories | ファイル一覧 | ネームスペースメンバ | 構成メンバ | ファイルメンバ | 関連ページ

DRUsb20Simple.h

00001 // DRUsb20Simple.h: DRUsb20Simple クラスのインターフェイス
00002 //
00003 //////////////////////////////////////////////////////////////////////
00004 
00005 #ifndef SPR_DRUSB20SIMPLE_H
00006 #define SPR_DRUSB20SIMPLE_H
00007 
00008 #if _MSC_VER > 1000
00009 #pragma once
00010 #endif // _MSC_VER > 1000
00011 
00012 #include "DVCounterBase.h"
00013 #include "DVDaBase.h"
00014 #include "DVPioBase.h"
00015 #include "DRRealDevice.h"
00016 #include <WinBasis/WBWin.h>
00017 
00018 namespace Spr {
00019 
00020 /// CyverseのUSB2.0(LDR-SPIDAR-AMP)のドライバ
00021 class SPR_DLL DRUsb20Simple : public DRRealDevice  
00022 {
00023     /// 仮想デバイス(DA)
00024     class VirtualDeviceDa:public DVDaBase{
00025     protected:
00026         int ch;
00027         DRUsb20Simple* realDevice;
00028         char name[100];
00029     public:
00030         VirtualDeviceDa(DRUsb20Simple* r, int c);
00031         virtual DRRealDevice* RealDevice() { return realDevice; }
00032         virtual void Voltage(float v){ realDevice->Voltage(ch, v); }
00033         virtual void Digit(int v){ realDevice->Digit(ch, v); }
00034         virtual const char* Name() const{ return name; }
00035     };
00036     /// 仮想デバイス(Counter)
00037     class VirtualDeviceCounter:public DVCounterBase{
00038     protected:
00039         int ch;
00040         DRUsb20Simple* realDevice;
00041         char name[100];
00042     public:
00043         VirtualDeviceCounter(DRUsb20Simple* r, int c);
00044         virtual DRRealDevice* RealDevice() { return realDevice; }
00045         /// カウンタ値の設定
00046         virtual void Count(long c){ realDevice->Count(ch, c); }
00047         /// カウンタ値の読み出し
00048         virtual long Count(){ return realDevice->Count(ch); }
00049         /// 名前
00050         virtual const char* Name() const{ return name; }
00051     };
00052     /// 仮想デバイス(Pio)
00053     class VirtualDevicePio:public DVPioBase{
00054     protected:
00055         int ch;
00056         DRUsb20Simple* realDevice;
00057         char name[100];
00058     public:
00059         VirtualDevicePio(DRUsb20Simple* r, int c);
00060         virtual DRRealDevice* RealDevice() { return realDevice; }
00061         virtual void Set(int l){ realDevice->Pio(ch, l!=0); }
00062         virtual int Get(){ return realDevice->Pio(ch) ? 1 : 0; }
00063         virtual const char* Name() const{ return name; }
00064     };
00065 
00066 //----------------------------------------------------------------------------
00067 protected:
00068     char name[100];
00069     int channel;
00070     HANDLE hSpidar;
00071 
00072     int sign[8]; //DA出力用の符号
00073     long count[8];
00074     long countOffset[8];
00075     int daOut[8];
00076     int adIn[8];
00077     int pioLevel[16];
00078 
00079 public:
00080     /// コンストラクタ  chは背面のスイッチになる予定
00081     DRUsb20Simple(int ch);
00082     virtual ~DRUsb20Simple();
00083 
00084     /// デバイスの名前
00085     virtual const char* Name() const { return name; }
00086     /// 初期化
00087     virtual bool Init();
00088     /// 初期化(チャンネル, PIDVIDを気にせずに初期化)
00089     virtual bool InitAny();
00090     /// 仮想デバイスの登録
00091     virtual void Register(DVVirtualDevicePool& vpool);
00092     
00093     /// 電圧出力
00094     void Voltage(int ch, float v);
00095     /// 電圧出力(数値指定)
00096     void Digit(int ch, int v);
00097     /// カウンタ値の設定
00098     void Count(int ch, long c);
00099     /// カウンタ値の読み出し
00100     long Count(int ch);
00101     /// 状態の更新
00102     virtual void Update();
00103     
00104     /// PIOポートの設定
00105     void Pio(int ch, bool level);
00106     /// PIOポートの読み出し
00107     bool Pio(int ch);
00108     /// スイッチ(ポートの上位5-8ビット)の読み出し
00109     int RotarySwitch();
00110 
00111     /// リセット
00112     virtual void Reset();
00113 
00114     /// USBのファイルハンドル
00115     HANDLE GetHandle(){ return hSpidar; };
00116 protected:
00117     virtual void UsbReset();
00118     virtual void UsbCounterGet();
00119     virtual void UsbCounterClear();
00120     virtual void UsbDaSet();
00121     virtual DWORD UsbVidPid(HANDLE h);
00122     virtual bool FindDevice(int ch);
00123     virtual HANDLE UsbOpen(int id);
00124     virtual bool UsbClose(HANDLE& h);
00125 };
00126 
00127 } //namespace Spr
00128 
00129 #endif // SPR_DRUSB20SIMPLE_H

Springheadに対してSun Apr 16 01:57:50 2006に生成されました。  doxygen 1.4.1