internal BoschOrientationDataType(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes) :
     base(input, module, register, id, attributes)
 {
 }
 internal SensorFusionAsyncDataProducer(DataTypeBase datatype, byte mask, IModuleBoardBridge bridge) : base(datatype, bridge)
 {
     this.mask = mask;
 }
 public override DataTypeBase copy(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes)
 {
     return(new QuaternionDataType(input, module, register, id, attributes));
 }
 internal CorrectedAngularVelocityDataType(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes) :
     base(input, module, register, id, attributes)
 {
 }
 internal CorrectedBFieldDataType(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes) :
     base(input, module, register, id, attributes)
 {
 }
 public AccelerationFloatData(IModuleBoardBridge bridge, DataTypeBase datatype, DateTime timestamp, byte[] bytes) :
     base(bridge, datatype, timestamp, bytes)
 {
 }
 internal CorrectedAccelerationData(IModuleBoardBridge bridge, DataTypeBase datatype, DateTime timestamp, byte[] bytes) :
     base(bridge, datatype, timestamp, bytes)
 {
 }
 internal AnyMotionData(DataTypeBase datatype, IModuleBoardBridge bridge, DateTime timestamp, byte[] bytes) :
     base(bridge, datatype, timestamp, bytes)
 {
 }
 internal BoschMotionDataProducer(DataTypeBase dataTypeBase, IModuleBoardBridge bridge) :
     base(MOTION_INTERRUPT_ENABLE, 0x0, dataTypeBase, bridge)
 {
     accelerometer = bridge.GetModule <IAccelerometerBosch>() as AccelerometerBosch;
 }
 internal BoschLowHighGDataType(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes) :
     base(input, module, register, id, attributes)
 {
 }
 internal BoschLowHighDDataProducer(DataTypeBase dataTypeBase, IModuleBoardBridge bridge) :
     base(LOW_HIGH_G_INTERRUPT_ENABLE, 0x0, dataTypeBase, bridge)
 {
 }
 internal BoschTapDataProducer(DataTypeBase dataTypeBase, IModuleBoardBridge bridge) : base(TAP_INTERRUPT_ENABLE, 0x0, dataTypeBase, bridge)
 {
 }
 internal BoschFlatDataProducer(DataTypeBase dataTypeBase, IModuleBoardBridge bridge) : base(FLAT_INTERRUPT_ENABLE, 0x1, dataTypeBase, bridge)
 {
 }
 internal OrientationDataProducer(DataTypeBase dataTypeBase, IModuleBoardBridge bridge) : base(ORIENT_INTERRUPT_ENABLE, 0x1, dataTypeBase, bridge)
 {
 }
示例#15
0
 internal GpioAnalogDataProducer(DataTypeBase analogDataType, byte pin, IModuleBoardBridge bridge)
 {
     this.bridge         = bridge;
     this.analogDataType = analogDataType;
 }
 public abstract DataTypeBase copy(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes);
示例#17
0
 internal GpioVirtualAnalogDataProducer(DataTypeBase source, byte pin, IModuleBoardBridge bridge)
 {
     this.source    = source;
     this.bridge    = bridge;
     analogDataType = source.copy(source.input, GPIO, source.eventConfig[1], pin, source.attributes);;
 }
 public DataTypeBase dataProcessorCopy(DataTypeBase input, DataAttributes attributes)
 {
     return(copy(input, DATA_PROCESSOR, DataProcessor.NOTIFY, NO_ID, attributes));
 }
 internal FusedAccelerationDataType(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes) :
     base(input, module, register, id, attributes)
 {
 }
 public DataTypeBase dataProcessorStateCopy(DataTypeBase input, DataAttributes attributes)
 {
     return(copy(input, DATA_PROCESSOR, Util.setRead(DataProcessor.STATE), NO_ID, attributes));
 }
 internal CorrectedAngularVelocityData(IModuleBoardBridge bridge, DataTypeBase datatype, DateTime timestamp, byte[] bytes) :
     base(bridge, datatype, timestamp, bytes)
 {
 }
        internal virtual Tuple <DataTypeBase, DataTypeBase> transform(DataProcessorConfig config)
        {
            switch (config.id)
            {
            case DataProcessorConfig.BufferConfig.ID:
                return(Tuple.Create(
                           new IntegralDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY, new DataAttributes(new byte[] { }, 0, 0, false)) as DataTypeBase,
                           dataProcessorStateCopy(this, this.attributes)
                           ));

            case DataProcessorConfig.AccumulatorConfig.ID: {
                DataProcessorConfig.AccumulatorConfig casted = (DataProcessorConfig.AccumulatorConfig)config;
                DataAttributes attributes = new DataAttributes(new byte[] { casted.output }, 1, 0, !casted.counter && this.attributes.signed);

                return(Tuple.Create(
                           casted.counter ? new IntegralDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY, attributes) : dataProcessorCopy(this, attributes),
                           casted.counter ? new IntegralDataType(null, DATA_PROCESSOR, Util.setRead(DataProcessor.STATE), NO_ID, attributes) :
                           dataProcessorStateCopy(this, attributes)
                           ));
            }

            case DataProcessorConfig.AverageConfig.ID:
            case DataProcessorConfig.DelayConfig.ID:
            case DataProcessorConfig.TimeConfig.ID:
                return(Tuple.Create <DataTypeBase, DataTypeBase>(dataProcessorCopy(this, this.attributes.dataProcessorCopy()), null));

            case DataProcessorConfig.PassthroughConfig.ID:
                return(Tuple.Create(
                           dataProcessorCopy(this, this.attributes.dataProcessorCopy()),
                           new IntegralDataType(DATA_PROCESSOR, Util.setRead(DataProcessor.STATE), NO_ID, new DataAttributes(new byte[] { 2 }, 1, 0, false)) as DataTypeBase
                           ));

            case DataProcessorConfig.MathConfig.ID: {
                DataProcessorConfig.MathConfig casted = (DataProcessorConfig.MathConfig)config;
                DataTypeBase processor = null;
                switch (casted.op)
                {
                case Add:
                    processor = dataProcessorCopy(this, this.attributes.dataProcessorCopySize(4));
                    break;

                case Multiply:
                    processor = dataProcessorCopy(this, this.attributes.dataProcessorCopySize(Math.Abs(casted.rhs) < 1 ? this.attributes.sizes[0] : (byte)4));
                    break;

                case Divide:
                    processor = dataProcessorCopy(this, this.attributes.dataProcessorCopySize(Math.Abs(casted.rhs) < 1 ? (byte)4 : this.attributes.sizes[0]));
                    break;

                case Subtract:
                    processor = dataProcessorCopy(this, this.attributes.dataProcessorCopySigned(true));
                    break;

                case AbsValue:
                    processor = dataProcessorCopy(this, this.attributes.dataProcessorCopySigned(false));
                    break;

                case Modulus:
                    processor = dataProcessorCopy(this, this.attributes.dataProcessorCopy());
                    break;

                case Exponent:
                    processor = new ByteArrayDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY, this.attributes.dataProcessorCopySize(4));
                    break;

                case LeftShift:
                    processor = new ByteArrayDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY,
                                                      this.attributes.dataProcessorCopySize((byte)Math.Min(this.attributes.sizes[0] + (casted.rhs / 8), 4)));
                    break;

                case RightShift:
                    processor = new ByteArrayDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY,
                                                      this.attributes.dataProcessorCopySize((byte)Math.Max(this.attributes.sizes[0] - (casted.rhs / 8), 1)));
                    break;

                case Sqrt:
                    processor = new ByteArrayDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY, this.attributes.dataProcessorCopySigned(false));
                    break;

                case Constant:
                    DataAttributes attributes = new DataAttributes(new byte[] { 4 }, (byte)1, (byte)0, casted.rhs >= 0);
                    processor = new IntegralDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY, attributes);
                    break;
                }
                if (processor != null)
                {
                    return(Tuple.Create <DataTypeBase, DataTypeBase>(processor, null));
                }
                break;
            }

            case DataProcessorConfig.PulseConfig.ID: {
                DataProcessorConfig.PulseConfig casted = (DataProcessorConfig.PulseConfig)config;
                DataTypeBase processor = null;
                switch (casted.mode)
                {
                case Width:
                    processor = new IntegralDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY, new DataAttributes(new byte[] { 2 }, 1, 0, false));
                    break;

                case Area:
                    processor = dataProcessorCopy(this, attributes.dataProcessorCopySize(4));
                    break;

                case Peak:
                    processor = dataProcessorCopy(this, attributes.dataProcessorCopy());
                    break;

                case OnDetect:
                    processor = new IntegralDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY, new DataAttributes(new byte[] { 1 }, 1, 0, false));
                    break;
                }
                if (processor != null)
                {
                    return(Tuple.Create <DataTypeBase, DataTypeBase>(processor, null));
                }
                break;
            }

            case DataProcessorConfig.ComparisonConfig.ID: {
                DataTypeBase processor = null;
                if (config is DataProcessorConfig.SingleValueComparisonConfig)
                {
                    processor = dataProcessorCopy(this, attributes.dataProcessorCopy());
                }
                else if (config is DataProcessorConfig.MultiValueComparisonConfig)
                {
                    DataProcessorConfig.MultiValueComparisonConfig casted = (DataProcessorConfig.MultiValueComparisonConfig)config;
                    if (casted.mode == ComparisonOutput.PassFail || casted.mode == ComparisonOutput.Zone)
                    {
                        processor = new IntegralDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY, new DataAttributes(new byte[] { 1 }, 1, 0, false));
                    }
                    else
                    {
                        processor = dataProcessorCopy(this, attributes.dataProcessorCopy());
                    }
                }
                if (processor != null)
                {
                    return(Tuple.Create <DataTypeBase, DataTypeBase>(processor, null));
                }
                break;
            }

            case DataProcessorConfig.ThresholdConfig.ID: {
                DataProcessorConfig.ThresholdConfig casted = (DataProcessorConfig.ThresholdConfig)config;
                switch (casted.mode)
                {
                case Threshold.Absolute:
                    return(Tuple.Create <DataTypeBase, DataTypeBase>(dataProcessorCopy(this, attributes.dataProcessorCopy()), null));

                case Threshold.Binary:
                    return(Tuple.Create <DataTypeBase, DataTypeBase>(new IntegralDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY,
                                                                                          new DataAttributes(new byte[] { 1 }, 1, 0, true)), null));
                }
                break;
            }

            case DataProcessorConfig.DifferentialConfig.ID: {
                DataProcessorConfig.DifferentialConfig casted = (DataProcessorConfig.DifferentialConfig)config;
                switch (casted.mode)
                {
                case Differential.Absolute:
                    return(Tuple.Create <DataTypeBase, DataTypeBase>(dataProcessorCopy(this, attributes.dataProcessorCopy()), null));

                case Differential.Differential:
                    throw new InvalidOperationException("Differential processor in 'difference' mode must be handled by subclasses");

                case Differential.Binary:
                    return(Tuple.Create <DataTypeBase, DataTypeBase>(new IntegralDataType(this, DATA_PROCESSOR, DataProcessor.NOTIFY, new DataAttributes(new byte[] { 1 }, 1, 0, true)), null));
                }
                break;
            }

            case DataProcessorConfig.PackerConfig.ID: {
                DataProcessorConfig.PackerConfig casted = (DataProcessorConfig.PackerConfig)config;
                return(Tuple.Create <DataTypeBase, DataTypeBase>(dataProcessorCopy(this, attributes.dataProcessorCopyCopies(casted.count)), null));
            }

            case DataProcessorConfig.AccounterConfig.ID: {
                DataProcessorConfig.AccounterConfig casted = (DataProcessorConfig.AccounterConfig)config;
                return(Tuple.Create <DataTypeBase, DataTypeBase>(dataProcessorCopy(this, new DataAttributes(new byte[] { casted.length, attributes.length() }, 1, 0, attributes.signed)), null));
            }
            }
            throw new InvalidOperationException("Unable to determine the DataTypeBase object for config: " + Util.arrayToHexString(config.Build()));
        }
 internal CorrectedMagneticFieldData(IModuleBoardBridge bridge, DataTypeBase datatype, DateTime timestamp, byte[] bytes) :
     base(bridge, datatype, timestamp, bytes)
 {
 }
示例#24
0
 private Bmm150CartesianFloatData(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes) :
     base(input, module, register, id, attributes)
 {
 }
 public override DataTypeBase copy(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes)
 {
     return(new CorrectedBFieldDataType(input, module, register, id, attributes));
 }
示例#26
0
 public override DataTypeBase copy(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes)
 {
     return(new Bmm150CartesianFloatData(input, module, register, id, attributes));
 }
 internal QuaternionDataType(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes) :
     base(input, module, register, id, attributes)
 {
 }
示例#28
0
 internal GpioMonitorDataProducer(DataTypeBase dataTypeBase, IModuleBoardBridge bridge) :
     base(PIN_CHANGE_NOTIFY_ENABLE, dataTypeBase, bridge)
 {
 }
 internal EulerAnglesDataType(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes) :
     base(input, module, register, id, attributes)
 {
 }
示例#30
0
 public override DataTypeBase copy(DataTypeBase input, Module module, byte register, byte id, DataAttributes attributes)
 {
     throw new NotImplementedException();
 }