public void TestSetUp()
        {
            _logGenerator      = new Log200Generator();
            _wellboreReference = new DataObjectReference
            {
                ContentType = EtpContentTypes.Witsml200.For(ObjectTypes.Wellbore),
                Title       = _logGenerator.Name("Wellbore"),
                Uuid        = _logGenerator.Uid()
            };

            _timeLog = new Log()
            {
                TimeDepth = "Time", Citation = _logGenerator.CreateCitation(_logGenerator.Name("Citation")), Wellbore = _wellboreReference, Uuid = _logGenerator.Uid()
            };
            _depthLog = new Log()
            {
                TimeDepth = "Depth", Citation = _logGenerator.CreateCitation(_logGenerator.Name("Citation")), Wellbore = _wellboreReference, Uuid = _logGenerator.Uid()
            };

            _measuredDepthIndex = _logGenerator.CreateMeasuredDepthIndex(IndexDirection.increasing);
            _dateTimeIndex      = _logGenerator.CreateDateTimeIndex();
            _elapseTimeIndex    = _logGenerator.CreateElapsedTimeIndex(IndexDirection.increasing);

            _booleanPointMetadata = _logGenerator.CreatePointMetadata("confidence", "confidence", EtpDataType.boolean);
            _floatPointMetadata   = _logGenerator.CreatePointMetadata("Confidence", "Confidence", EtpDataType.@float);

            _depthLogChannelSet = _logGenerator.CreateChannelSet(_depthLog);
            _depthLogChannelSet.Index.Add(_measuredDepthIndex);
            _depthLogChannelSet.Index.Add(_dateTimeIndex);
            _depthLogChannelSet.Channel.Add(_logGenerator.CreateChannel(_depthLog, _depthLogChannelSet.Index, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: _logGenerator.List(_booleanPointMetadata)));
            _depthLogChannelSet.Channel.Add(_logGenerator.CreateChannel(_depthLog, _depthLogChannelSet.Index, "Hookload", "HKLD", UnitOfMeasure.klbf, "Force", EtpDataType.@double, null));
            _timeLogChannelSet = _logGenerator.CreateChannelSet(_timeLog);
            _timeLogChannelSet.Index.Add(_elapseTimeIndex);
            _timeLogChannelSet.Channel.Add(_logGenerator.CreateChannel(_timeLog, _timeLogChannelSet.Index, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: _logGenerator.List(_floatPointMetadata)));
        }
		Result IFModSystem.PlaySound(ChannelIndex channelIndex, ISound sound, bool paused, ref IChannel channel)
		{
			CheckMemberOnlyCall();
			
			var result = NativeFModSystem.PlaySound(Self, channelIndex, sound, paused, ref channel);
			
			return result;
		}
 public int this[int xyz, ChannelIndex channel]
 {
     get
     {
         return(channel < 0 ? -1 : 0 == (Flags & PixelFlags.NoTransparency) ? ((this[xyz] << 2) | ((sbyte)channel & 3)) :
                (channel = (ChannelIndex)((sbyte)channel & 3)) == ChannelIndex.Fourth ? -1 :
                ((this[xyz] * 3) | (int)((sbyte)channel)));
     }
 }
Example #4
0
        public void ChannelSet200DataAdapter_Can_Update_ChannelSet_With_Middle_Depth_Data()
        {
            var dataGenerator = new DataGenerator();

            var channelIndex = new ChannelIndex {
                Direction = IndexDirection.increasing, IndexType = ChannelIndexType.measureddepth, Mnemonic = "MD", Uom = UnitOfMeasure.m
            };

            ChannelSet.Index   = dataGenerator.List(channelIndex);
            ChannelSet.Channel = new List <Channel>
            {
                new Channel()
                {
                    Uuid     = dataGenerator.Uid(),
                    Citation = new Citation {
                        Title = dataGenerator.Name("ChannelSetTest")
                    },
                    Mnemonic      = "MSG",
                    Uom           = null,
                    ChannelClass  = dataGenerator.ToPropertyKindReference("velocity"),
                    DataType      = EtpDataType.@long,
                    GrowingStatus = ChannelStatus.active,
                    Index         = ChannelSet.Index,
                    StartIndex    = new DepthIndexValue(),
                    EndIndex      = new DepthIndexValue(),
                    SchemaVersion = OptionsIn.DataVersion.Version200.Value
                }
            };

            ChannelSet.Data = new ChannelData();
            ChannelSet.SetData(@"[
                [ [0 ], [ 3.11 ] ],
                [ [100 ], [ 3.12 ] ],
                [ [150 ], [ 3.14 ] ],
                [ [200 ], [ 3.15 ] ],
            ]");

            DevKit.AddAndAssert(ChannelSet);

            ChannelSet.Data = new ChannelData();
            ChannelSet.SetData(@"[
                [ [0 ], [ 3.11 ] ],
                [ [100 ], [ 3.12 ] ],
                [ [120 ], [ 3.13 ] ],
                [ [150 ], [ 3.14 ] ],
                [ [200 ], [ 3.15 ] ],
            ]");

            DevKit.UpdateAndAssert(ChannelSet);

            var mnemonics = ChannelSet.Index.Select(i => i.Mnemonic).Concat(ChannelSet.Channel.Select(c => c.Mnemonic)).ToList();
            var dataOut   = _channelDataProvider.GetChannelData(ChannelSet.GetUri(), new Range <double?>(0, null), mnemonics, null);

            Assert.AreEqual(5, dataOut.Count);
            Assert.AreEqual(2, dataOut[1].Count);
            Assert.AreEqual(3.13, dataOut[2][1][0]);
        }
Example #5
0
        /// <summary>
        /// Creates the log.
        /// </summary>
        /// <param name="indexType">Type of the index.</param>
        /// <param name="isIncreasing">if set to <c>true</c> [is increasing].</param>
        /// <returns></returns>
        public Log CreateLog(ChannelIndexType indexType, bool isIncreasing)
        {
            Log log = new Log();

            log.Citation = Citation("ChannelSet");
            log.Uuid     = Uid();

            log.ChannelSet = new List <ChannelSet>();
            log.Wellbore   = DataObjectReference(ObjectTypes.Wellbore, Name("Wellbore"), Uid());

            List <ChannelIndex> indexList = new List <ChannelIndex>();
            IndexDirection      direction = isIncreasing ? IndexDirection.increasing : IndexDirection.decreasing;

            if (LogGenerator.DepthIndexTypes.Contains(indexType))
            {
                log.TimeDepth = ObjectFolders.Depth;
                ChannelIndex channelIndex = LogGenerator.CreateMeasuredDepthIndex(direction);

                if (indexType.Equals(ChannelIndexType.trueverticaldepth))
                {
                    channelIndex = LogGenerator.CreateTrueVerticalDepthIndex(direction);
                }
                else if (indexType.Equals(ChannelIndexType.passindexeddepth))
                {
                    channelIndex = LogGenerator.CreatePassIndexDepthIndex(direction);
                }

                indexList.Add(channelIndex);
            }
            else if (LogGenerator.TimeIndexTypes.Contains(indexType))
            {
                log.TimeDepth = ObjectFolders.Time;

                if (indexType.Equals(ChannelIndexType.datetime))
                {
                    // DateTime should be increasing only
                    indexList.Add(LogGenerator.CreateDateTimeIndex());
                }
                else if (indexType.Equals(ChannelIndexType.elapsedtime))
                {
                    indexList.Add(LogGenerator.CreateElapsedTimeIndex(direction));
                }
            }
            else
            {
                log.TimeDepth = ObjectFolders.Other;
                return(null);
            }

            InitChannelSet(log, indexList);

            return(log);
        }
Example #6
0
 private IndexMetadataRecord ToIndexMetadataRecord(Channel entity, ChannelIndex indexChannel, int scale = 3)
 {
     return(new IndexMetadataRecord()
     {
         Uri = indexChannel.GetUri(entity),
         Mnemonic = indexChannel.Mnemonic,
         Description = indexChannel.Mnemonic,
         Uom = Units.GetUnit(indexChannel.Uom),
         Scale = scale,
         IndexType = indexChannel.IsTimeIndex(true)
             ? ChannelIndexTypes.Time
             : ChannelIndexTypes.Depth,
         Direction = indexChannel.IsIncreasing()
             ? IndexDirections.Increasing
             : IndexDirections.Decreasing,
         CustomData = new Dictionary <string, DataValue>(0),
     });
 }
Example #7
0
        public void InitHeader(Log log, LoggingMethod loggingMethod, ChannelIndex channelIndex, IndexDirection direction = IndexDirection.increasing)
        {
            log.ChannelSet    = new List <ChannelSet>();
            log.LoggingMethod = loggingMethod;

            var index = List(channelIndex);

            if (channelIndex.IndexType == ChannelIndexType.measureddepth)
            {
                log.TimeDepth = "depth";

                var pointMetadataList = List(LogGenerator.CreatePointMetadata("Quality", "Quality", EtpDataType.boolean));

                ChannelSet channelSet = LogGenerator.CreateChannelSet(log);
                channelSet.Index = index;

                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: pointMetadataList));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "Hookload", "HKLD", UnitOfMeasure.klbf, "Force", EtpDataType.@double, null));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "GR1AX", "GR", UnitOfMeasure.gAPI, "Gamma_Ray", EtpDataType.@double, null));

                CreateMockChannelSetData(channelSet, channelSet.Index);
                log.ChannelSet.Add(channelSet);
            }
            else if (channelIndex.IndexType == ChannelIndexType.datetime)
            {
                log.TimeDepth = "time";

                var pointMetadataList = List(LogGenerator.CreatePointMetadata("Confidence", "Confidence", EtpDataType.@float));

                ChannelSet channelSet = LogGenerator.CreateChannelSet(log);
                channelSet.Index = index;

                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "Rate of Penetration", "ROP", UnitOfMeasure.mh, "Velocity", EtpDataType.@double, pointMetadataList: pointMetadataList));
                channelSet.Channel.Add(LogGenerator.CreateChannel(log, index, "GR1AX", "GR", UnitOfMeasure.gAPI, "Gamma_Ray", EtpDataType.@double, null));

                CreateMockChannelSetData(channelSet, channelSet.Index);
                log.ChannelSet.Add(channelSet);
            }
        }
 public int this[uint x, uint yz, ChannelIndex channel] => this[x, yz, 0u, channel];
Example #9
0
 public TickEvent(UInt32 byteCount, ChannelIndex channel, InternalMessage message)
 {
     _byteCount = byteCount;
     _channel   = channel;
     _message   = message;
 }
Example #10
0
        private IIndexMetadataRecord ToIndexMetadataRecord(IEtpAdapter etpAdapter, Channel entity, ChannelIndex indexChannel, int scale = 3)
        {
            var metadata = etpAdapter.CreateIndexMetadata(
                uri: indexChannel.GetUri(entity),
                isTimeIndex: indexChannel.IsTimeIndex(true),
                isIncreasing: indexChannel.IsIncreasing());

            metadata.Mnemonic    = indexChannel.Mnemonic;
            metadata.Description = indexChannel.Mnemonic;
            metadata.Uom         = Units.GetUnit(indexChannel.Uom);
            metadata.Scale       = scale;

            return(metadata);
        }
Example #11
0
 public int this[uint x, ChannelIndex channel] => this[x, 0u, 0u, channel];
		public static extern Result FMOD_System_PlayDSP(IntPtr systemHandle, ChannelIndex channelId, IntPtr dspHandle, bool paused, ref IntPtr channelHandle);
 private string ToDataType(ChannelIndex channelIndex)
 {
     return(channelIndex.IndexType == ChannelIndexType.datetime
         ? [email protected]()
         : [email protected]());
 }
Example #14
0
 protected static extern ErrorCode PlayDsp(IntPtr system, ChannelIndex channelid, IntPtr dsp, bool paused, ref IntPtr channel);
		internal static extern Result FMOD_System_PlaySound(IntPtr systemHandle, ChannelIndex channelId, IntPtr soundHandle, bool paused, ref IntPtr channelHandle);
Example #16
0
		internal void PlaySound(ChannelIndex channelId, Sound sound, bool paused, ref Channel channel)
		{
			if (sound != null)
			{
				currentResult = Result.Ok;
				IntPtr channelHandle;			

				bool wasMuted = false;

				if (channel != null)
				{
					channelHandle = channel.Handle;
					wasMuted = channel.Mute;
				}
				else
				{
					channel = new Channel();
					channelHandle = new IntPtr();
				}

				try
				{
					currentResult = NativeMethods.FMOD_System_PlaySound(handle, channelId, sound.Handle, paused, ref channelHandle);
				}
				catch (System.Runtime.InteropServices.ExternalException)
				{
					currentResult = Result.InvalidParameterError;
				}
				
				if (currentResult == Result.Ok)
				{
					channel.Handle = channelHandle;
					
					if (wasMuted)
					{
						channel.Mute = true;
					}
				}
				else
				{
					channel = null;
				}
			}
		}
Example #17
0
 private static extern ErrorCode PlaySound(IntPtr system, ChannelIndex channelid, IntPtr Sound, bool paused, ref IntPtr channel);
 private IndexWorkspace(ChannelIndex index, string directory)
 {
     _directory = directory;
     Index      = index;
 }
Example #19
0
 public void RecordEvent(UInt32 byteCount, ChannelIndex channel, InternalMessage message)
 {
     _events.Add(new TickEvent(byteCount, channel, message));
     _totalByteCount += byteCount;
 }
		public static extern Result PlaySound(
			Handle self, 
			ChannelIndex channelIndex, 
			ISound sound, 
			[MarshalAs(UnmanagedType.I1)] bool paused, 
			ref IChannel channel);
Example #21
0
 public static extern Result FMOD_System_PlayDSP(IntPtr systemHandle, ChannelIndex channelId, IntPtr dspHandle, bool paused, ref IntPtr channelHandle);
Example #22
0
 internal static extern Result FMOD_System_PlaySound(IntPtr systemHandle, ChannelIndex channelId, IntPtr soundHandle, bool paused, ref IntPtr channelHandle);
Example #23
0
 /// <summary>
 /// Directly writes data to a channel.
 /// </summary>
 /// <param name="index">
 /// The index of the channel to which to write.
 /// </param>
 /// <param name="buffer">
 /// The buffer from which to read data.
 /// </param>
 /// <param name="offset">
 /// The offset at which to start reading.
 /// </param>
 /// <param name="count">
 /// The number of bytes to read.
 /// </param>
 /// <param name="cancellationToken">
 /// A <see cref="CancellationToken"/> which can be used to cancel the asynchronous operation.
 /// </param>
 /// <returns>
 /// A <see cref="Task"/> which represents the asynchronous operation.
 /// </returns>
 public Task Write(ChannelIndex index, byte[] buffer, int offset, int count,
                   CancellationToken cancellationToken = default)
 {
     return(Write((byte)index, buffer, offset, count, cancellationToken));
 }
Example #24
0
 protected static extern ErrorCode PlayDSP(IntPtr system, ChannelIndex channelid, int Dsp, int paused, ref int channel);
Example #25
0
		public void PlayDsp(ChannelIndex channelId, Dsp dsp, bool paused, ref Channel channel)
		{
			if (dsp != null)
			{
				currentResult = Result.Ok;
				IntPtr channelHandle;

				if (channel != null)
				{
					channelHandle = channel.Handle;
				}
				else
				{
					channel = new Channel();
					channelHandle = new IntPtr();
				}

				try
				{
					currentResult = NativeMethods.FMOD_System_PlayDSP(handle, channelId, dsp.Handle, paused, ref channelHandle);
				}
				catch (System.Runtime.InteropServices.ExternalException)
				{
					currentResult = Result.InvalidParameterError;
				}
				
				if (currentResult != Result.Ok)
				{
					channel = new Channel();
					channel.Handle = channelHandle;				
				}
				else
				{
					channel = null;
				}
			}
			else throw new ArgumentNullException("dsp");
		}
Example #26
0
 protected static extern ErrorCode PlayDsp(IntPtr system, ChannelIndex channelid, IntPtr dsp, bool paused, ref IntPtr channel);
Example #27
0
 public bool HasChannelFor(string channelName)
 {
     return(ChannelIndex.HasChannelFor(channelName));
 }
Example #28
0
 protected static extern ErrorCode PlayDSP(IntPtr system, ChannelIndex channelid, int Dsp, int paused, ref int channel);