示例#1
0
        public OmDevice(Om om, uint deviceId)
        {
            this.om       = om;
            this.deviceId = deviceId;
            validData     = false;

            filename = null;
            port     = null;
            serialId = null;
            try
            {
                StringBuilder filenamesb = new StringBuilder(256);
                if (OmApi.OmGetDataFilename((int)deviceId, filenamesb) == OmApi.OM_OK)
                {
                    filename = filenamesb.ToString();
                    path     = Path.GetDirectoryName(filename);
                }

                StringBuilder pathsb = new StringBuilder(256);
                if (OmApi.OmGetDevicePath((int)deviceId, pathsb) == OmApi.OM_OK)
                {
                    path = pathsb.ToString();
                }

                StringBuilder portsb = new StringBuilder(256);
                if (OmApi.OmGetDevicePort((int)deviceId, portsb) == OmApi.OM_OK)
                {
                    port = portsb.ToString();
                }

                StringBuilder serialIdsb = new StringBuilder(256);
                if (OmApi.OmGetDeviceSerial((int)deviceId, serialIdsb) == OmApi.OM_OK)
                {
                    serialId = serialIdsb.ToString();
                }
            }
            catch (Exception) { Console.Error.WriteLine("ERROR: Problem getting data filename for device " + deviceId + "."); }
        }