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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92
|
// UsbOtdrAPI.h: interface for the UsbOtdrAPI class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_USBOTDRAPI_H__34C59198_66E1_4A1D_93AA_CFD402024F67__INCLUDED_)
#define AFX_USBOTDRAPI_H__34C59198_66E1_4A1D_93AA_CFD402024F67__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class __declspec(dllexport) UsbOtdrAPI
{
private:
void cleanUp();
private:
// scan parameters
//int scanMode; // 0=Realtime scan, 1=Averaging scan
//int scanRange; // 6, 14, 30, 60, 120, 240 km
//int avgSeconds; // average time for averaging scan, 6 - 600 seconds
//int waveLength; // 1310, 1490, 1550, 1625 nm
//int pulseWidth; // 10, 30, 100, 300, 1000, 3000, 10000, 20000 ns
//double IOR; // index of refraction, default 1.4700
// scanning result
//int points; // number of trace points
//double *pixels; // trace data, in dB
// Event detection parameters
//int sensitivity; // low, medium, high
public:
// attribute accessing functions
int setScanMode(int sm = 0); // default real-time scan, return 0=success
int getScanMode(); // return -1=failed
int setScanRange(int sr = 6); // default 0=6 km, return 0=success
int getScanRange(); // return -1=failed
int setAvgSeconds(int as = 30); // default 30 seconds, return 0=success
int getAvgSeconds(); // return -1=failed
int getRemainingSeconds(); // return -1=failed
int setWaveLength(int wl = 1310); // default 1310nm, return 0=success
int getWaveLength(); // return -1=failed
int setPulseWidth(int pw = 10); // default 10ns, return 0=success
int getPulseWidth(); // return -1=failed
int setIOR(double i = 1.47l); // default=1.47, return 0=success
double getIOR(); // return 0.0=failed
int setSensitivity(int s = 0); // default=0(low), 1=medium, 2=high
int getSensitivity(); // return -1=failed
// scanning result
int getNumberOfPixels(); // return the number of data points
int getPixels(double *pix); // user must supply the allocated memory buffer
double kmperpixel(); // distance per pixel, unit: km
int getNumberOfEvents(); // return the number of detected events
int getEvents(void *buf); // copy the event table into caller provided buffer
public:
// API functions
virtual void Initilization();// all attributes accessible/legal after this
virtual void startScan(); // lpfn is used to notify scan status
virtual void stopScan(); // kill scanning process before it completes
virtual void Close(); // all attributes invalid after this
// SOR file function
public:
virtual void opensor(char *filename);
virtual void savesor(char *filename);
// status
private:
int error; // last status
char *errmsg; // if error is true, this is the reason
void eventDetection(); // build event table
public:
void setErrmsg(char *str);
void setErrNo(int err);
int getError(); // return -1=failed, 0 = success, others with errmsg
int getErrMsg(char *buf); // return -1=failed.
public:
// default constructor and destructor
UsbOtdrAPI();
~UsbOtdrAPI();
private:
bool knowSplitter; // enable splitter detection
};
#endif // !defined(AFX_USBOTDRAPI_H__34C59198_66E1_4A1D_93AA_CFD402024F67__INCLUDED_)
|