Skip to content

Commit

Permalink
Add waveform.proto under ni/protobuf/types (#40)
Browse files Browse the repository at this point in the history
* Add waveform.proto under ni/protobuf/types

* Define a precisiontime proto file and use the new messages in the waveform.

* Fix syntax error.

* Address review comments.

* Delete the unused precision_duration.proto and README.md files. Place the DoubleWaveform datatype at the top of the waveform.proto file.

* Address Brad's comments.

* Rename DoubleWaveform -> DoubleAnalogWaveform
  • Loading branch information
ccaltagi authored Mar 20, 2024
1 parent 6ab9e17 commit db10ff4
Show file tree
Hide file tree
Showing 2 changed files with 97 additions and 0 deletions.
33 changes: 33 additions & 0 deletions ni/protobuf/types/precision_timestamp.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
//---------------------------------------------------------------------
//---------------------------------------------------------------------
syntax = "proto3";

//---------------------------------------------------------------------
//---------------------------------------------------------------------
package ni.protobuf.types;

//---------------------------------------------------------------------
//---------------------------------------------------------------------
option csharp_namespace = "NationalInstruments.Protobuf.Types";
option go_package = "types";
option java_multiple_files = true;
option java_outer_classname = "PrecisionTimeProto";
option java_package = "com.ni.protobuf.types";
option objc_class_prefix = "NIPT";
option php_namespace = "NI\\PROTOBUF\\TYPES";
option ruby_package = "NI::Protobuf::Types";

// A PrecisionTimestamp represents a point in time expressed in NI Binary Time Format (NI-BTF).
// https://www.ni.com/docs/en-US/bundle/labwindows-cvi/page/cvi/libref/ni-btf.htm
// NI-BTF stores time values in Coordinated Universal Time (UTC) format.
// A PrecisionTimestamp is encoded as a count of seconds and fractions of seconds at
// 2^-64 resolution. The count is relative to an epoch of January 1, 1904.
message PrecisionTimestamp
{
// Represents the number of seconds since the epoch
// 1904-01-01T00:00:00Z.
int64 seconds = 1;

// Non-negative fractions of a second at 2^-64 resolution.
uint64 fractional_seconds = 2;
}
64 changes: 64 additions & 0 deletions ni/protobuf/types/waveform.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
//---------------------------------------------------------------------
//---------------------------------------------------------------------
syntax = "proto3";

//---------------------------------------------------------------------
//---------------------------------------------------------------------
package ni.protobuf.types;

import "ni/protobuf/types/precision_timestamp.proto";

//---------------------------------------------------------------------
//---------------------------------------------------------------------
option csharp_namespace = "NationalInstruments.Protobuf.Types";
option go_package = "types";
option java_multiple_files = true;
option java_outer_classname = "WaveformProto";
option java_package = "com.ni.protobuf.types";
option objc_class_prefix = "NIPT";
option php_namespace = "NI\\PROTOBUF\\TYPES";
option ruby_package = "NI::Protobuf::Types";

// DoubleAnalogWaveform datatype.
message DoubleAnalogWaveform
{
// The trigger time of the waveform.
PrecisionTimestamp t0 = 1;

// The time interval in seconds between data points in the waveform.
double dt = 2;

// The data values of the waveform.
repeated double y_data = 3;

// The names and values of all waveform attributes.
// A waveform attribute is metadata attached to a waveform.
// It is represented in this message as a map associating the name of the attribute with the value described by WaveformAttributeValue.
// The NI-DAQmx driver sets the following string attributes:
// NI_ChannelName: the name of the virtual channel producing the waveform.
// NI_LineNames: the name of the digital line in the waveform.
// NI_UnitDescription: the units of measure for the waveform.
// NI_dBReference: the reference value to use when converting measurement levels to decibel.
// For additional information on waveform attributes, please visit https://www.ni.com/docs/en-US/bundle/labview-api-ref/page/functions/get-waveform-attribute.html
map<string, WaveformAttributeValue> attributes = 4;
}

// Waveform Attribute Value
message WaveformAttributeValue
{
// The kind of attribute value.
oneof attribute
{
// Represents a bool attribute.
bool bool_value = 1;

// Represents an integer attribute.
int32 integer_value = 2;

// Represents a double attribute.
double double_value = 3;

// Represents a string attribute.
string string_value = 4;
}
}

0 comments on commit db10ff4

Please sign in to comment.