本文整理汇总了C#中Windows.Storage.Streams.DataReader.ReadInt64方法的典型用法代码示例。如果您正苦于以下问题:C# DataReader.ReadInt64方法的具体用法?C# DataReader.ReadInt64怎么用?C# DataReader.ReadInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Windows.Storage.Streams.DataReader
的用法示例。
在下文中一共展示了DataReader.ReadInt64方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Read
public void Read(DataReader reader)
{
t = (HeartBeatType)reader.ReadInt32();
time = reader.ReadDateTime().UtcDateTime;
cc = reader.ReadInt64();
asdf = reader.ReadInt64();
peak = reader.ReadInt64();
max0 = reader.ReadUInt64();
max1 = reader.ReadUInt64();
ave0 = reader.ReadUInt64();
ave1 = reader.ReadUInt64();
ave = reader.ReadUInt64();
beat = reader.ReadUInt64();
audio = reader.ReadUInt64();
noAudio = reader.ReadUInt64();
}
示例2: CollectTelemetryData
/// <summary>
/// Method used for the "Collection Thread"
/// </summary>
/// <param name="operation"></param>
private async void CollectTelemetryData(IAsyncAction operation)
{
DataReader reader;
uint unconsumedBufferLength = 0;
lock (m_pConnectedSocket)
{
reader = new DataReader(m_pConnectedSocket.InputStream);
}
while (IsClientConnected | (unconsumedBufferLength > 0))
{
await m_pTelemetryReaderSemaphoreSlim.WaitAsync();
try
{
await reader.LoadAsync(sizeof (byte));
unconsumedBufferLength = reader.UnconsumedBufferLength;
}
finally
{
m_pTelemetryReaderSemaphoreSlim.Release();
}
if (reader.UnconsumedBufferLength <= 0) continue;
await m_pTelemetryReaderSemaphoreSlim.WaitAsync();
try
{
byte b;
var e = new OnTelemetryDataReceivedEventArgs();
b = reader.ReadByte();
var commandInformation = (CommandInformation) b;
switch (commandInformation)
{
case CommandInformation.Information:
await reader.LoadAsync(sizeof (uint));
var n = reader.ReadUInt32();
await reader.LoadAsync(n*sizeof (char));
e.CommandData = reader.ReadString(n);
e.CommandType = CommandInformation.Information;
break;
case CommandInformation.Gyroscope:
float angleX, angleY, angleZ;
long gyroTime;
await reader.LoadAsync(3*sizeof (double));
await reader.LoadAsync(sizeof (long));
angleX = Convert.ToSingle(reader.ReadDouble());
angleY = Convert.ToSingle(reader.ReadDouble());
angleZ = Convert.ToSingle(reader.ReadDouble());
gyroTime = reader.ReadInt64();
e.CommandData = new GyroscopeData()
{
Angle = new Vector3(angleX, angleY, angleZ),
TimeStamp = new DateTime(gyroTime)
};
e.CommandType = CommandInformation.Gyroscope;
break;
case CommandInformation.Accelerometer:
float accX, accY, accZ;
long accTime;
await reader.LoadAsync(3*sizeof (double));
await reader.LoadAsync(sizeof (long));
accX = Convert.ToSingle(reader.ReadDouble());
accY = Convert.ToSingle(reader.ReadDouble());
accZ = Convert.ToSingle(reader.ReadDouble());
accTime = reader.ReadInt64();
e.CommandData = new AccelerometerData()
{
Acceleration = new Vector3(accX, accY, accZ),
TimeStamp = new DateTime(accTime)
};
e.CommandType = CommandInformation.Accelerometer;
break;
case CommandInformation.Servo:
byte id, velocity;
long servoTime;
await reader.LoadAsync(2*sizeof (byte));
await reader.LoadAsync(sizeof (long));
id = reader.ReadByte();
velocity = reader.ReadByte();
servoTime = reader.ReadInt64();
e.CommandData = new ServoControllerData() {ServoId = id, VelocityValue = velocity, TimeStamp = new DateTime(servoTime)};
e.CommandType = CommandInformation.Servo;
break;
}
var handler = OnTelemetryDataReceived;
handler?.Invoke(this, e);
}
finally
{
m_pTelemetryReaderSemaphoreSlim.Release();
}
}
}