Skip to content

Commit

Permalink
Add codegen support for Daqmx Write apis which have multiple in param…
Browse files Browse the repository at this point in the history
…s. (#1130)

* add new meesage to proto for moniker streaming call

* work-in-progress: codegen changes for service.cpp generation with response on moniker out param

* run codegen after resolving merge conflicts

* return failure error code from moniker APIs

* update proto and struct to contain request and response messages

* standardize to send output in response parameter for moniker APIs

* fix black formatter issues

* fix build error

* cleanup scripts

* fix tests

* script and cpp cleanup

* codegen for read apis with multiple out params

* added condition to call reserve and resize functions for some param types

* add type hints for python helpers

* fix black formatter issues

* return error status from Write* moniker functions

* fix type hints

* codegen for write apis with multiple out params

* merged latest main

* cleanup

* resolved build errors

* fixed failing tests

* removed comment from code

---------

Co-authored-by: Rohan Doshi <rohan.doshi@ni.com>
Co-authored-by: Raghav Rawat <raghavrawat@ni.com>
  • Loading branch information
3 people authored Nov 28, 2024
1 parent b966222 commit 8f66808
Show file tree
Hide file tree
Showing 11 changed files with 1,660 additions and 460 deletions.
218 changes: 218 additions & 0 deletions generated/nidaqmx/nidaqmx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -438,20 +438,29 @@ service NiDAQmx {
rpc WriteBinaryU32(WriteBinaryU32Request) returns (WriteBinaryU32Response);
rpc BeginWriteBinaryU32(BeginWriteBinaryU32Request) returns (BeginWriteBinaryU32Response);
rpc WriteCtrFreq(WriteCtrFreqRequest) returns (WriteCtrFreqResponse);
rpc BeginWriteCtrFreq(BeginWriteCtrFreqRequest) returns (BeginWriteCtrFreqResponse);
rpc WriteCtrFreqScalar(WriteCtrFreqScalarRequest) returns (WriteCtrFreqScalarResponse);
rpc BeginWriteCtrFreqScalar(BeginWriteCtrFreqScalarRequest) returns (BeginWriteCtrFreqScalarResponse);
rpc WriteCtrTicks(WriteCtrTicksRequest) returns (WriteCtrTicksResponse);
rpc BeginWriteCtrTicks(BeginWriteCtrTicksRequest) returns (BeginWriteCtrTicksResponse);
rpc WriteCtrTicksScalar(WriteCtrTicksScalarRequest) returns (WriteCtrTicksScalarResponse);
rpc BeginWriteCtrTicksScalar(BeginWriteCtrTicksScalarRequest) returns (BeginWriteCtrTicksScalarResponse);
rpc WriteCtrTime(WriteCtrTimeRequest) returns (WriteCtrTimeResponse);
rpc BeginWriteCtrTime(BeginWriteCtrTimeRequest) returns (BeginWriteCtrTimeResponse);
rpc WriteCtrTimeScalar(WriteCtrTimeScalarRequest) returns (WriteCtrTimeScalarResponse);
rpc BeginWriteCtrTimeScalar(BeginWriteCtrTimeScalarRequest) returns (BeginWriteCtrTimeScalarResponse);
rpc WriteDigitalLines(WriteDigitalLinesRequest) returns (WriteDigitalLinesResponse);
rpc BeginWriteDigitalLines(BeginWriteDigitalLinesRequest) returns (BeginWriteDigitalLinesResponse);
rpc WriteDigitalScalarU32(WriteDigitalScalarU32Request) returns (WriteDigitalScalarU32Response);
rpc BeginWriteDigitalScalarU32(BeginWriteDigitalScalarU32Request) returns (BeginWriteDigitalScalarU32Response);
rpc WriteDigitalU16(WriteDigitalU16Request) returns (WriteDigitalU16Response);
rpc BeginWriteDigitalU16(BeginWriteDigitalU16Request) returns (BeginWriteDigitalU16Response);
rpc WriteDigitalU32(WriteDigitalU32Request) returns (WriteDigitalU32Response);
rpc BeginWriteDigitalU32(BeginWriteDigitalU32Request) returns (BeginWriteDigitalU32Response);
rpc WriteDigitalU8(WriteDigitalU8Request) returns (WriteDigitalU8Response);
rpc BeginWriteDigitalU8(BeginWriteDigitalU8Request) returns (BeginWriteDigitalU8Response);
rpc WriteRaw(WriteRawRequest) returns (WriteRawResponse);
rpc BeginWriteRaw(BeginWriteRawRequest) returns (BeginWriteRawResponse);
rpc WriteToTEDSFromArray(WriteToTEDSFromArrayRequest) returns (WriteToTEDSFromArrayResponse);
rpc WriteToTEDSFromFile(WriteToTEDSFromFileRequest) returns (WriteToTEDSFromFileResponse);
}
Expand Down Expand Up @@ -11033,6 +11042,32 @@ message WriteCtrFreqResponse {
int32 num_samps_per_chan_written = 2;
}

message BeginWriteCtrFreqRequest {
nidevice_grpc.Session task = 1;
int32 num_samps_per_chan = 2;
bool auto_start = 3;
double timeout = 4;
oneof data_layout_enum {
GroupBy data_layout = 5;
int32 data_layout_raw = 6;
}
}

message BeginWriteCtrFreqResponse {
int32 status = 1;
ni.data_monikers.Moniker moniker = 2;
}

message MonikerWriteCtrFreqRequest {
repeated double frequency = 1;
repeated double duty_cycle = 2;
}

message MonikerWriteCtrFreqResponse {
int32 status = 1;
int32 num_samps_per_chan_written = 2;
}

message WriteCtrFreqScalarRequest {
nidevice_grpc.Session task = 1;
bool auto_start = 2;
Expand All @@ -11045,6 +11080,26 @@ message WriteCtrFreqScalarResponse {
int32 status = 1;
}

message BeginWriteCtrFreqScalarRequest {
nidevice_grpc.Session task = 1;
bool auto_start = 2;
double timeout = 3;
}

message BeginWriteCtrFreqScalarResponse {
int32 status = 1;
ni.data_monikers.Moniker moniker = 2;
}

message MonikerWriteCtrFreqScalarRequest {
double frequency = 1;
double duty_cycle = 2;
}

message MonikerWriteCtrFreqScalarResponse {
int32 status = 1;
}

message WriteCtrTicksRequest {
nidevice_grpc.Session task = 1;
int32 num_samps_per_chan = 2;
Expand All @@ -11063,6 +11118,32 @@ message WriteCtrTicksResponse {
int32 num_samps_per_chan_written = 2;
}

message BeginWriteCtrTicksRequest {
nidevice_grpc.Session task = 1;
int32 num_samps_per_chan = 2;
bool auto_start = 3;
double timeout = 4;
oneof data_layout_enum {
GroupBy data_layout = 5;
int32 data_layout_raw = 6;
}
}

message BeginWriteCtrTicksResponse {
int32 status = 1;
ni.data_monikers.Moniker moniker = 2;
}

message MonikerWriteCtrTicksRequest {
repeated uint32 high_ticks = 1;
repeated uint32 low_ticks = 2;
}

message MonikerWriteCtrTicksResponse {
int32 status = 1;
int32 num_samps_per_chan_written = 2;
}

message WriteCtrTicksScalarRequest {
nidevice_grpc.Session task = 1;
bool auto_start = 2;
Expand All @@ -11075,6 +11156,26 @@ message WriteCtrTicksScalarResponse {
int32 status = 1;
}

message BeginWriteCtrTicksScalarRequest {
nidevice_grpc.Session task = 1;
bool auto_start = 2;
double timeout = 3;
}

message BeginWriteCtrTicksScalarResponse {
int32 status = 1;
ni.data_monikers.Moniker moniker = 2;
}

message MonikerWriteCtrTicksScalarRequest {
uint32 high_ticks = 1;
uint32 low_ticks = 2;
}

message MonikerWriteCtrTicksScalarResponse {
int32 status = 1;
}

message WriteCtrTimeRequest {
nidevice_grpc.Session task = 1;
int32 num_samps_per_chan = 2;
Expand All @@ -11093,6 +11194,32 @@ message WriteCtrTimeResponse {
int32 num_samps_per_chan_written = 2;
}

message BeginWriteCtrTimeRequest {
nidevice_grpc.Session task = 1;
int32 num_samps_per_chan = 2;
bool auto_start = 3;
double timeout = 4;
oneof data_layout_enum {
GroupBy data_layout = 5;
int32 data_layout_raw = 6;
}
}

message BeginWriteCtrTimeResponse {
int32 status = 1;
ni.data_monikers.Moniker moniker = 2;
}

message MonikerWriteCtrTimeRequest {
repeated double high_time = 1;
repeated double low_time = 2;
}

message MonikerWriteCtrTimeResponse {
int32 status = 1;
int32 num_samps_per_chan_written = 2;
}

message WriteCtrTimeScalarRequest {
nidevice_grpc.Session task = 1;
bool auto_start = 2;
Expand All @@ -11105,6 +11232,26 @@ message WriteCtrTimeScalarResponse {
int32 status = 1;
}

message BeginWriteCtrTimeScalarRequest {
nidevice_grpc.Session task = 1;
bool auto_start = 2;
double timeout = 3;
}

message BeginWriteCtrTimeScalarResponse {
int32 status = 1;
ni.data_monikers.Moniker moniker = 2;
}

message MonikerWriteCtrTimeScalarRequest {
double high_time = 1;
double low_time = 2;
}

message MonikerWriteCtrTimeScalarResponse {
int32 status = 1;
}

message WriteDigitalLinesRequest {
nidevice_grpc.Session task = 1;
int32 num_samps_per_chan = 2;
Expand All @@ -11122,6 +11269,31 @@ message WriteDigitalLinesResponse {
int32 samps_per_chan_written = 2;
}

message BeginWriteDigitalLinesRequest {
nidevice_grpc.Session task = 1;
int32 num_samps_per_chan = 2;
bool auto_start = 3;
double timeout = 4;
oneof data_layout_enum {
GroupBy data_layout = 5;
int32 data_layout_raw = 6;
}
}

message BeginWriteDigitalLinesResponse {
int32 status = 1;
ni.data_monikers.Moniker moniker = 2;
}

message MonikerWriteDigitalLinesRequest {
bytes write_array = 1;
}

message MonikerWriteDigitalLinesResponse {
int32 status = 1;
int32 samps_per_chan_written = 2;
}

message WriteDigitalScalarU32Request {
nidevice_grpc.Session task = 1;
bool auto_start = 2;
Expand Down Expand Up @@ -11253,6 +11425,31 @@ message WriteDigitalU8Response {
int32 samps_per_chan_written = 2;
}

message BeginWriteDigitalU8Request {
nidevice_grpc.Session task = 1;
int32 num_samps_per_chan = 2;
bool auto_start = 3;
double timeout = 4;
oneof data_layout_enum {
GroupBy data_layout = 5;
int32 data_layout_raw = 6;
}
}

message BeginWriteDigitalU8Response {
int32 status = 1;
ni.data_monikers.Moniker moniker = 2;
}

message MonikerWriteDigitalU8Request {
bytes write_array = 1;
}

message MonikerWriteDigitalU8Response {
int32 status = 1;
int32 samps_per_chan_written = 2;
}

message WriteRawRequest {
nidevice_grpc.Session task = 1;
int32 num_samps = 2;
Expand All @@ -11266,6 +11463,27 @@ message WriteRawResponse {
int32 samps_per_chan_written = 2;
}

message BeginWriteRawRequest {
nidevice_grpc.Session task = 1;
int32 num_samps = 2;
bool auto_start = 3;
double timeout = 4;
}

message BeginWriteRawResponse {
int32 status = 1;
ni.data_monikers.Moniker moniker = 2;
}

message MonikerWriteRawRequest {
bytes write_array = 1;
}

message MonikerWriteRawResponse {
int32 status = 1;
int32 samps_per_chan_written = 2;
}

message WriteToTEDSFromArrayRequest {
string physical_channel = 1;
bytes bit_stream = 2;
Expand Down
Loading

0 comments on commit 8f66808

Please sign in to comment.