Skip to content

Commit

Permalink
return error status from Write* moniker functions
Browse files Browse the repository at this point in the history
  • Loading branch information
doshirohan committed Nov 26, 2024
1 parent f9c5ce5 commit 314eb0e
Show file tree
Hide file tree
Showing 3 changed files with 129 additions and 0 deletions.
36 changes: 36 additions & 0 deletions generated/nidaqmx/nidaqmx_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -862,6 +862,10 @@ ::grpc::Status MonikerWriteAnalogF64(void* data, google::protobuf::Arena& arena,

auto status = library->WriteAnalogF64(task, num_samps_per_chan, auto_start, timeout, data_layout, write_array, &samps_per_chan_written, reserved);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -881,6 +885,10 @@ ::grpc::Status MonikerWriteAnalogScalarF64(void* data, google::protobuf::Arena&

auto status = library->WriteAnalogScalarF64(task, auto_start, timeout, value, reserved);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand Down Expand Up @@ -918,6 +926,10 @@ ::grpc::Status MonikerWriteBinaryI16(void* data, google::protobuf::Arena& arena,

auto status = library->WriteBinaryI16(task, num_samps_per_chan, auto_start, timeout, data_layout, write_array.data(), &samps_per_chan_written, reserved);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -943,6 +955,10 @@ ::grpc::Status MonikerWriteBinaryI32(void* data, google::protobuf::Arena& arena,

auto status = library->WriteBinaryI32(task, num_samps_per_chan, auto_start, timeout, data_layout, write_array, &samps_per_chan_written, reserved);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand Down Expand Up @@ -980,6 +996,10 @@ ::grpc::Status MonikerWriteBinaryU16(void* data, google::protobuf::Arena& arena,

auto status = library->WriteBinaryU16(task, num_samps_per_chan, auto_start, timeout, data_layout, write_array.data(), &samps_per_chan_written, reserved);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1005,6 +1025,10 @@ ::grpc::Status MonikerWriteBinaryU32(void* data, google::protobuf::Arena& arena,

auto status = library->WriteBinaryU32(task, num_samps_per_chan, auto_start, timeout, data_layout, write_array, &samps_per_chan_written, reserved);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1024,6 +1048,10 @@ ::grpc::Status MonikerWriteDigitalScalarU32(void* data, google::protobuf::Arena&

auto status = library->WriteDigitalScalarU32(task, auto_start, timeout, value, reserved);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand Down Expand Up @@ -1061,6 +1089,10 @@ ::grpc::Status MonikerWriteDigitalU16(void* data, google::protobuf::Arena& arena

auto status = library->WriteDigitalU16(task, num_samps_per_chan, auto_start, timeout, data_layout, write_array.data(), &samps_per_chan_written, reserved);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1086,6 +1118,10 @@ ::grpc::Status MonikerWriteDigitalU32(void* data, google::protobuf::Arena& arena

auto status = library->WriteDigitalU32(task, num_samps_per_chan, auto_start, timeout, data_layout, write_array, &samps_per_chan_written, reserved);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand Down
88 changes: 88 additions & 0 deletions generated/nifpga/nifpga_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1063,6 +1063,10 @@ ::grpc::Status MonikerWriteArrayBool(void* data, google::protobuf::Arena& arena,

auto status = library->WriteArrayBool(session, control, array.data(), size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1083,6 +1087,10 @@ ::grpc::Status MonikerWriteArrayDbl(void* data, google::protobuf::Arena& arena,

auto status = library->WriteArrayDbl(session, control, array, size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand Down Expand Up @@ -1115,6 +1123,10 @@ ::grpc::Status MonikerWriteArrayI16(void* data, google::protobuf::Arena& arena,

auto status = library->WriteArrayI16(session, control, array.data(), size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1135,6 +1147,10 @@ ::grpc::Status MonikerWriteArrayI32(void* data, google::protobuf::Arena& arena,

auto status = library->WriteArrayI32(session, control, array, size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1155,6 +1171,10 @@ ::grpc::Status MonikerWriteArrayI64(void* data, google::protobuf::Arena& arena,

auto status = library->WriteArrayI64(session, control, array, size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand Down Expand Up @@ -1187,6 +1207,10 @@ ::grpc::Status MonikerWriteArrayI8(void* data, google::protobuf::Arena& arena, g

auto status = library->WriteArrayI8(session, control, array.data(), size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1207,6 +1231,10 @@ ::grpc::Status MonikerWriteArraySgl(void* data, google::protobuf::Arena& arena,

auto status = library->WriteArraySgl(session, control, array, size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand Down Expand Up @@ -1239,6 +1267,10 @@ ::grpc::Status MonikerWriteArrayU16(void* data, google::protobuf::Arena& arena,

auto status = library->WriteArrayU16(session, control, array.data(), size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1259,6 +1291,10 @@ ::grpc::Status MonikerWriteArrayU32(void* data, google::protobuf::Arena& arena,

auto status = library->WriteArrayU32(session, control, array, size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1279,6 +1315,10 @@ ::grpc::Status MonikerWriteArrayU64(void* data, google::protobuf::Arena& arena,

auto status = library->WriteArrayU64(session, control, array, size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand Down Expand Up @@ -1311,6 +1351,10 @@ ::grpc::Status MonikerWriteArrayU8(void* data, google::protobuf::Arena& arena, g

auto status = library->WriteArrayU8(session, control, array.data(), size);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1328,6 +1372,10 @@ ::grpc::Status MonikerWriteBool(void* data, google::protobuf::Arena& arena, goog

auto status = library->WriteBool(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1345,6 +1393,10 @@ ::grpc::Status MonikerWriteDbl(void* data, google::protobuf::Arena& arena, googl

auto status = library->WriteDbl(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1366,6 +1418,10 @@ ::grpc::Status MonikerWriteI16(void* data, google::protobuf::Arena& arena, googl

auto status = library->WriteI16(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1383,6 +1439,10 @@ ::grpc::Status MonikerWriteI32(void* data, google::protobuf::Arena& arena, googl

auto status = library->WriteI32(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1400,6 +1460,10 @@ ::grpc::Status MonikerWriteI64(void* data, google::protobuf::Arena& arena, googl

auto status = library->WriteI64(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1421,6 +1485,10 @@ ::grpc::Status MonikerWriteI8(void* data, google::protobuf::Arena& arena, google

auto status = library->WriteI8(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1438,6 +1506,10 @@ ::grpc::Status MonikerWriteSgl(void* data, google::protobuf::Arena& arena, googl

auto status = library->WriteSgl(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1459,6 +1531,10 @@ ::grpc::Status MonikerWriteU16(void* data, google::protobuf::Arena& arena, googl

auto status = library->WriteU16(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1476,6 +1552,10 @@ ::grpc::Status MonikerWriteU32(void* data, google::protobuf::Arena& arena, googl

auto status = library->WriteU32(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1493,6 +1573,10 @@ ::grpc::Status MonikerWriteU64(void* data, google::protobuf::Arena& arena, googl

auto status = library->WriteU64(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand All @@ -1514,6 +1598,10 @@ ::grpc::Status MonikerWriteU8(void* data, google::protobuf::Arena& arena, google

auto status = library->WriteU8(session, control, value);

if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
return ::grpc::Status::OK;
}

Expand Down
5 changes: 5 additions & 0 deletions source/codegen/templates/service_helpers.mako
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,11 @@ ${set_response_values(output_parameters=output_parameters, init_method=false)}\
## But that needs `context` parameter which is not available in Moniker functions.
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
% else:
if (status < 0)
{
return ::grpc::Status(grpc::StatusCode::UNKNOWN, "ni-error: " + status);
}
% endif
</%def>

Expand Down

0 comments on commit 314eb0e

Please sign in to comment.