Пример #1
0
 public InputDialog(string text, string hint = hint, InputDataType type = InputDataType.String) : base(0.30, 0.30)
 {
     Hint  = hint;
     Dtype = type;
     init();
     label2.Text = text; //0xE8C9
 }
Пример #2
0
 public override bool IsEntireEntityBodyIsPreloaded()
 {
     if (_inputDataType == InputDataType.Unknown)
     {
         _inputDataType = (InputDataType)MonoInternal.GetInputDataType(_request);
     }
     return(_inputDataType == InputDataType.Memory);
 }
 private AbstractSectorDataFile CreateHeaderDataFile(string fullPath, InputDataType inputDataType)
 {
     return(new HeaderDataFile(
                fullPath,
                this.streamFactory,
                SectorDataReaderFactory.Create(inputDataType)
                ));
 }
Пример #4
0
 public void TestItReturnsCorrectParser(InputDataType dataType, Type expectedParserType)
 {
     Assert.Equal(
         expectedParserType,
         factory.GetParserForFile(
             SectorDataFileFactoryFactory.Make(new List <string>()).Create("Test", dataType)
             ).GetType()
         );
 }
Пример #5
0
        public int SendDataReportMode(InputDataType mode)
        {
            if (mode == InputDataType.STATUS_INFO || mode == InputDataType.READ_MEMORY_REGISTERS)
            {
                Debug.LogError("Passed " + mode.ToString() + " to SendDataReportMode!");
                return(-2);
            }

            return(SendWithType(OutputDataType.DATA_REPORT_MODE, new byte[] { 0x00, (byte)mode }));
        }
Пример #6
0
 public static DataConverterBase GetInstance(InputDataType dataType)
 {
     switch (dataType)
     {
         case InputDataType.Json:
             return new JsonDataConverter();
         case InputDataType.DataRow:
             return new DataRowDataConverter();
     }
     throw new Exception("Unknow Data Type.");
 }
Пример #7
0
        public MonoWorkerRequest(string root, string vroot, IntPtr request, IntPtr response)
            : base(string.Empty, string.Empty, null)
        {
            _root          = root;
            _vroot         = vroot;
            _request       = request;
            _response      = response;
            _inputDataType = InputDataType.Unknown;
            _offset        = 0;

            InitRequestHeader();
        }
 public InputEvent(object inputData, List<Enums.VirtualKeyCode> modifiers, string inputDataStringRepresentation, InputDataType inputDataType, InputType inputType, int cycleCount = 1, int duration = 0)
 {
     if (inputDataType == InputDataType.VirtualKey)
         InputData = (VirtualKeyCode)(Enums.VirtualKeyCode)inputData;
     else
         InputData = inputData;
     Modifiers = modifiers != null ? modifiers.Select(item => (VirtualKeyCode)item).ToList() : null;
     InputDataStringRepresentation = inputDataStringRepresentation;
     InputDataType = inputDataType;
     InputType = inputType;
     CycleCount = cycleCount;
     Duration = duration;
 }
Пример #9
0
        /// \brief Sets the Data Reporting mode of the Wii Remote.
        /// \param mode The data reporting mode desired.  This can be any InputDataType except for
        ///         InputDataType::STATUS_INFO, InputDataType::READ_MEMORY_REGISTERS, or InputDataType::ACKNOWLEDGE_OUTPUT_REPORT.
        ///         Said data types are not data reporting modes so it doesn't make sense to use them here.
        /// \return On success, the total size of the data written (> 0), <= 0 on failure.
        /// \sa SendWithType(OutputDataType, byte[])
        public int SendDataReportMode(InputDataType mode)
        {
            if (mode == InputDataType.STATUS_INFO || mode == InputDataType.READ_MEMORY_REGISTERS || mode == InputDataType.ACKNOWLEDGE_OUTPUT_REPORT)
            {
                Debug.LogError("Passed " + mode.ToString() + " to SendDataReportMode!");
                return(-2);
            }

            last_report_type = mode;

            ExpectingSecondInterleavedPacket = false;

            return(SendWithType(OutputDataType.DATA_REPORT_MODE, new byte[] { 0x00, (byte)mode }));
        }
Пример #10
0
 public FileListInclusionRule(
     IEnumerable <string> fileList,
     bool ignoreMissing,
     string exceptWhereExists,
     InputDataType inputDataType,
     OutputGroup outputGroup
     )
 {
     this.FileList          = fileList;
     this.IgnoreMissing     = ignoreMissing;
     this.ExceptWhereExists = exceptWhereExists;
     this.InputDataType     = inputDataType;
     this.outputGroup       = outputGroup;
 }
Пример #11
0
        /// The size, in bytes, of a given Wii Remote InputDataType when reported by the Wiimote.
        ///
        /// This is at most 21 bytes.
        public static int GetInputDataTypeSize(InputDataType type)
        {
            switch (type)
            {
            case InputDataType.STATUS_INFO:
                return(6);

            case InputDataType.READ_MEMORY_REGISTERS:
                return(21);

            case InputDataType.ACKNOWLEDGE_OUTPUT_REPORT:
                return(4);

            case InputDataType.REPORT_BUTTONS:
                return(2);

            case InputDataType.REPORT_BUTTONS_ACCEL:
                return(5);

            case InputDataType.REPORT_BUTTONS_EXT8:
                return(10);

            case InputDataType.REPORT_BUTTONS_ACCEL_IR12:
                return(17);

            case InputDataType.REPORT_BUTTONS_EXT19:
                return(21);

            case InputDataType.REPORT_BUTTONS_ACCEL_EXT16:
                return(21);

            case InputDataType.REPORT_BUTTONS_IR10_EXT9:
                return(21);

            case InputDataType.REPORT_BUTTONS_ACCEL_IR10_EXT6:
                return(21);

            case InputDataType.REPORT_EXT21:
                return(21);

            case InputDataType.REPORT_INTERLEAVED:
                return(21);

            case InputDataType.REPORT_INTERLEAVED_ALT:
                return(21);
            }
            return(0);
        }
Пример #12
0
        // The size, in bytes, of a given Wiimote InputDataType when reported by the Wiimote.
        // This is at most 21 bytes.
        public static int GetInputDataTypeSize(InputDataType type)
        {
            switch (type)
            {
            case InputDataType.STATUS_INFO:
                return(6);

            case InputDataType.READ_MEMORY_REGISTERS:
                return(21);

            case InputDataType.REPORT_BUTTONS_IR10_EXT9:
                return(21);

            case InputDataType.REPORT_BUTTONS_ACCEL_IR10_EXT6:
                return(21);
            }
            return(0);
        }
Пример #13
0
        public HttpRequestResult <bool> ValidateInputDataTypes()
        {
            if (InputDataType.Count() == Rule.LeftSide.Count())
            {
                return(new HttpRequestResult <bool>(true));
            }

            if (InputDataType.Count() > Rule.LeftSide.Count())
            {
                return(new HttpRequestResult <bool>("Per daug antecedentų."));
            }

            if (InputDataType.Count() < Rule.LeftSide.Count())
            {
                return(new HttpRequestResult <bool>("Nepakankamai antecedentų."));
            }

            return(new HttpRequestResult <bool>("Netinkami antecedentai."));
        }
 public FolderInclusionRule(
     string folder,
     bool recursive,
     InputDataType inputDataType,
     OutputGroup outputGroup,
     bool excludeList = true,
     List <string> includeExcludeFiles = null,
     Regex includePattern = null
     )
 {
     Folder              = folder;
     Recursive           = recursive;
     InputDataType       = inputDataType;
     this.outputGroup    = outputGroup;
     IncludePattern      = includePattern;
     ExcludeList         = excludeList;
     IncludeExcludeFiles = includeExcludeFiles != null
         ? includeExcludeFiles.ToList()
         : new List <string>();
 }
 public static AbstractSectorDataReader Create(InputDataType dataType)
 {
     return(dataType switch
     {
         InputDataType.ESE_AGREEMENTS => new EseSectorDataReader(),
         InputDataType.ESE_FREETEXT => new EseSectorDataReader(),
         InputDataType.ESE_GROUND_NETWORK => new EseSectorDataReader(),
         InputDataType.ESE_POSITIONS_MENTOR => new EseSectorDataReader(),
         InputDataType.ESE_OWNERSHIP => new EseSectorDataReader(),
         InputDataType.ESE_POSITIONS => new EseSectorDataReader(),
         InputDataType.ESE_PRE_POSITIONS => new EseSectorDataReader(),
         InputDataType.ESE_SECTORLINES => new EseSectorDataReader(),
         InputDataType.ESE_SIDS => new EseSectorDataReader(),
         InputDataType.ESE_STARS => new EseSectorDataReader(),
         InputDataType.ESE_VRPS => new EseSectorDataReader(),
         InputDataType.RWY_ACTIVE_RUNWAY => new EseSectorDataReader(),
         InputDataType.SCT_AIRPORT_BASIC => new SctSectorDataReader(),
         InputDataType.SCT_ARTCC => new SctSectorDataReader(),
         InputDataType.SCT_ARTCC_HIGH => new SctSectorDataReader(),
         InputDataType.SCT_ARTCC_LOW => new SctSectorDataReader(),
         InputDataType.SCT_COLOUR_DEFINITIONS => new SctSectorDataReader(),
         InputDataType.SCT_RUNWAY_CENTRELINES => new SctSectorDataReader(),
         InputDataType.SCT_FIXES => new SctSectorDataReader(),
         InputDataType.SCT_GEO => new SctSectorDataReader(),
         InputDataType.SCT_INFO => new SctSectorDataReader(),
         InputDataType.SCT_LABELS => new SctSectorDataReader(),
         InputDataType.SCT_NDBS => new SctSectorDataReader(),
         InputDataType.SCT_REGIONS => new SctSectorDataReader(),
         InputDataType.SCT_RUNWAYS => new SctSectorDataReader(),
         InputDataType.SCT_SIDS => new SctSectorDataReader(),
         InputDataType.SCT_STARS => new SctSectorDataReader(),
         InputDataType.SCT_LOWER_AIRWAYS => new SctSectorDataReader(),
         InputDataType.SCT_UPPER_AIRWAYS => new SctSectorDataReader(),
         InputDataType.SCT_VORS => new SctSectorDataReader(),
         InputDataType.FILE_HEADERS => new FileHeaderDataReader(),
         _ => throw new ArgumentException("Unknown data type for SectorDataReaderFactory")
     });
Пример #16
0
 /// The size, in bytes, of a given Wii Remote InputDataType when reported by the Wiimote.
 ///
 /// This is at most 21 bytes.
 public static int GetInputDataTypeSize(InputDataType type)
 {
     switch (type)
     {
         case InputDataType.STATUS_INFO:
             return 6;
         case InputDataType.READ_MEMORY_REGISTERS:
             return 21;
         case InputDataType.ACKNOWLEDGE_OUTPUT_REPORT:
             return 4;
         case InputDataType.REPORT_BUTTONS:
             return 2;
         case InputDataType.REPORT_BUTTONS_ACCEL:
             return 5;
         case InputDataType.REPORT_BUTTONS_EXT8:
             return 10;
         case InputDataType.REPORT_BUTTONS_ACCEL_IR12:
             return 17;
         case InputDataType.REPORT_BUTTONS_EXT19:
             return 21;
         case InputDataType.REPORT_BUTTONS_ACCEL_EXT16:
             return 21;
         case InputDataType.REPORT_BUTTONS_IR10_EXT9:
             return 21;
         case InputDataType.REPORT_BUTTONS_ACCEL_IR10_EXT6:
             return 21;
         case InputDataType.REPORT_EXT21:
             return 21;
         case InputDataType.REPORT_INTERLEAVED:
             return 21;
         case InputDataType.REPORT_INTERLEAVED_ALT:
             return 21;
     }
     return 0;
 }
Пример #17
0
    /// \brief Sets the Data Reporting mode of the Wii Remote.
    /// \param mode The data reporting mode desired.  This can be any InputDataType except for
    ///         InputDataType::STATUS_INFO, InputDataType::READ_MEMORY_REGISTERS, or InputDataType::ACKNOWLEDGE_OUTPUT_REPORT.
    ///         Said data types are not data reporting modes so it doesn't make sense to use them here.
    /// \return On success, the total size of the data written (> 0), <= 0 on failure.
    /// \sa SendWithType(OutputDataType, byte[])
    public int SendDataReportMode(InputDataType mode)
    {
        if (mode == InputDataType.STATUS_INFO || mode == InputDataType.READ_MEMORY_REGISTERS || mode == InputDataType.ACKNOWLEDGE_OUTPUT_REPORT)
        {
            Debug.LogError("Passed " + mode.ToString() + " to SendDataReportMode!");
            return -2;
        }

        last_report_type = mode;

        ExpectingSecondInterleavedPacket = false;

        return SendWithType(OutputDataType.DATA_REPORT_MODE, new byte[] { 0x00, (byte)mode });
    }
Пример #18
0
 public ElementForInputData(string inputEvent, InputDataType inputDataType)
 {
     this.inputEvent    = inputEvent;
     this.inputDataType = inputDataType;
 }
Пример #19
0
 public DryFilmCost(object data, InputDataType dataType)
     : base(data, dataType)
 {
 }
Пример #20
0
 public OtherRateCost(object data, InputDataType dataType)
     : base(data, dataType)
 {
 }
Пример #21
0
 public BOMCost(object data, InputDataType dataType)
     : base(data, dataType)
 {
 }
Пример #22
0
 public void SetDataHint(InputDataType data, string hint, int hintColor = 0xD3D3D3, int textColor = 0x000000)
 {
     DataType = data;
     SetHint(hint, hintColor, textColor);
 }
Пример #23
0
    public void ReceiveInput(InputDataType type, object inputData)
    {
        //Debug.Log($"received input in player: {type},{inputData}");
        switch (type)
        {
        case InputDataType.orientation:
            if (activateLogging)
            {
                Debug.Log($"device orientation {gameObject.name}, {(Vector3)inputData}");
            }
            if (sinInitialRotation == float.MinValue)
            {
                Debug.Log("calculating new initial pos");
                sinInitialRotation = Mathf.Cos(((Vector3)inputData).x * Mathf.Deg2Rad);
            }
            //TODO: find a fix for holding phone inverted.
            float sinRotation = Mathf.Cos(((Vector3)inputData).x * Mathf.Deg2Rad);

            currentRotation = Mathf.Clamp(sinRotation - sinInitialRotation, -steeringRangeInPercent, steeringRangeInPercent) / steeringRangeInPercent;
            //Debug.Log($"calculated deviceorientation {((Vector3)inputData).x}, {sinRotation} - {sinInitialRotation} : +-{steeringRangeInPercent}= {currentRotation}");
            break;

        case InputDataType.tap:
            //Debug.Log($"received string {(string)inputData}");
            switch ((string)inputData)
            {
            case "tap-area-boost":
                if (canBoost)
                {
                    boostActive = true;
                    canBoost    = false;
                    playerManager.SendMessageToClient(this, PlayerClientAction.boost_activated);
                    Invoke("ReactivateBoost", reactivateBoostTime);
                }
                break;

            case "tap-area-stealth":
                if (canActivateStealth)
                {
                    EnableStealth();
                }
                break;

            case "tap-area-fire":
                if (projectileReady)
                {
                    projectile.Fire(transform.position, transform.rotation);
                    projectileReady = false;
                    playerManager.SendMessageToClient(this, PlayerClientAction.fire_activated);
                }
                break;

            case "tap-area-reset_orientation":
                sinInitialRotation = float.MinValue;
                break;

            default:
                //do nothing, tap not recognized.
                break;
            }
            break;

        case InputDataType.proximity:
            Debug.Log($"received proximity {activateStealthDelay}");
            //false indicates sensor is blocked / covered.
            if ((bool)inputData == false)
            {
                EnableStealth();
            }
            break;

        default:
            break;
        }
    }
Пример #24
0
 public DrillBitCost(object data, InputDataType dataType)
     : base(data, dataType)
 {
 }
 public AbstractSectorDataFile(string fullPath, InputDataType dataType)
 {
     FullPath = fullPath;
     DataType = dataType;
 }
 public void TestItReturnsCorrectReader(InputDataType inputType, Type expectedReaderType)
 {
     Assert.Equal(expectedReaderType, SectorDataReaderFactory.Create(inputType).GetType());
 }
Пример #27
0
        /// <summary>
        /// Starts input
        /// </summary>
        /// <param name="device">Device object</param>
        /// <param name="ProtocolClass">Class of device to operate with</param>
        /// <param name="DataType">Type of data to input</param>
        /// <param name="InputTask">Data processing task</param>
        /// <param name="ErrorMessage">Error</param>
        /// <returns>Returns true if device was succesfully started and stopped </returns>
        public static bool Launch(DeviceInput device,
                                  ProtocolClassID ProtocolClass,
                                  string PrefferedSerialNumber,
                                  InputDataType DataType,
                                  DeviceInputTask InputTask,
                                  ref string ErrorMessage)
        {
            if (Running == true)
            {
                return(false);
            }

            try
            {
                Running = true;
                if (device == null)
                {
                    ErrorMessage = "Device is null";
                    return(false);
                }


                #region Getting library versions
                //Getting HAL library Version information
                int Version = 0, Release = 0;
                device.GetHALVersion(ref Version, ref Release);
                Console.WriteLine("Mitsar.HAL version: {0}.{1}", Version, Release);
                Console.WriteLine();
                Console.WriteLine("Assemblies_____________");
                Console.WriteLine(GetAssemblyDescription("Mitsar.Essentials"));
                Console.WriteLine(GetAssemblyDescription("Mitsar.HAL"));
                Console.WriteLine();
                #endregion


                #region Getting available hardware and selecting device
                DeviceDescription SelectedDescription = null;

                //Detecting Hardware
                List <DeviceDescription> descriptions = new List <DeviceDescription>();

                Console.WriteLine("Enumerating devices for protocol " + ProtocolClass);
                device.Enumerate(HardwareClassID.EEG, ProtocolClass, ref descriptions);

                //Showing all discovered devices

                if (descriptions != null)
                {
                    Console.WriteLine("Devices found ______________");

                    foreach (DeviceDescription desc in descriptions)
                    {
                        Console.WriteLine(desc.ToString());
                        Console.WriteLine("Driver Name: " + desc.GetDeviceDriverName());
                        Console.WriteLine("Driver SerialNumber: " + desc.DriverSerialNumber);
                        Console.WriteLine("State: " + desc.State.ToString());
                        Console.WriteLine();
                    }
                }
                else
                {
                    ErrorMessage = "No devices found";
                    return(false);
                }

                Console.WriteLine("________________________");
                //Selecting device description
                if (descriptions.Count == 0)
                {
                    ErrorMessage = "Error: No devices found";
                    return(false);
                }
                else
                {
                    if (string.IsNullOrEmpty(PrefferedSerialNumber) == false)
                    {
                        Console.Write("Searching for device with serial number " + PrefferedSerialNumber + "...");

                        //Choosing EEG Device
                        foreach (DeviceDescription desc in descriptions)
                        {
                            if (desc.DriverSerialNumber == PrefferedSerialNumber)
                            {
                                SelectedDescription = desc;
                                break;
                            }
                        }

                        if (SelectedDescription != null)
                        {
                            Console.WriteLine(" found " + SelectedDescription.ToString());
                        }
                        else
                        {
                            Console.WriteLine(" not found");
                        }
                    }


                    if (SelectedDescription == null)
                    {
                        Console.Write("Searching for any device...");
                        //Choosing EEG Device
                        foreach (DeviceDescription desc in descriptions)
                        {
                            if (desc.HardwareClass == HardwareClassID.EEG)
                            {
                                SelectedDescription = desc;
                                break;
                            }
                        }

                        if (SelectedDescription != null)
                        {
                            Console.WriteLine(" found " + SelectedDescription.ToString());
                        }
                        else
                        {
                            Console.WriteLine(" not found");
                        }
                    }

                    if (SelectedDescription == null)
                    {
                        ErrorMessage = "Error: No devices found";
                        return(false);
                    }
                }
                #endregion


                #region Opening, Powering and detecting device version
                //Opening HAL
                Console.Write("Opening...");
                if (device.Open(SelectedDescription) == true)
                {
                    Console.WriteLine("OK");
                }
                else
                {
                    return(false);
                }


                //Powering HAL
                Console.Write("Powering...");
                if (device.PowerOn() == true)
                {
                    Console.WriteLine("OK");
                }
                else
                {
                    return(false);
                }


                //Identifying HAL
                Console.Write("Indentifing...");
                if (device.Identify() == true)
                {
                    Console.WriteLine("OK");
                }
                else
                {
                    return(false);
                }


                if (device.ActiveDeviceDescription.Resource.Version == 0)
                {
                    ErrorMessage = "Error: Unknown version " + device.ActiveDeviceDescription.Resource.ReservedVersion;
                    return(false);
                }

                Console.WriteLine();
                Console.WriteLine("Device vendor: " + device.ActiveDeviceDescription.Resource.Vendor);
                Console.WriteLine("Device version: " + device.ActiveDeviceDescription.Resource.Version);
                Console.WriteLine("Device serial number: " + device.ActiveDeviceDescription.Resource.SerialNumber);
                #endregion


                #region Loading and setting up calibration
                Console.Write("Getting calibration...");
                Resource_MultiChannel mresource       = device.ActiveDeviceDescription.Resource as Resource_MultiChannel;
                //If internal device calibration is supported
                if (mresource.IsROMSupported() == true)
                {//ROM supported - reading from ROM
                    byte[] buf = null;

                    //Reading calibration data from device's memory to buffer
                    if (device.ReadMemory(ref buf) == true)
                    {//if ROM read successfully - transfer to calibration
                        //Decoding buffer to calibtaion data
                        CalibrationProfileIOResult result = CalibrationProfile.ReadFromBuffer(ref device.ActiveDeviceDescription.Calibration, mresource, buf);
                        if (result == CalibrationProfileIOResult.OK) //Translate OK
                        {
                            //After successfull read version and serial must be assigned to CalibrationFile
                            device.ActiveDeviceDescription.Calibration.Parameters.Version          = device.ActiveDeviceDescription.Resource.Version;
                            device.ActiveDeviceDescription.Calibration.Parameters.FullSerialNumber = device.ActiveDeviceDescription.Resource.SerialNumber;
                            //Serial is not validated because received from already validated device resource
                            Console.WriteLine("OK");
                        }
                        else  //ROM translate or check sum error
                        {
                            device.ActiveDeviceDescription.Calibration.Clear();
                        }
                    }//ROM Access error
                    else
                    {
                        device.ActiveDeviceDescription.Calibration.Clear();
                    }
                }//if ROM supported
                else
                {
                    Console.WriteLine(" not supported");
                }

                Console.WriteLine("");
                //else calibration must be read from calibration file eeg.cal
                //CalibrationFile.Read(ref device.ActiveDeviceDescription.Calibration, "eeg.cal");
                #endregion


                #region Configuring device
                //Setting input mode to global input mode. EEG(data) or Impedance
                mresource.DataType = DataType;

                //Test signal mode disabled
                mresource.TestSignal = false;

                //Setting up referent operation mode
                //Getting list of supported referent types
                List <ReferentOperationMode> RefModeList = mresource.GetReferentOperationModeList(false);
                Console.Write("Supported referents: ");
                foreach (ReferentOperationMode refmode in RefModeList)
                {
                    Console.Write(refmode + " ");
                }
                Console.WriteLine();
                //Selecting first supported mode
                //mresource.EmitterFactory.RefMode = ReferentOperationMode.RefElectrode;
                //mresource.EmitterFactory.RefMode = ReferentOperationMode.Joined;
                //RefModeList[0];

                mresource.EmitterFactory.RefMode = RefModeList[0];

                mresource.EmitterFactory.ImpedanceChannelEnabled     = true;
                mresource.EmitterFactory.AccelerometerChannelEnabled = true;


                //Setting up sampling frequency
                //GEtting list of supported sampling frequencies
                List <double> FreqList                = mresource.GetSamplingFrequencyList(false);
                Console.Write("Supported frequencies: ");
                foreach (double freq in FreqList)
                {
                    Console.Write(freq + " ");
                }
                Console.WriteLine();

                //Selecting first frequency in list, generally nominal
                //int SamplingFrequency = (int)mresource.GetNominalSamplingFrequency();
                int SamplingFrequency = (int)FreqList[0];
                mresource.EmitterFactory.SamplingFrequency = SamplingFrequency;

                //Setting other data buffer parameters
                //Getting BYTES PER SAMPLE FROM FIRST ENCOUNTERED DATA CHANNEL
                mresource.DataBuffer.BytesPerTick = mresource.Interface_GetBytesPerSample(UID.NOP);

                mresource.DataBuffer.TicksMin  = 2;
                mresource.DataBuffer.TicksMax  = 100;
                mresource.DataBuffer.TicksSkip = 10;// 10;


                //Enable Front panel LED in Impedace Test mode
                mresource.FrontLedEnabled         = true;
                mresource.FrontLedThesholdEnabled = false;

                //Set edge value, can be changed in any time
                //All impedances above this value will be highligted
                //Only 5, 10, 20, 40 values are indicated
                mresource.FrontLedThesholdValue = 10;

                Console.WriteLine();
                #endregion


                #region Starting data input
                Console.Write("Starting...");
                if (device.Start() == true)
                {
                    Console.WriteLine("OK");
                }
                else
                {
                    return(false);
                }


                Console.WriteLine("Emitters__________________");
                StringBuilder sb = new StringBuilder();
                sb.AppendLine("UID\tIndex\tAlign\tBPS\tHigh\tLow\tNotch\tUnitsPerSample");

                foreach (EmitterDescription emm in mresource.EmitterFactory)
                {
                    sb.Append(emm.UID.ToString());
                    sb.Append("\t");
                    sb.Append(emm.HardwareIndex.ToString());
                    sb.Append("\t");
                    sb.Append(emm.Align.ToString());
                    sb.Append("\t");
                    sb.Append(emm.BytesPerSample.ToString());
                    sb.Append("\t");
                    sb.Append(emm.HardHighPass.ToString());
                    sb.Append("\t");
                    sb.Append(emm.HardLowPass.ToString());
                    sb.Append("\t");
                    sb.Append(emm.HardNotch.ToString());
                    sb.Append("\t");
                    sb.Append(emm.UnitsPerSample.ToString());
                    sb.AppendLine("\t");
                }
                Console.WriteLine(sb.ToString());


                Console.WriteLine("Calibration_____________");
                //sb.Clear();
                foreach (EmitterDescription emm in mresource.EmitterFactory)
                {
                    sb.Append(emm.UID.ToString());
                    sb.Append("\t");

                    if (emm.CalEntryLink != null)
                    {
                        sb.Append(emm.CalEntryLink.ToString());
                        sb.Append("\t");
                    }
                    else
                    {
                        sb.Append(" no calibration");
                    }

                    sb.AppendLine("\t");
                }
                Console.WriteLine(sb.ToString());

                Console.WriteLine("Input parameters_____________");
                Console.WriteLine("Data Type: " + mresource.DataType.ToString());
                Console.WriteLine("Sampling Frequency: " + mresource.EmitterFactory.SamplingFrequency.ToString());

                Console.WriteLine("BytesPerTick: " + mresource.DataBuffer.BytesPerTick.ToString());
                Console.WriteLine("Minimum ticks to transmit: " + mresource.DataBuffer.TicksMin.ToString());
                Console.WriteLine("Maximum ticks to transmit: " + mresource.DataBuffer.TicksMax.ToString());

                Console.WriteLine("Internal number of channels: " + mresource.InputHardwareChannelCountInternal.ToString());
                Console.WriteLine("External number of channels: " + mresource.InputHardwareChannelCountExternal.ToString());
                Console.WriteLine();
                #endregion


                //Start Data asquisition task
                Console.WriteLine("Executing input task...");
                if (InputTask != null)
                {
                    InputTask();
                }


                bool DisplayImpedances = false;

                #region Displaying impedances
                if (DisplayImpedances)
                {
                    Console.WriteLine("----- EmitterFactory -----");
                    foreach (EmitterDescription em in mresource.EmitterFactory)
                    {
                        ///Console.WriteLine(em.UID + "\t RF=" + em.ImpedancePreliminaryValue + "\t R=" + em.ImpedanceResultValue);
                        Console.WriteLine(em.UID + "\t RValue=" + em.ImpedanceResultValue);//;;em.ImpedancePreliminaryValue + "\t R=" + em.ImpedanceResultValue);
                    }

                    Console.WriteLine("----- ImpedanceArray -----");
                    foreach (ImpedanceElement el in mresource.ImpedanceArray)
                    {
                        Console.WriteLine(el.LogicalUID +
                                          // " Name= " + el.Name +
                                          // " Active:" + el.Active +
                                          // " InMontage:" + el.PresentInMontage +
                                          //" REF:" + el.HardwareReferent +
                                          //  " LED:" + el.LedState + " (" + el.LedIndex + ")" +
                                          // " PVal:" + el.PreliminaryValue +
                                          "\t RValue:" + el.ResultValue);
                    }
                }
                #endregion


                #region Displaying power mode
                Console.WriteLine("Power mode: " + device.ActiveDeviceDescription.Resource.PowerMode);
                #endregion

                Console.WriteLine("Complete");
                return(true);
            }
            finally
            {
                //Memorizing error code
                HALErrorCode errorcode = device.HALError.Code;

                Running = false;

                #region Finalising device
                if (device != null)
                {
                    if (device.IsStarted)
                    {
                        Console.Write("Stopping...");
                        if (device.Stop() == true)
                        {
                            Console.WriteLine("OK");
                        }
                    }

                    if (device.IsPowered)
                    {
                        Console.Write("Powering off...");
                        if (device.PowerOff() == true)
                        {
                            Console.WriteLine("OK");
                        }
                    }

                    if (device.IsOpened)
                    {
                        Console.Write("Closing...");
                        if (device.Close() == true)
                        {
                            Console.WriteLine("OK");
                        }
                    }

                    if (errorcode != HALErrorCode.OK)
                    {
                        ErrorMessage = "Error: " + errorcode.ToString();
                    }
                }
                #endregion
            }
        }//Launch
Пример #28
0
 public RouterCost(object data, InputDataType dataType)
     : base(data, dataType)
 {
 }
 public SectorDataFile(string fullPath, IInputStreamFactory streamFactory, InputDataType dataType, AbstractSectorDataReader reader)
     : base(fullPath, dataType)
 {
     this.streamFactory = streamFactory;
     this.reader        = reader;
 }
 public LabelForInputDataWithLabel(string inputEvent, string IDText, InputDataType inputDataType, bool localizeLabel = true) : base(inputEvent, inputDataType)
 {
     this.IDText        = IDText;
     this.localizeLabel = localizeLabel;
 }
Пример #31
0
 public NavbarInfoElement(UnityEvent unityEvent, string inputEvent, string IDText, InputDataType inputDataType, bool localizeLabel = true) : base(inputEvent, IDText, inputDataType, localizeLabel)
 {
     this.unityEvent = unityEvent;
 }
 public AbstractSectorDataFile Create(string fullPath, InputDataType inputDataType)
 {
     return(inputDataType == InputDataType.FILE_HEADERS
         ? this.CreateHeaderDataFile(fullPath, inputDataType)
         : this.CreateStandardDataFile(fullPath, inputDataType));
 }
Пример #33
0
 public CostItemRateCost(object data, InputDataType dataType)
     : base(data, dataType)
 {
 }
Пример #34
0
        public static Boolean ValidateTextBox(Label lbl, TextBox tb, Boolean AllowEmpty, InputDataType dt)
        {
            String str = CLanguage.getValue("ERROR_TEXT_VALIDATE");
            String fmt = String.Format(str, lbl.Content);

            if (tb.IsEnabled)
            {
                if (AllowEmpty)
                {
                    return(true);
                }

                if (tb.Text.Trim().Equals(""))
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    tb.Focus();
                    return(false);
                }

                Regex regex = null;
                if (dt == InputDataType.InputTypeZeroPossitiveDecimal)
                {
                    regex = new Regex(@"^\d+(\.\d{1,2})?$");
                }
                else if (dt == InputDataType.InputTypeZeroPossitiveInt)
                {
                    regex = new Regex(@"^\d+$");
                }

                Boolean result = regex.IsMatch(tb.Text);
                if (!result)
                {
                    CMessageBox.Show(fmt, "ERROR", MessageBoxButton.OK, MessageBoxImage.Error);
                    tb.Focus();
                    return(false);
                }
            }

            return(true);
        }
 public ConfigFileSection(string jsonPath, InputDataType dataType, string outputGroupDescriptor = null)
 {
     this.JsonPath = jsonPath;
     this.DataType = dataType;
     this.OutputGroupDescriptor = outputGroupDescriptor;
 }