Esempio n. 1
0
        public override MID processPackage(string package)
        {
            if (base.isCorrectType(package))
            {
                base.processPackage(package);

                this.TighteningID     = Convert.ToInt32(base.RegisteredDataFields[(int)DataFields.TIGHTENING_ID].Value);
                this.VINNumber        = base.RegisteredDataFields[(int)DataFields.VIN_NUMBER].Value.ToString();
                this.ParameterSetID   = Convert.ToInt32(base.RegisteredDataFields[(int)DataFields.PARAMETER_SET_ID].Value);
                this.BatchCounter     = Convert.ToInt32(base.RegisteredDataFields[(int)DataFields.BATCH_COUNTER].Value);
                this.TighteningStatus = Convert.ToBoolean(Convert.ToInt32(base.RegisteredDataFields[(int)DataFields.TIGHTENING_STATUS].Value));
                this.TorqueStatus     = (TighteningValuesStatuses)Convert.ToInt32(base.RegisteredDataFields[(int)DataFields.TORQUE_STATUS].Value);
                this.AngleStatus      = (TighteningValuesStatuses)Convert.ToInt32(base.RegisteredDataFields[(int)DataFields.ANGLE_STATUS].Value);
                this.Torque           = Convert.ToInt32(base.RegisteredDataFields[(int)DataFields.TORQUE].Value) / 100m;
                this.Angle            = Convert.ToInt32(base.RegisteredDataFields[(int)DataFields.ANGLE].Value);
                this.TimeStamp        = base.RegisteredDataFields[(int)DataFields.TIMESTAMP].ToDateTime();
                this.BatchStatus      = (BatchStatuses)Convert.ToInt32(base.RegisteredDataFields[(int)DataFields.ANGLE_STATUS].Value);

                return(this);
            }

            if (this.nextTemplate == null)
            {
                throw new NotImplementedException("MID not implemented or doesn't exists");
            }


            return(this.nextTemplate.processPackage(package));
        }
Esempio n. 2
0
        /// <summary>
        /// Constructor
        /// </summary>
        public RCTGateway(RCTLogger aLogger = null)
        {
            MCMCompanyList = new List <MCMCompany>();
            log            = aLogger;

            if (log == null)
            {
                log = dummyLogger;
            }

            batchstatus = BatchStatuses.NotReady;

            log("Created gateway");
        }
Esempio n. 3
0
        //---------------------------------------------------------------------------------------------
        public StatusCodes StartBatch(RCTCallBack aCallback, string MCMCompanyCode)
        {
            // Set up the callback function
            callback = aCallback;

            status = StatusCodes.Success;

            // Create the toolkit if it's not already created
            if (tToolkit == null)
            {
                tToolkit = new Enterprise04.Toolkit() as IToolkit3;
                // Backdoor the toolkit
                int val1 = 0, val2 = 0, val3 = 0;
                ctkDebugLog.StartDebugLog(ref val1, ref val2, ref val3); // Backdoor the toolkit (renamed for obfuscation)
                tToolkit.Configuration.SetDebugMode(val1, val2, val3);
            }

            // Open the toolkit for the selected company
            Enterprise04.ICompanyManager coManager = tToolkit.Company;
            int nCos = coManager.cmCount;

            for (int index = 1; index <= nCos; index++)
            {
                MCMCompany aCompany = new MCMCompany();
                aCompany.name = coManager.cmCompany[index].coName.Trim();
                aCompany.code = coManager.cmCompany[index].coCode.Trim();
                aCompany.path = coManager.cmCompany[index].coPath.Trim();
                MCMCompanyList.Add(aCompany);

                if (MCMCompanyCode.ToUpper() == aCompany.code.ToUpper())
                {
                    selCompany = aCompany;
                    log("Found company " + aCompany.code);
                }
            }

            // Find the selected company and open the toolkit against it
            if (selCompany == null)
            {
                errorString = "Invalid company code : " + MCMCompanyCode;
                status      = StatusCodes.DataError;
            }
            else
            {
                // Open the toolkit against the company
                if (tToolkit.Status == TToolkitStatus.tkOpen)
                {
                    tToolkit.CloseToolkit();
                }
                tToolkit.Configuration.DataDirectory = selCompany.path;
                int Res = tToolkit.OpenToolkit();
                if (Res != 0)
                {
                    errorString = "Couldn't open toolkit for company " + selCompany.code;
                    status      = StatusCodes.ToolkitError;
                }
                else
                {
                    log("Toolkit opened successfully for company " + selCompany.code);
                    status = StatusCodes.Success;
                }
            }

            if (status == StatusCodes.Success)
            {
                rctBatch.Clear();
                batchstatus = BatchStatuses.Initialised;

                log("Empty Batch ready");
            }

            return(status);
        }