本文整理汇总了C#中DataSet.AddNmeaData方法的典型用法代码示例。如果您正苦于以下问题:C# DataSet.AddNmeaData方法的具体用法?C# DataSet.AddNmeaData怎么用?C# DataSet.AddNmeaData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataSet
的用法示例。
在下文中一共展示了DataSet.AddNmeaData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNmeaData
/// <summary>
/// Get the latest data from the NMEA buffer
/// and create a string.
/// Then record the NMEA data and add it to
/// the ensemble.
/// </summary>
/// <param name="adcpData">Ensemble data.</param>
/// <returns>Binary data.</returns>
private byte[] GetNmeaData(ref DataSet.Ensemble adcpData)
{
// Byte array of the binary data
List<byte> byteList = new List<byte>();
string nmeaData = GetNmeaBuffer();
if (nmeaData.Length > 0)
{
// Add the NMEA data to the dataset
adcpData.AddNmeaData(nmeaData.ToString());
// Create byte array for all the NMEA data accumulated
// Record the NMEA data to the file
// Get the NMEA data from the dataset to ensure valid NMEA messages
for (int x = 0; x < adcpData.NmeaData.NmeaStrings.Count; x++)
{
string nmeaStr = adcpData.NmeaData.NmeaStrings[x] + NMEA_END;
byte[] nmeaBA = System.Text.Encoding.ASCII.GetBytes(nmeaStr);
byteList.AddRange(nmeaBA);
}
}
// Return the binary data
return byteList.ToArray();
}
示例2: MergeNmeaDataSet
/// <summary>
/// Add NMEA data to the ensemble.
/// </summary>
/// <param name="adcpData">DataSet to add NMEA data.</param>
private void MergeNmeaDataSet(ref DataSet.Ensemble adcpData)
{
// Copy the data from the buffer
// This will take a current cout of the buffer.
// Then create a string of the buffer and remove
// the item from the buffer at the same time.
StringBuilder nmeaData = new StringBuilder();
// Copy the buffer so it can be unlocked
LinkedList<string> bufferCopy;
lock (_nmeaBufferLock)
{
// Copy the buffer then clear it
bufferCopy = new LinkedList<string>(_nmeaBuffer);
_nmeaBuffer.Clear();
}
// Create a string of all the buffered data
for (int x = 0; x < bufferCopy.Count; x++)
{
nmeaData.Append(bufferCopy.First.Value);
// Remove the data
bufferCopy.RemoveFirst();
}
// Check if NMEA data already exsit, if it does, combine the data
if (adcpData.IsNmeaAvail)
{
// Merge the NMEA data with the new nmea data
adcpData.NmeaData.MergeNmeaData(nmeaData.ToString());
}
else
{
// Add the NMEA data to the dataset
adcpData.AddNmeaData(nmeaData.ToString());
}
}
示例3: AddNmea
/// <summary>
/// Add Nmea data set.
/// </summary>
/// <param name="ensemble">Ensemble to add the dataset.</param>
public static void AddNmea(ref DataSet.Ensemble ensemble)
{
ensemble.AddNmeaData(DataSet.Ensemble.DATATYPE_BYTE,
DataSet.EarthWaterMassDataSet.NUM_DATA_ELEMENTS, // Num elements (Bins)
DataSet.Ensemble.DEFAULT_NUM_BEAMS_BEAM, // Num Beams
DataSet.Ensemble.DEFAULT_IMAG, // Image
DataSet.Ensemble.DEFAULT_NAME_LENGTH, // Name length
DataSet.Ensemble.NmeaID); // Name (Dataset ID)
}