Exemplo n.º 1
0
        public static string GetMappingFileName(long id, TransmissionType transmissionType, string name)
        {
            using (MetadataStructureManager msm = new MetadataStructureManager())
            {
                MetadataStructure metadataStructure = msm.Repo.Get(id);

                // get MetadataStructure
                XDocument xDoc = XmlUtility.ToXDocument((XmlDocument)metadataStructure.Extra);



                List <XElement> tmpList =
                    XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), new Dictionary <string, string>()
                {
                    { AttributeNames.name.ToString(), name },
                    { AttributeNames.type.ToString(), transmissionType.ToString() }
                }, xDoc).ToList();

                if (tmpList.Count >= 1)
                {
                    return(tmpList.FirstOrDefault().Attribute("value").Value.ToString());
                }

                return(null);
            }
        }
        public TransmissionType GetById(byte transmissionTypeId)
        {
            TransmissionType transmissionType = null;

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("TransmissionTypesSelectById", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                cmd.Parameters.AddWithValue("@TransmissionTypeId", transmissionTypeId);

                cn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    if (dr.Read())
                    {
                        transmissionType = new TransmissionType();
                        transmissionType.TransmissionTypeId = (byte)dr["TransmissionTypeId"];
                        transmissionType.Name = dr["Name"].ToString();
                    }
                }
            }

            return(transmissionType);
        }
Exemplo n.º 3
0
 public EconomyVehicle(
     string vehicleRego,
     string make,
     string model,
     int year,
     int numSeats = Default_Num_Seats,
     TransmissionType transmission = Default_Transmission_Type,
     FuelType fuel    = Default_Fuel_Type,
     bool GPS         = Default_GPS,
     bool sunRoof     = Default_Sun_Roof,
     double dailyRate = Default_Daily_Rate,
     string colour    = Default_Colour
     ) : base(
         vehicleRego,
         VehicleGrade.Economy,
         make,
         model,
         year,
         numSeats,
         transmission,
         fuel,
         GPS,
         sunRoof,
         dailyRate,
         colour
         )
 {
 }
Exemplo n.º 4
0
        public Vehicle(string vehicleRego, VehicleClass vehicleClass, string make,
                       string model, int year, int numSeats, TransmissionType transmissionType,
                       FuelType fuelType, bool GPS, bool sunRoof, double dailyRate, string colour)
        {
            //private variables
            _vehicleRego      = vehicleRego;
            _vehicleClass     = vehicleClass;
            _make             = make;
            _model            = model;
            _year             = year;
            _numSeats         = numSeats;
            _transmissionType = transmissionType;
            _fuelType         = fuelType;
            _GPS           = GPS;
            _sunRoof       = sunRoof;
            _dailyRate     = dailyRate;
            _colour        = colour;
            vehicleRegoPub = vehicleRego;
            _GPSat         = GPS;
            _sunRoofat     = sunRoof;

            //getters/setters
            _VehicleRego      = vehicleRego;
            _VehicleClass     = vehicleClass;
            _Make             = make;
            _Model            = model;
            _Year             = year;
            _NumSeats         = numSeats;
            _Transmissiontype = transmissionType;
            _FuelType         = fuelType;
            _gps       = GPS;
            _SunRoof   = sunRoof;
            _DailyRate = dailyRate;
            _Colour    = colour;
        }
Exemplo n.º 5
0
        public bool HasTransmission(long datasetid, TransmissionType type)
        {
            Dataset        dataset = this.GetUnitOfWork().GetReadOnlyRepository <Dataset>().Get(datasetid);
            DatasetManager dm      = new DatasetManager();

            try
            {
                DatasetVersion datasetVersion = dm.GetDatasetLatestVersion(dataset);

                // get MetadataStructure
                if (datasetVersion != null && datasetVersion.Dataset != null &&
                    datasetVersion.Dataset.MetadataStructure != null &&
                    datasetVersion.Dataset.MetadataStructure.Extra != null &&
                    datasetVersion.Metadata != null)
                {
                    MetadataStructure      metadataStructure = datasetVersion.Dataset.MetadataStructure;
                    XDocument              xDoc = XmlUtility.ToXDocument((XmlDocument)datasetVersion.Dataset.MetadataStructure.Extra);
                    IEnumerable <XElement> temp = XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), AttributeNames.type.ToString(),
                                                                                     type.ToString(), xDoc);

                    if (temp != null && temp.Any())
                    {
                        return(true);
                    }
                }
                return(false);
            }
            finally
            {
                dm.Dispose();
            }
        }
        //new
        public UniOSCTransmitter(IPAddress ipAddress, TransmissionType ttype, int port)

        {
            IPAddress        = ipAddress;
            Port             = port;
            transmissionType = ttype;
        }
Exemplo n.º 7
0
        /// <summary>
        /// returns a value of a metadata node
        /// </summary>
        /// <param name="datasetVersion"></param>
        /// <param name="name"></param>
        /// <returns></returns>
        public IEnumerable <string> GetAllTransmissionInformation(long datasetid, TransmissionType type,
                                                                  AttributeNames returnType = AttributeNames.value)
        {
            Dataset        dataset = this.GetUnitOfWork().GetReadOnlyRepository <Dataset>().Get(datasetid);
            DatasetManager dm      = new DatasetManager();

            try
            {
                DatasetVersion datasetVersion = dm.GetDatasetLatestVersion(dataset);

                // get MetadataStructure
                if (datasetVersion != null && datasetVersion.Dataset != null &&
                    datasetVersion.Dataset.MetadataStructure != null &&
                    datasetVersion.Dataset.MetadataStructure.Extra != null &&
                    datasetVersion.Metadata != null)
                {
                    return(GetAllTransmissionInformationFromMetadataStructure(datasetVersion.Dataset.MetadataStructure.Id,
                                                                              type, returnType));
                }
                return(null);
            }
            finally
            {
                dm.Dispose();
            }
        }
Exemplo n.º 8
0
        public void Percent(TransmissionType type)
        {
            var    underTest = new Transmission(type, this.path);
            double?percent   = null;

            underTest.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == Utils.NameOf((Transmission t) => t.Percent))
                {
                    percent = (sender as Transmission).Percent;
                }
            };

            Assert.That(underTest.Percent, Is.Null);

            underTest.Length   = 100;
            underTest.Position = 0;

            Assert.That(percent, Is.EqualTo(0));
            underTest.Position = 10;
            Assert.That(percent, Is.EqualTo(10));
            underTest.Position = 100;
            Assert.That(percent, Is.EqualTo(100));
            underTest.Length = 1000;
            Assert.That(percent, Is.EqualTo(10));
            underTest.Position = 1000;
            underTest.Length   = 2000;
            Assert.That(percent, Is.EqualTo(50));

            underTest.Position = 201;
            underTest.Length   = 1000;
            Assert.That(percent, Is.EqualTo(20));
        }
        public List <TransmissionType> GetAll()
        {
            List <TransmissionType> _transmissions = new List <TransmissionType>();

            using (var conn = new SqlConnection())
            {
                conn.ConnectionString = ConfigurationManager.ConnectionStrings["DefaultConnection"].ToString();
                SqlCommand cmd = new SqlCommand("TransmissionSelectAll", conn);
                cmd.CommandType = CommandType.StoredProcedure;

                conn.Open();

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        TransmissionType row = new TransmissionType();
                        row.TransTypeID = (int)reader["TransTypeID"];
                        row.Type        = reader["Type"].ToString();

                        _transmissions.Add(row);
                    }
                }
            }

            return(_transmissions);
        }
Exemplo n.º 10
0
        public void SetCarFilter()
        {
            RefreshContext();

            _BrandFilter            = (string)_BinaryFormatter.Deserialize(_NetworkStream);
            _ModelFilter            = (string)_BinaryFormatter.Deserialize(_NetworkStream);
            _YearOfIssueMinFilter   = (int)_BinaryFormatter.Deserialize(_NetworkStream);
            _YearOfIssueMaxFilter   = (int)_BinaryFormatter.Deserialize(_NetworkStream);
            _BodyTypeFilter         = (BodyType)_BinaryFormatter.Deserialize(_NetworkStream);
            _EngineVolumeMinFilter  = (float)_BinaryFormatter.Deserialize(_NetworkStream);
            _EngineVolumeMaxFilter  = (float)_BinaryFormatter.Deserialize(_NetworkStream);
            _EngineTypeFilter       = (EngineType)_BinaryFormatter.Deserialize(_NetworkStream);
            _TransmissionTypeFilter = (TransmissionType)_BinaryFormatter.Deserialize(_NetworkStream);
            _WheelDriveTypeFilter   = (WheelDriveType)_BinaryFormatter.Deserialize(_NetworkStream);
            _MileageMinFilter       = (decimal)_BinaryFormatter.Deserialize(_NetworkStream);
            _MileageMaxFilter       = (decimal)_BinaryFormatter.Deserialize(_NetworkStream);
            _BodyColorFilter        = (BodyColor)_BinaryFormatter.Deserialize(_NetworkStream);
            _InteriorMaterialFilter = (InteriorMaterial)_BinaryFormatter.Deserialize(_NetworkStream);
            _InteriorColorFilter    = (InteriorColor)_BinaryFormatter.Deserialize(_NetworkStream);
            _PriceMinFilter         = (decimal)_BinaryFormatter.Deserialize(_NetworkStream);
            _PriceMaxFilter         = (decimal)_BinaryFormatter.Deserialize(_NetworkStream);

            if (Session.UserController.IsAuthorized)
            {
                _BinaryFormatter.Serialize(_NetworkStream, MessageType.Success);
                IsFilteringEnabled = true;
            }
            else
            {
                Session.SendErrorMessage("Для этого действия требуется авторизация!");
            }

            RefreshContext();
        }
Exemplo n.º 11
0
 public void ConstructorTakesTypeFileNameAndCachePath(TransmissionType type) {
     var underTest = new Transmission(type, this.path, this.cache);
     Assert.That(underTest.Type, Is.EqualTo(type));
     Assert.That(underTest.Path, Is.EqualTo(this.path));
     Assert.That(underTest.CachePath, Is.EqualTo(this.cache));
     Assert.That(underTest.Status, Is.EqualTo(TransmissionStatus.TRANSMITTING));
 }
Exemplo n.º 12
0
        public void ResetCarFilter()
        {
            RefreshContext();
            if (Session.UserController.IsAuthorized)
            {
                _BrandFilter            = null;
                _ModelFilter            = null;
                _YearOfIssueMinFilter   = 1975;
                _YearOfIssueMaxFilter   = 2020;
                _BodyTypeFilter         = 0;
                _EngineVolumeMinFilter  = 0.8f;
                _EngineVolumeMaxFilter  = 10.0f;
                _EngineTypeFilter       = 0;
                _TransmissionTypeFilter = 0;
                _WheelDriveTypeFilter   = 0;
                _MileageMinFilter       = 0;
                _MileageMaxFilter       = 1000000M;
                _BodyColorFilter        = 0;
                _InteriorMaterialFilter = 0;
                _InteriorColorFilter    = 0;
                _PriceMinFilter         = 0;
                _PriceMaxFilter         = 1000000M;

                _BinaryFormatter.Serialize(_NetworkStream, MessageType.Success);
                IsFilteringEnabled = false;
            }
            else
            {
                Session.SendErrorMessage("Для этого действия требуется авторизация!");
            }
            RefreshContext();
        }
        public ActionResult Details(string id)
        {
            try
            {
                if (id == null)
                {
                    return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                }

                TransmissionType          transmissionType          = _unitOfWork.TransmissionType.GetByID(Convert.ToInt32(id));
                TransmissionTypeViewModel transmissionTypeViewModel = new TransmissionTypeViewModel();
                transmissionTypeViewModel.TransmissionTypeName = transmissionType.TransmissionTypeName;
                transmissionTypeViewModel.Description          = transmissionType.Description;
                transmissionTypeViewModel.ShortCode            = transmissionType.ShortCode;
                transmissionTypeViewModel.AddedDate            = transmissionType.AddedDate;
                transmissionTypeViewModel.UpdatedDate          = transmissionType.UpdatedDate;

                if (transmissionTypeViewModel != null)
                {
                    return(PartialView("_DetailsTransmissionType", transmissionTypeViewModel));
                }
                else
                {
                    return(HttpNotFound());
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
        /// <summary>
        /// Initializes a new instance of the
        /// <see cref="CmisSync.Lib.Storage.Database.Entities.FileTransmissionObject"/> class.
        /// </summary>
        /// <param name="type">Type of transmission.</param>
        /// <param name="localFile">Local file.</param>
        /// <param name="remoteFile">Remote file.</param>
        public FileTransmissionObject(TransmissionType type, IFileInfo localFile, IDocument remoteFile) {
            if (localFile == null) {
                throw new ArgumentNullException("localFile");
            }

            if (!localFile.Exists) {
                throw new ArgumentException(string.Format("'{0} file does not exist", localFile.FullName), "localFile");
            }

            if (remoteFile == null) {
                throw new ArgumentNullException("remoteFile");
            }

            if (remoteFile.Id == null) {
                throw new ArgumentNullException("remoteFile.Id");
            }

            if (string.IsNullOrEmpty(remoteFile.Id)) {
                throw new ArgumentException("empty string", "remoteFile.Id");
            }

            this.Type = type;
            this.LocalPath = localFile.FullName;
            this.LastContentSize = localFile.Length;
            this.LastLocalWriteTimeUtc = localFile.LastWriteTimeUtc;
            this.RemoteObjectId = remoteFile.Id;
            this.LastChangeToken = remoteFile.ChangeToken;
            this.RemoteObjectPWCId = remoteFile.VersionSeriesCheckedOutId;
            this.LastRemoteWriteTimeUtc = remoteFile.LastModificationDate;
            if (this.LastRemoteWriteTimeUtc != null) {
                this.LastRemoteWriteTimeUtc = this.LastRemoteWriteTimeUtc.GetValueOrDefault().ToUniversalTime();
            }
        }
Exemplo n.º 15
0
        public void Percent(TransmissionType type) {
            var underTest = new Transmission(type, this.path);
            double? percent = null;
            underTest.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == Utils.NameOf((Transmission t) => t.Percent)) {
                    percent = (sender as Transmission).Percent;
                }
            };

            Assert.That(underTest.Percent, Is.Null);

            underTest.Length = 100;
            underTest.Position = 0;

            Assert.That(percent, Is.EqualTo(0));
            underTest.Position = 10;
            Assert.That(percent, Is.EqualTo(10));
            underTest.Position = 100;
            Assert.That(percent, Is.EqualTo(100));
            underTest.Length = 1000;
            Assert.That(percent, Is.EqualTo(10));
            underTest.Position = 1000;
            underTest.Length = 2000;
            Assert.That(percent, Is.EqualTo(50));

            underTest.Position = 201;
            underTest.Length = 1000;
            Assert.That(percent, Is.EqualTo(20));
        }
Exemplo n.º 16
0
 public Transmission(long id, TransmissionType type, TransmissionTypeDetail detail, int gears)
 {
     ID     = id;
     Type   = type;
     Detail = detail;
     Gears  = gears;
 }
Exemplo n.º 17
0
 public async Task <IActionResult> CreateEditTransmissionType(TransmissionType transmissionType)
 {
     if (ModelState.IsValid)
     {
         if (transmissionType.Id == 0)
         {
             _context.Add(transmissionType);
             await _context.SaveChangesAsync();
         }
         else
         {
             try {
                 _context.Update(transmissionType);
                 await _context.SaveChangesAsync();
             }
             catch (DbUpdateConcurrencyException) {
                 if (!_context.TransmissionTypes.Any(t => t.Id == transmissionType.Id))
                 {
                     return(NotFound());
                 }
                 else
                 {
                     throw;
                 }
             }
         }
         return(RedirectToAction(nameof(TransmissionTypes)));
     }
     return(View(transmissionType));
 }
        public IEnumerable <TransmissionType> GetAll()
        {
            List <TransmissionType> transmissionTypes = new List <TransmissionType>();

            using (var cn = new SqlConnection(Settings.GetConnectionString()))
            {
                SqlCommand cmd = new SqlCommand("TransmissionTypesSelectAll", cn);
                cmd.CommandType = CommandType.StoredProcedure;

                cn.Open();

                using (SqlDataReader dr = cmd.ExecuteReader())
                {
                    while (dr.Read())
                    {
                        TransmissionType currentRow = new TransmissionType();
                        currentRow.TransmissionTypeId = (byte)dr["TransmissionTypeId"];
                        currentRow.Name = dr["Name"].ToString();

                        transmissionTypes.Add(currentRow);
                    }
                }
            }

            return(transmissionTypes);
        }
Exemplo n.º 19
0
 public Camry(CarModels carmodel, int price, TransmissionType transmission, VolumeType volume) : base(carmodel, price, transmission, volume)
 {
     Transmission = transmission;
     Volume       = volume;
     Price        = price;
     CarModel     = carmodel;
 }
Exemplo n.º 20
0
    private void SwitchTransmissionType()
    {
        m_CurTransType = m_CurTransType == TransmissionType.Fat ?
                         TransmissionType.Thin : TransmissionType.Fat;

        this.UpdateTransmissionType();
    }
Exemplo n.º 21
0
        /// <summary>
        /// Compose the byte buffer that will be transmitted.
        /// </summary>
        private static byte[] ComposeMessage(TransmissionType Code, byte[] buffer)
        => new byte[]
        {
            (byte)Code
        }

        .Concat(new byte[] { (byte)buffer.Length }).Concat(buffer).ToArray();                                 // [servercode][nickname length][nickname bytes]
Exemplo n.º 22
0
        public IEnumerable <Advertisement> GetAdvertisements(
            Brand brand                   = null,
            Region region                 = null,
            VehiclType vehiclType         = null,
            TransmissionType transmission = null,
            List <Fuel> fuels             = null,
            Engine from                   = null,
            Engine to = null)
        {
            using (var context = CreateContext())
            {
                var query = _queryBuilder
                            .For(context.ADVERTISEMENTs.AsQueryable())
                            .By(brand)
                            .By(region)
                            .By(vehiclType)
                            .By(transmission)
                            .By(fuels)
                            .By(from, to)
                            .CreateQuery();

                return(query
                       .AsEnumerable()
                       .Select(x => new Advertisement(x))
                       .ToList());
            }
        }
Exemplo n.º 23
0
        public string GetTransmissionInformation(long datasetVersionId, TransmissionType type, string name,
                                                 AttributeNames returnType = AttributeNames.value)
        {
            DatasetVersion    datasetVersion    = this.GetUnitOfWork().GetReadOnlyRepository <DatasetVersion>().Get(datasetVersionId);
            Dataset           dataset           = this.GetUnitOfWork().GetReadOnlyRepository <Dataset>().Get(datasetVersion.Dataset.Id);
            MetadataStructure metadataStructure = this.GetUnitOfWork().GetReadOnlyRepository <MetadataStructure>().Get(dataset.MetadataStructure.Id);

            // get MetadataStructure
            if (datasetVersion != null && dataset != null &&
                metadataStructure != null && datasetVersion.Metadata != null && metadataStructure.Extra != null)
            {
                XDocument xDoc = XmlUtility.ToXDocument((XmlDocument)datasetVersion.Dataset.MetadataStructure.Extra);

                Dictionary <string, string> queryDic = new Dictionary <string, string>();
                queryDic.Add(AttributeNames.name.ToString(), name);
                queryDic.Add(AttributeNames.type.ToString(), type.ToString());

                IEnumerable <XElement> temp = XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), queryDic, xDoc);

                string value = temp?.First().Attribute(returnType.ToString()).Value;

                return(value);
            }
            return(string.Empty);
        }
        public ActionResult AddNew(TransmissionTypeViewModel transmissionTypeViewModel)
        {
            try
            {
                if (ModelState.IsValid)
                {
                    TransmissionTypeRepository TransmissionTypeRepository = new TransmissionTypeRepository(new AutoSolutionContext());
                    bool IsExist = TransmissionTypeRepository.isExist(transmissionTypeViewModel.TransmissionTypeName);
                    if (!IsExist)
                    {
                        TransmissionType transmissionType = new TransmissionType();

                        transmissionType.TransmissionTypeName = transmissionTypeViewModel.TransmissionTypeName;
                        transmissionType.AddedDate            = DateTime.Now;
                        transmissionType.UpdatedDate          = DateTime.Now;
                        transmissionType.Description          = transmissionTypeViewModel.Description;
                        transmissionType.ShortCode            = transmissionTypeViewModel.ShortCode;
                        _unitOfWork.TransmissionType.Add(transmissionType);
                        _unitOfWork.Complete();
                        _unitOfWork.Dispose();
                        return(RedirectToAction("GetTransmissionType"));
                    }
                    else
                    {
                        return(RedirectToAction("GetTransmissionType"));
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
            return(View());
        }
Exemplo n.º 25
0
 public ICarAdFactory WithOptions(bool hasClimateControl, int seats, TransmissionType transmissionType)
 {
     return(this.WithOptions(
                new Options(
                    hasClimateControl,
                    seats,
                    transmissionType)));
 }
Exemplo n.º 26
0
        public void SetUp()
        {
            const int carAvailabilityProbability = 1;

            passengerBehaviour = Substitute.For <IPassengerBehaviour>();
            transmissionType   = TransmissionType.Average;
            averagingFunc      = new AveragingFunc(carAvailabilityProbability);
        }
Exemplo n.º 27
0
        public void FilterTransmissionTest(TransmissionType transmissionType)
        {
            var result = engine.SearchParts(new SearchPartsQuery {
                TransmissionType = transmissionType
            });

            result.Should().OnlyContain(o => o.TransmissionType == transmissionType);
        }
Exemplo n.º 28
0
 public CarBase(int basePrice, CarModel carModel, TransmissionType transmission, VolumeType volume)
 {
     BasePrice    = basePrice;
     CarModel     = carModel;
     Transmission = transmission;
     Volume       = volume;
     Prices       = new Dictionary <string, int>();
 }
Exemplo n.º 29
0
 public Car(Color bodyColor, BodyStyle bodyType, TransmissionType transmissionKind, CarMaker carCompany, DateTime yearCreated)
 {
     color = bodyColor;
     bodyStyle = bodyType;
     transmissionType = transmissionKind;
     carMaker = carCompany;
     yearMade = yearCreated;
 }
Exemplo n.º 30
0
 public TransmissionDetails(TransmissionType transmissionType)
 {
     this.TransmissionType = transmissionType;
     this.TransmissionAttemptsCounter = 0;
     this.CurrentRetryTimeoutInMilliseconds = 0;
     this.CurrentRetryTimeoutInMachineTicks = Int64.MaxValue;
     this.MaximumTimeoutInMachineTicks = Int64.MaxValue;
 }
Exemplo n.º 31
0
 public IAdvertisementSearchQueryBuilder By(TransmissionType transmissionType)
 {
     if (transmissionType != null)
     {
         Query = Query.Where(BuildPredicate(typeof(ADVERTISEMENT), "VEHICL.TRANSMISSION_TYPE_ID", Expression.Equal, transmissionType.Id));
     }
     return(this);
 }
Exemplo n.º 32
0
 public Car(Color bodyColor, BodyStyle bodyType, TransmissionType transmissionKind, CarMaker carCompany, DateTime yearCreated)
 {
     color            = bodyColor;
     bodyStyle        = bodyType;
     transmissionType = transmissionKind;
     carMaker         = carCompany;
     yearMade         = yearCreated;
 }
Exemplo n.º 33
0
 public Model(Guid id, Guid markId, string name, TransmissionType transmissionType, int year)
 {
     Id               = id;
     MarkId           = markId;
     Name             = name;
     TransmissionType = transmissionType;
     Year             = year;
 }
 public override void SendMessages(int messageCount, TransmissionType transmissionType)
 {
     // Don't do this in a real-world application, ENet is not thread safe
     // send should only be called in the thread that also calls host.Service
     for (int i = 0; i < messageCount; i++)
     {
         Broadcast(MessageBuffer, 0, transmissionType);
     }
 }
Exemplo n.º 35
0
 public bool RemoveAction(TransmissionType t)
 {
     // Spawn a feedback object
     if (recallEffect)
     {
         Instantiate(recallEffect, transform.position, Quaternion.identity);
     }
     return(currentTransmissions.Remove(t));
 }
Exemplo n.º 36
0
        public NapaSerialPort(string aPortName, string aBaudRate, string aParity, string aStopBits, string aDataBits, TransmissionType aCurrentTransmissionType)
        {
            baudRate = aPortName;
            baudRate = aBaudRate;
            parity = aParity;
            stopBits = aStopBits;
            dataBits = aDataBits;
            currentTransmissionType = aCurrentTransmissionType;

            Initialize();
        }
Exemplo n.º 37
0
 public Transmission(
     decimal price,
     int weight,
     int acceleration,
     int topSpeed,
     TunningGradeType gradeType,
     TransmissionType transmissionType)
     : base(price, weight, acceleration, topSpeed, gradeType)
 {
     this.transmissionType = transmissionType;
 }
        /// <summary>
        /// Initializes a new instance of the <see cref="UdpServer"/> class.
        /// </summary>
        /// <param name="ipAddress">The IP address to bind to.</param>
        /// <param name="port">The port to bind to.</param>
        /// <param name="multicastAddress">The multicast address to join.</param>
        /// <param name="transmissionType">The associated transmission type.</param>
        public UdpServer(IPAddress ipAddress, int port, IPAddress multicastAddress, TransmissionType transmissionType)
        {
            mPort = port;
            mIPAddress = ipAddress;
            mTransmissionType = transmissionType;

            if (mTransmissionType == TransmissionType.Multicast)
            {
                Assert.ParamIsNotNull(multicastAddress);
                mMulticastAddress = multicastAddress;
            }

            mAsynCallback = new AsyncCallback(EndReceive);
        }
Exemplo n.º 39
0
        /// <summary>
        /// Creates a new the transmission object and adds it to the manager. The manager decides when to and how the
        /// transmission gets removed from it.
        /// </summary>
        /// <returns>The transmission.</returns>
        /// <param name="type">Transmission type.</param>
        /// <param name="path">Full path.</param>
        /// <param name="cachePath">Cache path.</param>
        public Transmission CreateTransmission(TransmissionType type, string path, string cachePath = null) {
            var transmission = new Transmission(type, path, cachePath);
            lock (this.collectionLock) {
                var entry = this.pathToRepoNameMapping.FirstOrDefault(t => path.StartsWith(t.Key));
                transmission.Repository = entry.Value ?? string.Empty;
                if (entry.Key != null) {
                    transmission.RelativePath = path.Substring(entry.Key.Length).TrimStart(System.IO.Path.DirectorySeparatorChar);
                }

                transmission.PropertyChanged += this.TransmissionFinished;
                this.activeTransmissions.Add(transmission);
            }

            return transmission;
        }
Exemplo n.º 40
0
        public UDPReceiver(IPAddress ipAddress, int port, TransmissionType transmissionType, IPAddress multicastAddress, bool consumeParsingExceptions)
        {
            IPAddress = ipAddress;
            Port = port;
            TransmissionType = transmissionType;

            if (TransmissionType == TransmissionType.Multicast)
            {
                if (multicastAddress == null) throw new ArgumentException("Multicast address is not set!");
                MulticastAddress = multicastAddress;
            }

            ConsumeParsingExceptions = consumeParsingExceptions;
            callback = new AsyncCallback(endReceive);
        }
Exemplo n.º 41
0
        public void NotifyLengthChange(TransmissionType type) {
            var underTest = new Transmission(type, this.path);
            long expectedLength = 0;
            int lengthChanged = 0;
            underTest.PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                if (e.PropertyName == Utils.NameOf((Transmission t) => t.Length)) {
                    Assert.That((sender as Transmission).Length, Is.EqualTo(expectedLength));
                    lengthChanged++;
                }
            };

            underTest.Length = expectedLength;
            underTest.Length = expectedLength;
            Assert.That(lengthChanged, Is.EqualTo(1));

            expectedLength = 1024;
            underTest.Length = expectedLength;
            Assert.That(lengthChanged, Is.EqualTo(2));
        }
Exemplo n.º 42
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="ipAddress"></param>
        /// <param name="port"></param>
        /// <param name="multicastAddress"></param>
        /// <param name="transmissionType"></param>
        public UdpServer(IPAddress ipAddress, int port, IPAddress multicastAddress, TransmissionType transmissionType)
        {
            mPort = port;
            mIPAddress = ipAddress;
            mTransmissionType = transmissionType;

            if (mTransmissionType == TransmissionType.Multicast)
            {
                Assert.ParamIsNotNull(multicastAddress);
                mMulticastAddress = multicastAddress;
            }

            #if !WINDOWS
            mDataBuffer = new byte[DataBufferSize];
            #endif

            mAcceptingConnections = true;
            mAsynCallback = new AsyncCallback(EndReceive);
        }
        /// <summary>
        /// Creates a new instance of OscServer.
        /// </summary>
        /// <param name="transportType">The underlying transport protocol.</param>
        /// <param name="ipAddress">The local IP address to bind to.</param>
        /// <param name="port">The UDP port to bind to.</param>
        /// <param name="multicastAddress">The multicast IP address to join.</param>
        /// <param name="transmissionType">The transmission type for the server to use.</param>
        /// <param name="consumeParsingExceptions">Specifies the behavior of handling parsing exceptions.</param>
        /// <remarks>If ipAddress is specified, Unicast; otherwise, if multicastAddress is specified, Multicast.</remarks>
        private OscServer(TransportType transportType, IPAddress ipAddress, int port, IPAddress multicastAddress, TransmissionType transmissionType, bool consumeParsingExceptions = true)
        {
            Assert.IsTrue(transportType == TransportType.Udp || transportType == TransportType.Tcp);
            if ((transportType == TransportType.Tcp) && (transmissionType != TransmissionType.Unicast))
            {
                throw new InvalidOperationException("TCP must be used with TransmissionType.Unicast.");
            }

            mTransportType = transportType;
            mIPAddress = ipAddress;
            mPort = port;
            mIPEndPoint = new IPEndPoint(ipAddress, port);
            mTransmissionType = transmissionType;

            if (mTransmissionType == TransmissionType.Multicast)
            {
                Assert.ParamIsNotNull(multicastAddress);
                mMulticastAddress = multicastAddress;
            }

            mRegisteredMethods = new List<string>();
            mFilterRegisteredMethods = true;
            mConsumeParsingExceptions = consumeParsingExceptions;

            switch (mTransportType)
            {
                case TransportType.Udp:
                    mUdpServer = new UdpServer(mIPAddress, mPort, mMulticastAddress, mTransmissionType);
                    mUdpServer.DataReceived += new EventHandler<UdpDataReceivedEventArgs>(mUdpServer_DataReceived);
                    break;

                case TransportType.Tcp:
                    mTcpServer = new TcpServer(mIPAddress, mPort, true, OscPacket.LittleEndianByteOrder);
                    mTcpServer.DataReceived += new EventHandler<TcpDataReceivedEventArgs>(mTcpServer_DataReceived);
                    break;

                default:
                    throw new InvalidOperationException("Invalid transport type: " + mTransportType.ToString());
            }
        }
Exemplo n.º 44
0
        public static string GetMappingFileName(long id, TransmissionType transmissionType, string name)
        {
            MetadataStructureManager msm = new MetadataStructureManager();
            MetadataStructure metadataStructure = msm.Repo.Get(id);

            // get MetadataStructure
            XDocument xDoc = XmlUtility.ToXDocument((XmlDocument)metadataStructure.Extra);

            List<XElement> tmpList =
                XmlUtility.GetXElementsByAttribute(nodeNames.convertRef.ToString(), new Dictionary<string, string>()
                {
                    {AttributeNames.name.ToString(), name},
                    {AttributeNames.type.ToString(), transmissionType.ToString()}

                }, xDoc).ToList();

            if (tmpList.Count >= 1)
            {
                return tmpList.FirstOrDefault().Attribute("value").Value.ToString();
            }

            return null;
        }
Exemplo n.º 45
0
        public static XmlDocument GetConvertedMetadata(long datasetId, TransmissionType type, string mappingName, bool storing = true)
        {
            XmlDocument newXml;
            try
            {
                DatasetManager datasetManager = new DatasetManager();
                DatasetVersion datasetVersion = datasetManager.GetDatasetLatestVersion(datasetId);

                string mappingFileName = XmlDatasetHelper.GetTransmissionInformation(datasetVersion, type, mappingName);
                string pathMappingFile = Path.Combine(AppConfiguration.GetModuleWorkspacePath("DIM"), mappingFileName);

                XmlMapperManager xmlMapperManager = new XmlMapperManager(TransactionDirection.InternToExtern);
                xmlMapperManager.Load(pathMappingFile, "exporttest");

                newXml = xmlMapperManager.Export(datasetVersion.Metadata, datasetVersion.Id, mappingName, true);

                string title = XmlDatasetHelper.GetInformation(datasetVersion, NameAttributeValues.title);

                // store in content descriptor
                if (storing)
                {
                    if(String.IsNullOrEmpty(mappingName) || mappingName.ToLower() == "generic")
                        storeGeneratedFilePathToContentDiscriptor(datasetId, datasetVersion, "metadata", ".xml");
                    else
                        storeGeneratedFilePathToContentDiscriptor(datasetId, datasetVersion, "metadata_"+ mappingName, ".xml");

                }

            }
            catch (Exception ex)
            {
                throw ex;
            }

            return newXml;
        }
 private SolverClass InitializeMocksAndCreateSolver(TransmissionType type = TransmissionType.UPLOAD_NEW_FILE, long chunkSize = 1024) {
     this.session = new Mock<ISession>().SetupTypeSystem().SetupPrivateWorkingCopyCapability();
     this.storage = new Mock<IMetaDataStorage>();
     this.transmissionStorage = new Mock<IFileTransmissionStorage>();
     this.transmissionStorage.Setup(s => s.ChunkSize).Returns(chunkSize);
     this.transmission = new Transmission(type, Path.GetTempPath());
     return new SolverClass(this.session.Object, this.storage.Object, this.transmissionStorage.Object);
 }
Exemplo n.º 47
0
        public static string IsValideAgainstSchema(long datasetId, TransmissionType type, string mappingName)
        {
            try
            {
                DatasetManager datasetManager = new DatasetManager();
                DatasetVersion datasetVersion = datasetManager.GetDatasetLatestVersion(datasetId);

                string mappingFileName = XmlDatasetHelper.GetTransmissionInformation(datasetVersion, type, mappingName);
                string pathMappingFile = Path.Combine(AppConfiguration.GetModuleWorkspacePath("DIM"), mappingFileName);

                XmlMapperManager xmlMapperManager = new XmlMapperManager(TransactionDirection.InternToExtern);
                xmlMapperManager.Load(pathMappingFile, "exporttest");

                XmlDocument tmp = GetConvertedMetadata(datasetId, type, mappingName, false);

                string path = Path.Combine(AppConfiguration.DataPath, "Temp", "System", "convertedMetadata.xml");

                if (FileHelper.FileExist(path))
                    FileHelper.Delete(path);

                FileHelper.CreateDicrectoriesIfNotExist(Path.GetDirectoryName(path));

                tmp.Save(path);
                XmlDocument metadataForImport = new XmlDocument();
                metadataForImport.Load(path);

                return xmlMapperManager.Validate(metadataForImport);
            }
            catch (Exception ex)
            {

                return ex.Message;
            }
        }
Exemplo n.º 48
0
        /// <summary>
        /// Initializes a new instance of the <see cref="CmisSync.Lib.FileTransmission.Transmission"/> class.
        /// </summary>
        /// <param name='type'>
        /// Type of the transmission.
        /// </param>
        /// <param name='path'>
        /// Path to the file of the transmission.
        /// </param>
        /// <param name='cachePath'>
        /// If a download runs and a cache file is used, this should be the path to the cache file
        /// </param>
        public Transmission(TransmissionType type, string path, string cachePath = null) {
            if (path == null) {
                throw new ArgumentNullException("path");
            }

            this.type = type;
            this.Path = path;
            this.CachePath = cachePath;
        }
Exemplo n.º 49
0
 public CommunicationManager(bool hasPlotData)
 {
     this._ok2send = true;
     this.SendFlag = 1;
     this._baudRate = string.Empty;
     this._parity = string.Empty;
     this._stopBits = string.Empty;
     this._dataBits = string.Empty;
     this._portName = string.Empty;
     this._portNum = "-1";
     this._TTBPortNum = "-1";
     this._rxName = string.Empty;
     this._sourceDeviceName = string.Empty;
     this._readBuffer = 0x2000;
     this._lowPowerParams = new lowPowerParams();
     this.comPort = new CommWrapper();
     this.SrcDeviceName = string.Empty;
     this.lockread = new object();
     this.lockwrite = new object();
     this._protocol = "SSB";
     this._rxType = ReceiverType.SLC;
     this.m_Protocols = new MsgFactory(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\Protocols.xml");
     this.m_NavData = new NavigationAnalysisData(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\ReferenceLocation.xml");
     this.m_TestSetup = new TestSetup();
     this._productFamily = CommonClass.ProductType.GSD4e;
     this._trackerPort = string.Empty;
     this._resetPort = string.Empty;
     this._hostPair1 = string.Empty;
     this._requiredRunHost = true;
     this._hostSWFilePath = string.Empty;
     this._hostAppCfgFilePath = string.Empty;
     this._hostAppMEMSCfgPath = string.Empty;
     this._I2CmasterAddr = string.Empty;
     this._I2CslaveAddr = string.Empty;
     this._I2Cport = string.Empty;
     this.DefaultTCXOFreq = string.Empty;
     this.TrackerPortSelect = "uart";
     this.OnOffLineUsage = "uart_cts";
     this.ExtSResetNLineUsage = "uart_dtr";
     this.WarmupDelay = 0x3ff;
     this.DebugSettings = 1;
     this.IsVersion4_1_A8AndAbove = true;
     this._requireEE = true;
     this._eeSelected = string.Empty;
     this._serverName = string.Empty;
     this._serverPort = string.Empty;
     this._authenCode = string.Empty;
     this._eeDayNum = string.Empty;
     this._bankTime = string.Empty;
     this.dataGui = new DataForGUI();
     this.dataGui_ALL = new DataForGUI(60);
     this.SignalDataQ_ALL = new Queue<SignalData>();
     this.TotalOfGroupMsg1 = 1;
     this.dataICTrack = new TrackerIC();
     this.RxCtrl = new Receiver();
     this.AutoReplyCtrl = new AutoReplyMgr();
     this.TTBPort = new CommWrapper();
     this.TrackerICCtrl = new TrackerIC();
     this.SiRFNavStartStop = new SiRFNavParams();
     this.NavigationParamrters = new NavigationParametersClass();
     this.NavSolutionParams = new NavSolutionClass();
     this.ConnectErrorString = string.Empty;
     this._hwCfgMsgQName = string.Empty;
     this._timeAidMsgQName = string.Empty;
     this._freqAidMsgQName = string.Empty;
     this._posAidMsgQName = string.Empty;
     this._posReqAckMsgQName = string.Empty;
     this._autoReplyConfigFilePath = clsGlobal.InstalledDirectory + @"\scripts\SiRFLiveAutomationSetupAutoReply.cfg";
     this.ErrorLogFilePath = string.Empty;
     this.DisplayQueue = new Queue(MAX_MSG_BUFFER);
     this.ToSwitchProtocol = "OSP";
     this.ToSwitchBaud = "115200";
     this._messageProtocol = "OSP";
     this._currentProtocol = "OSP";
     this._currentBaud = "115200";
     this._IMUFilePath = "";
     this._aidingProtocol = "SSB";
     this._myWindowTitle = string.Empty;
     this._CSVBuff = new byte[MAX_BYTES_BUFFER];
     this._enableLocationMapView = true;
     this._enableSignalView = true;
     this._enableSVsMap = true;
     this._enableSatelliteStats = true;
     this._monitorNav = true;
     this._enableMEMSView = true;
     this._enableCompassView = true;
     this._locationMapRadius = 5.0;
     this._responseViewRTBDisplay = new CommonUtilsClass();
     this._errorViewRTBDisplay = new CommonUtilsClass();
     this._debugViewRTBDisplay = new CommonUtilsClass();
     this.StringRxNavParams = string.Empty;
     this._helperFunctions = new HelperFunctions();
     this._dataReadLock = new object();
     this.DisplayDataLock = new object();
     this._inDataBytes = new List<byte>();
     this.ErrorStringList = new List<string>();
     this.LockErrorLog = new object();
     this.ErrorCfgFilePath = clsGlobal.InstalledDirectory + @"\Config\errorLists.cfg";
     this.UserSpecifiedLogCfgFilePath = clsGlobal.InstalledDirectory + @"\Config\userMessageLists.cfg";
     this.UserSpecifiedMsgList = new List<string>();
     this.UserSpecifiedSubStringList = new List<string>();
     this.StringDRNavStatus = string.Empty;
     this.StringDRNavState = string.Empty;
     this.StringDRNavSubsystemData = string.Empty;
     this.StringDRInputCarBusData = string.Empty;
     this.StringDRSensorData = string.Empty;
     this.I2CModeSwitchDone = true;
     this.NavTruthDataHash = new Hashtable();
     this._debugViewMatchStr = string.Empty;
     this.ToSendMsgQueue = new Queue();
     this._lockwrite = new object();
     this.MAX_SIG_BUFFER = 5;
     this.LockSignalDataUpdate = new object();
     this.LockSignalDataUpdate_ALL = new object();
     this.SignalDataQ = new Queue<SignalData>();
     this.NMEA_navMode = "No Fix";
     this._lockCommErrorCnt = new object();
     if (hasPlotData)
     {
         this.dataPlot = new DataForPlotting();
     }
     this.m_NavData = new NavigationAnalysisData(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\ReferenceLocation.xml");
     this._baudRate = "115200";
     this._parity = "None";
     this._stopBits = "1";
     this._dataBits = "8";
     this._portName = "COM8";
     this._rxType = ReceiverType.SLC;
     this.RxTransType = TransmissionType.GPS;
     this.LogFormat = TransmissionType.GPS;
     this._idx_CSVBuff = 0;
     this._CSVBuff.Initialize();
     this._b1 = 0;
     this._b2 = 0;
     this._nmea_Str = "";
     this._lastAidingSessionReportedClockDrift = 0.0;
     this._lastClockDrift = 0;
     this._log = new LogManager(clsGlobal.SiRFLiveVersion);
     this.CMC = new CommMgrClass();
     if (File.Exists(this.ErrorCfgFilePath))
     {
         this.ErrorStringList.Clear();
         StreamReader reader = new StreamReader(this.ErrorCfgFilePath);
         string str = reader.ReadLine();
         if ((str != null) && (str != string.Empty))
         {
             foreach (string str2 in str.Split(new char[] { '%' }))
             {
                 string str3 = str2.TrimEnd(new char[0]);
                 this.ErrorStringList.Add(str3.TrimStart(new char[0]));
             }
         }
         reader.Close();
         reader.Dispose();
         reader = null;
     }
     if (File.Exists(this.UserSpecifiedLogCfgFilePath))
     {
         this.UserSpecifiedMsgList.Clear();
         this.UserSpecifiedSubStringList.Clear();
         StreamReader reader2 = new StreamReader(this.UserSpecifiedLogCfgFilePath);
         string str4 = reader2.ReadLine();
         if ((str4 != null) && (str4 != string.Empty))
         {
             foreach (string str5 in str4.Split(new char[] { '%' }))
             {
                 string str6 = str5.TrimEnd(new char[0]);
                 this.UserSpecifiedMsgList.Add(str6.TrimStart(new char[0]));
             }
             str4 = reader2.ReadLine();
         }
         if ((str4 != null) && (str4 != string.Empty))
         {
             foreach (string str7 in str4.Split(new char[] { '%' }))
             {
                 string str8 = str7.TrimEnd(new char[0]);
                 this.UserSpecifiedSubStringList.Add(str8.TrimStart(new char[0]));
             }
         }
         if (this.UserSpecifiedSubStringList.Count < this.UserSpecifiedMsgList.Count)
         {
             int num = this.UserSpecifiedMsgList.Count - this.UserSpecifiedSubStringList.Count;
             for (int i = 0; i < num; i++)
             {
                 this.UserSpecifiedSubStringList.Add("Y");
             }
         }
         reader2.Close();
         reader2.Dispose();
         reader2 = null;
     }
 }
 /// <summary>
 /// Creates a new instance of OscServer.
 /// </summary>
 /// <param name="ipAddress">The local IP address to bind to.</param>
 /// <param name="port">The UDP port to bind to.</param>
 /// <param name="transmissionType"></param>
 /// <param name="consumeParsingExceptions">Specifies the behavior of handling parsing exceptions.</param>
 /// <remarks>Use this constructor for TransportType.Udp, and any TransmissionType except Multicast.</remarks>
 public OscServer(IPAddress ipAddress, int port, TransmissionType transmissionType, bool consumeParsingExceptions = true)
     : this(TransportType.Udp, ipAddress, port, null, transmissionType, consumeParsingExceptions)
 {
 }
Exemplo n.º 51
0
 public Transmission() {
     this.type = TransmissionType.UPLOAD_NEW_FILE;
     this.Path = "Not Set";
     this.CachePath = null;
 }
 public static Mock<Transmission> SetupCreateTransmissionOnce(this Mock<ITransmissionManager> manager, TransmissionType type, string path = null, string cachePath = null) {
     var p = path ?? string.Empty;
     var transmission = new Mock<Transmission>(type, p, cachePath) { CallBase = true };
     manager.Setup(m => m.CreateTransmission(type, p, cachePath)).ReturnsInOrder(transmission.Object, null);
     return transmission;
 }
Exemplo n.º 53
0
 public void FilePlaybackCommSetup()
 {
     string str = this._messageProtocol;
     if (str != null)
     {
         if (!(str == "SSB"))
         {
             if (!(str == "OSP"))
             {
                 if (str == "NMEA")
                 {
                     this._txTransType = TransmissionType.Text;
                     this.RxTransType = TransmissionType.Text;
                     this.LogFormat = TransmissionType.Text;
                     this._rxType = ReceiverType.NMEA;
                     this.RxCtrl = new NMEAReceiver();
                     this.RxCtrl.RxCommWindow = this;
                     this.RxCtrl.DutStationSetup = this.m_TestSetup;
                     this.RxCtrl.RxNavData = this.m_NavData;
                     this.RxCtrl.MessageProtocol = this._messageProtocol;
                     this.RxCtrl.AidingProtocol = this._aidingProtocol;
                     this.RxCtrl.ResetCtrl = new NMEAReset();
                     this.RxCtrl.ResetCtrl.ResetComm = this;
                     this.RxCtrl.ResetCtrl.DutStationSetup = this.RxCtrl.DutStationSetup;
                     this.RxCtrl.ResetCtrl.ResetNavData = this.RxCtrl.RxNavData;
                     this.ListenersCtrl = new NMEAListnerManager();
                     this.ListenersCtrl.AidingProtocol = this._aidingProtocol;
                     this.ListenersCtrl.RxType = this._rxType;
                 }
                 return;
             }
         }
         else
         {
             this._txTransType = TransmissionType.GP2;
             this.LogFormat = TransmissionType.GPS;
             this.RxCtrl = new SS3AndGSD3TWReceiver();
             this.RxCtrl.RxCommWindow = this;
             this.RxCtrl.DutStationSetup = this.m_TestSetup;
             this.RxCtrl.RxNavData = this.m_NavData;
             this.RxCtrl.MessageProtocol = this._messageProtocol;
             if (this._rxType == ReceiverType.GSW)
             {
                 this._aidingProtocol = "SSB";
             }
             else
             {
                 this._aidingProtocol = "AI3";
             }
             this.RxCtrl.AidingProtocol = this._aidingProtocol;
             this.RxCtrl.ControlChannelProtocolFile = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\Protocols_F.xml";
             this.RxCtrl.ControlChannelVersion = "2.1";
             this.RxCtrl.ResetCtrl = new FAndSSBReset();
             this.RxCtrl.ResetCtrl.ResetComm = this;
             this.RxCtrl.ResetCtrl.DutStationSetup = this.RxCtrl.DutStationSetup;
             this.RxCtrl.ResetCtrl.ResetNavData = this.RxCtrl.RxNavData;
             this.AutoReplyCtrl = new AutoReplyMgr_F(this.RxCtrl.ControlChannelProtocolFile);
             this.AutoReplyCtrl.ControlChannelVersion = this.RxCtrl.ControlChannelVersion;
             this.ListenersCtrl = new ListenerManager();
             this.ListenersCtrl.AidingProtocol = this._aidingProtocol;
             this.ListenersCtrl.RxType = this._rxType;
             this.AutoReplyCtrl = new AutoReplyMgr_F();
             return;
         }
         this._txTransType = TransmissionType.GP2;
         this.LogFormat = TransmissionType.GPS;
         this.RxCtrl = new OSPReceiver();
         this.RxCtrl.RxCommWindow = this;
         this.RxCtrl.DutStationSetup = this.m_TestSetup;
         this.RxCtrl.RxNavData = this.m_NavData;
         this.RxCtrl.MessageProtocol = this._messageProtocol;
         this.RxCtrl.AidingProtocol = this._aidingProtocol;
         this.RxCtrl.ControlChannelProtocolFile = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\Protocols_F.xml";
         this.RxCtrl.ControlChannelVersion = "1.0";
         this.RxCtrl.ResetCtrl = new OSPReset();
         this.RxCtrl.ResetCtrl.ResetComm = this;
         this.RxCtrl.ResetCtrl.DutStationSetup = this.RxCtrl.DutStationSetup;
         this.RxCtrl.ResetCtrl.ResetNavData = this.RxCtrl.RxNavData;
         this.AutoReplyCtrl = new AutoReplyMgr_OSP(this.RxCtrl.ControlChannelProtocolFile);
         this.AutoReplyCtrl.ControlChannelVersion = this.RxCtrl.ControlChannelVersion;
         this.ListenersCtrl = new OSPListnerManager();
         this.ListenersCtrl.AidingProtocol = this._aidingProtocol;
         this.ListenersCtrl.RxType = this._rxType;
     }
 }
Exemplo n.º 54
0
 private string getMappingFileName(DatasetVersion datasetVersion, TransmissionType convertType, string name)
 {
     return XmlMetadataImportHelper.GetMappingFileName(datasetVersion.Dataset.MetadataStructure.Id, convertType, name);
 }
Exemplo n.º 55
0
 /// <summary>
 /// Creates a new instance of OscServer.
 /// </summary>
 /// <param name="transportType">The underlying transport protocol.</param>
 /// <param name="ipAddress">The local IP address to bind to.</param>
 /// <param name="port">The UDP port to bind to.</param>
 /// <param name="multicastAddress">The multicast IP address to join.</param>
 /// <param name="transmissionType">The transmission type for the server to use.</param>
 /// <remarks>If ipAddress is specified, Unicast; otherwise, if multicastAddress is specified, Multicast.</remarks>
 public OscServer(Bespoke.Common.Net.TransportType transportType, IPAddress ipAddress, int port, IPAddress multicastAddress, TransmissionType transmissionType)
     : this(transportType, ipAddress, port, multicastAddress, transmissionType, true)
 {
 }
Exemplo n.º 56
0
 public CommunicationManager(string baud, string par, string sBits, string dBits, string name, CommonClass.MyRichTextBox rtb, MyPanel pnl, MyPanel pn_SVs, MyPanel pn_Loc, ReceiverType rx)
 {
     this._ok2send = true;
     this.SendFlag = 1;
     this._baudRate = string.Empty;
     this._parity = string.Empty;
     this._stopBits = string.Empty;
     this._dataBits = string.Empty;
     this._portName = string.Empty;
     this._portNum = "-1";
     this._TTBPortNum = "-1";
     this._rxName = string.Empty;
     this._sourceDeviceName = string.Empty;
     this._readBuffer = 0x2000;
     this._lowPowerParams = new lowPowerParams();
     this.comPort = new CommWrapper();
     this.SrcDeviceName = string.Empty;
     this.lockread = new object();
     this.lockwrite = new object();
     this._protocol = "SSB";
     this._rxType = ReceiverType.SLC;
     this.m_Protocols = new MsgFactory(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\Protocols.xml");
     this.m_NavData = new NavigationAnalysisData(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\ReferenceLocation.xml");
     this.m_TestSetup = new TestSetup();
     this._productFamily = CommonClass.ProductType.GSD4e;
     this._trackerPort = string.Empty;
     this._resetPort = string.Empty;
     this._hostPair1 = string.Empty;
     this._requiredRunHost = true;
     this._hostSWFilePath = string.Empty;
     this._hostAppCfgFilePath = string.Empty;
     this._hostAppMEMSCfgPath = string.Empty;
     this._I2CmasterAddr = string.Empty;
     this._I2CslaveAddr = string.Empty;
     this._I2Cport = string.Empty;
     this.DefaultTCXOFreq = string.Empty;
     this.TrackerPortSelect = "uart";
     this.OnOffLineUsage = "uart_cts";
     this.ExtSResetNLineUsage = "uart_dtr";
     this.WarmupDelay = 0x3ff;
     this.DebugSettings = 1;
     this.IsVersion4_1_A8AndAbove = true;
     this._requireEE = true;
     this._eeSelected = string.Empty;
     this._serverName = string.Empty;
     this._serverPort = string.Empty;
     this._authenCode = string.Empty;
     this._eeDayNum = string.Empty;
     this._bankTime = string.Empty;
     this.dataGui = new DataForGUI();
     this.dataGui_ALL = new DataForGUI(60);
     this.SignalDataQ_ALL = new Queue<SignalData>();
     this.TotalOfGroupMsg1 = 1;
     this.dataICTrack = new TrackerIC();
     this.RxCtrl = new Receiver();
     this.AutoReplyCtrl = new AutoReplyMgr();
     this.TTBPort = new CommWrapper();
     this.TrackerICCtrl = new TrackerIC();
     this.SiRFNavStartStop = new SiRFNavParams();
     this.NavigationParamrters = new NavigationParametersClass();
     this.NavSolutionParams = new NavSolutionClass();
     this.ConnectErrorString = string.Empty;
     this._hwCfgMsgQName = string.Empty;
     this._timeAidMsgQName = string.Empty;
     this._freqAidMsgQName = string.Empty;
     this._posAidMsgQName = string.Empty;
     this._posReqAckMsgQName = string.Empty;
     this._autoReplyConfigFilePath = clsGlobal.InstalledDirectory + @"\scripts\SiRFLiveAutomationSetupAutoReply.cfg";
     this.ErrorLogFilePath = string.Empty;
     this.DisplayQueue = new Queue(MAX_MSG_BUFFER);
     this.ToSwitchProtocol = "OSP";
     this.ToSwitchBaud = "115200";
     this._messageProtocol = "OSP";
     this._currentProtocol = "OSP";
     this._currentBaud = "115200";
     this._IMUFilePath = "";
     this._aidingProtocol = "SSB";
     this._myWindowTitle = string.Empty;
     this._CSVBuff = new byte[MAX_BYTES_BUFFER];
     this._enableLocationMapView = true;
     this._enableSignalView = true;
     this._enableSVsMap = true;
     this._enableSatelliteStats = true;
     this._monitorNav = true;
     this._enableMEMSView = true;
     this._enableCompassView = true;
     this._locationMapRadius = 5.0;
     this._responseViewRTBDisplay = new CommonUtilsClass();
     this._errorViewRTBDisplay = new CommonUtilsClass();
     this._debugViewRTBDisplay = new CommonUtilsClass();
     this.StringRxNavParams = string.Empty;
     this._helperFunctions = new HelperFunctions();
     this._dataReadLock = new object();
     this.DisplayDataLock = new object();
     this._inDataBytes = new List<byte>();
     this.ErrorStringList = new List<string>();
     this.LockErrorLog = new object();
     this.ErrorCfgFilePath = clsGlobal.InstalledDirectory + @"\Config\errorLists.cfg";
     this.UserSpecifiedLogCfgFilePath = clsGlobal.InstalledDirectory + @"\Config\userMessageLists.cfg";
     this.UserSpecifiedMsgList = new List<string>();
     this.UserSpecifiedSubStringList = new List<string>();
     this.StringDRNavStatus = string.Empty;
     this.StringDRNavState = string.Empty;
     this.StringDRNavSubsystemData = string.Empty;
     this.StringDRInputCarBusData = string.Empty;
     this.StringDRSensorData = string.Empty;
     this.I2CModeSwitchDone = true;
     this.NavTruthDataHash = new Hashtable();
     this._debugViewMatchStr = string.Empty;
     this.ToSendMsgQueue = new Queue();
     this._lockwrite = new object();
     this.MAX_SIG_BUFFER = 5;
     this.LockSignalDataUpdate = new object();
     this.LockSignalDataUpdate_ALL = new object();
     this.SignalDataQ = new Queue<SignalData>();
     this.NMEA_navMode = "No Fix";
     this._lockCommErrorCnt = new object();
     this.m_NavData = new NavigationAnalysisData(ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\ReferenceLocation.xml");
     this._baudRate = baud;
     this._parity = par;
     this._stopBits = sBits;
     this._dataBits = dBits;
     this._portName = name;
     this._displayPanelSignal = pnl;
     this._displayPanelSVs = pn_SVs;
     this._displayPanelLocation = pn_Loc;
     this._rxType = rx;
     this._rxType = ReceiverType.SLC;
     this.RxTransType = TransmissionType.GPS;
     this._idx_CSVBuff = 0;
     this._CSVBuff.Initialize();
     this._b1 = 0;
     this._b2 = 0;
     this._nmea_Str = "";
     this._lastAidingSessionReportedClockDrift = 0.0;
     this._lastClockDrift = 0;
 }
Exemplo n.º 57
0
 public void SwitchProtocol()
 {
     if (this.ToSwitchProtocol != this._messageProtocol)
     {
         this.AutoDetectProtocolAndBaudDone = false;
         Thread.Sleep(50);
         this._messageProtocol = this.ToSwitchProtocol;
         if (this._messageProtocol == "OSP")
         {
             this._rxType = ReceiverType.SLC;
             this.RxTransType = TransmissionType.GPS;
             this._txTransType = TransmissionType.GP2;
         }
         else if (this._messageProtocol == "NMEA")
         {
             this.dataGui.AGC_Gain = 0;
             this._rxType = ReceiverType.NMEA;
             this.RxTransType = TransmissionType.Text;
             this._txTransType = TransmissionType.Text;
         }
         this.BaudRate = this.ToSwitchBaud;
         this.SetupRxCtrl();
         this.portDataInit();
         Thread.Sleep(5);
         int num = 0;
         bool flag = false;
         uint baud = uint.Parse(this.BaudRate);
         while (num++ < 5)
         {
             flag = this.comPort.UpdateBaudSettings(baud);
             if (flag)
             {
                 break;
             }
             Thread.Sleep(1);
         }
         this.portDataInit();
         if (flag)
         {
             if (this._messageProtocol == "OSP")
             {
                 this.RxCtrl.SetMessageRateForFactory();
             }
         }
         else
         {
             this.ErrorPrint("Error updating port");
         }
         this.AutoDetectProtocolAndBaudDone = true;
     }
 }
Exemplo n.º 58
0
 public bool SetupRxCtrl()
 {
     bool flag = false;
     try
     {
         this.m_Protocols.m_messageProtocol = this._messageProtocol;
         string str = this._messageProtocol;
         if (str != null)
         {
             if (!(str == "SSB"))
             {
                 if (str == "OSP")
                 {
                     goto Label_0205;
                 }
                 if (str == "NMEA")
                 {
                     goto Label_0398;
                 }
             }
             else
             {
                 this._txTransType = TransmissionType.GP2;
                 this.LogFormat = TransmissionType.GPS;
                 this.RxCtrl = new SS3AndGSD3TWReceiver();
                 this.RxCtrl.RxCommWindow = this;
                 this.RxCtrl.DutStationSetup = this.m_TestSetup;
                 this.RxCtrl.RxNavData = this.m_NavData;
                 this.RxCtrl.MessageProtocol = this._messageProtocol;
                 if (this._rxType == ReceiverType.GSW)
                 {
                     this._aidingProtocol = "SSB";
                 }
                 else
                 {
                     this._aidingProtocol = "AI3";
                 }
                 this.RxCtrl.AidingProtocol = this._aidingProtocol;
                 this.RxCtrl.ControlChannelProtocolFile = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\Protocols_F.xml";
                 this.RxCtrl.ControlChannelVersion = "2.1";
                 this.RxCtrl.AidingProtocolVersion = "2.2";
                 this.RxCtrl.ResetCtrl = new FAndSSBReset();
                 this.RxCtrl.ResetCtrl.ResetComm = this;
                 this.RxCtrl.ResetCtrl.DutStationSetup = this.RxCtrl.DutStationSetup;
                 this.RxCtrl.ResetCtrl.ResetNavData = this.RxCtrl.RxNavData;
                 this.RxCtrl.ResetCtrl.ResetGPSTimer = this.RxCtrl.GPSTimerEngine;
                 this.AutoReplyCtrl = new AutoReplyMgr_F(this.RxCtrl.ControlChannelProtocolFile);
                 this.AutoReplyCtrl.ControlChannelVersion = this.RxCtrl.ControlChannelVersion;
                 this.AutoReplyCtrl.AidingProtocolVersion = this.RxCtrl.AidingProtocolVersion;
                 this.ListenersCtrl = new ListenerManager();
                 this.ListenersCtrl.AidingProtocol = this._aidingProtocol;
                 this.ListenersCtrl.RxType = this._rxType;
             }
         }
         goto Label_0493;
     Label_0205:
         this._txTransType = TransmissionType.GP2;
         this.LogFormat = TransmissionType.GPS;
         this.RxCtrl = new OSPReceiver();
         this.RxCtrl.RxCommWindow = this;
         this.RxCtrl.DutStationSetup = this.m_TestSetup;
         this.RxCtrl.RxNavData = this.m_NavData;
         this.RxCtrl.MessageProtocol = this._messageProtocol;
         this.RxCtrl.AidingProtocol = this._aidingProtocol;
         this.RxCtrl.ControlChannelProtocolFile = ConfigurationManager.AppSettings["InstalledDirectory"] + @"\Protocols\Protocols_F.xml";
         this.RxCtrl.ControlChannelVersion = "1.0";
         this.RxCtrl.AidingProtocolVersion = "1.0";
         this.RxCtrl.ResetCtrl = new OSPReset();
         this.RxCtrl.ResetCtrl.ResetComm = this;
         this.RxCtrl.ResetCtrl.DutStationSetup = this.RxCtrl.DutStationSetup;
         this.RxCtrl.ResetCtrl.ResetNavData = this.RxCtrl.RxNavData;
         this.RxCtrl.ResetCtrl.ResetGPSTimer = this.RxCtrl.GPSTimerEngine;
         this.AutoReplyCtrl = new AutoReplyMgr_OSP(this.RxCtrl.ControlChannelProtocolFile);
         this.AutoReplyCtrl.ControlChannelVersion = this.RxCtrl.ControlChannelVersion;
         this.AutoReplyCtrl.AidingProtocolVersion = this.RxCtrl.AidingProtocolVersion;
         this.ListenersCtrl = new OSPListnerManager();
         this.ListenersCtrl.AidingProtocol = this._aidingProtocol;
         this.ListenersCtrl.RxType = this._rxType;
         goto Label_0493;
     Label_0398:
         this._txTransType = TransmissionType.Text;
         this.RxTransType = TransmissionType.Text;
         this.LogFormat = TransmissionType.Text;
         this._rxType = ReceiverType.NMEA;
         this.RxCtrl = new NMEAReceiver();
         this.RxCtrl.RxCommWindow = this;
         this.RxCtrl.DutStationSetup = this.m_TestSetup;
         this.RxCtrl.RxNavData = this.m_NavData;
         this.RxCtrl.MessageProtocol = this._messageProtocol;
         this.RxCtrl.AidingProtocol = this._aidingProtocol;
         this.RxCtrl.ResetCtrl = new NMEAReset();
         this.RxCtrl.ResetCtrl.ResetComm = this;
         this.RxCtrl.ResetCtrl.DutStationSetup = this.RxCtrl.DutStationSetup;
         this.RxCtrl.ResetCtrl.ResetNavData = this.RxCtrl.RxNavData;
         this.ListenersCtrl = new NMEAListnerManager();
         this.ListenersCtrl.AidingProtocol = this._aidingProtocol;
         this.ListenersCtrl.RxType = this._rxType;
     Label_0493:
         flag = true;
     }
     catch (Exception exception)
     {
         this.ErrorPrint(exception.Message);
         flag = false;
     }
     return flag;
 }