Skip to content

Commit

Permalink
Auto-generation support for daqmx streaming apis (#1123)
Browse files Browse the repository at this point in the history
* auto_generate_daqmx_apis

* removed extra spaces/blank lines

* resolved ayush's and rohan's comments

* removed unnecessary changes

* resolved astarche's comments

* typo

* removed unused ArrayU8Data

---------

Co-authored-by: Raghav Rawat <[email protected]>
  • Loading branch information
Raghav-NI and Raghav Rawat authored Nov 22, 2024
1 parent b5a65e5 commit 2452661
Show file tree
Hide file tree
Showing 13 changed files with 3,609 additions and 239 deletions.
414 changes: 414 additions & 0 deletions generated/nidaqmx/nidaqmx.proto

Large diffs are not rendered by default.

616 changes: 616 additions & 0 deletions generated/nidaqmx/nidaqmx_client.cpp

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions generated/nidaqmx/nidaqmx_client.h

Large diffs are not rendered by default.

2,252 changes: 2,165 additions & 87 deletions generated/nidaqmx/nidaqmx_service.cpp

Large diffs are not rendered by default.

53 changes: 53 additions & 0 deletions generated/nidaqmx/nidaqmx_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,34 @@ struct NiDAQmxFeatureToggles
bool is_allow_undefined_attributes_enabled;
};

void RegisterMonikerEndpoints();

::grpc::Status MonikerReadAnalogF64(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadAnalogScalarF64(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadBinaryI16(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadBinaryI32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadBinaryU16(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadBinaryU32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadCounterF64(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadCounterF64Ex(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadCounterScalarF64(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadCounterScalarU32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadCounterU32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadCounterU32Ex(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadDigitalScalarU32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadDigitalU16(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerReadDigitalU32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWaitForNextSampleClock(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWriteAnalogF64(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWriteAnalogScalarF64(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWriteBinaryI16(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWriteBinaryI32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWriteBinaryU16(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWriteBinaryU32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWriteDigitalScalarU32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWriteDigitalU16(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);
::grpc::Status MonikerWriteDigitalU32(void* data, google::protobuf::Arena& arena, google::protobuf::Any& packedData);

class NiDAQmxService final : public NiDAQmx::WithCallbackMethod_RegisterSignalEvent<NiDAQmx::WithCallbackMethod_RegisterEveryNSamplesEvent<NiDAQmx::WithCallbackMethod_RegisterDoneEvent<NiDAQmx::Service>>> {
public:
using LibrarySharedPtr = std::shared_ptr<NiDAQmxLibraryInterface>;
Expand Down Expand Up @@ -289,17 +317,29 @@ class NiDAQmxService final : public NiDAQmx::WithCallbackMethod_RegisterSignalEv
::grpc::Status PerformStrainShuntCalEx(::grpc::ServerContext* context, const PerformStrainShuntCalExRequest* request, PerformStrainShuntCalExResponse* response) override;
::grpc::Status PerformThrmcplLeadOffsetNullingCal(::grpc::ServerContext* context, const PerformThrmcplLeadOffsetNullingCalRequest* request, PerformThrmcplLeadOffsetNullingCalResponse* response) override;
::grpc::Status ReadAnalogF64(::grpc::ServerContext* context, const ReadAnalogF64Request* request, ReadAnalogF64Response* response) override;
::grpc::Status BeginReadAnalogF64(::grpc::ServerContext* context, const BeginReadAnalogF64Request* request, BeginReadAnalogF64Response* response) override;
::grpc::Status ReadAnalogScalarF64(::grpc::ServerContext* context, const ReadAnalogScalarF64Request* request, ReadAnalogScalarF64Response* response) override;
::grpc::Status BeginReadAnalogScalarF64(::grpc::ServerContext* context, const BeginReadAnalogScalarF64Request* request, BeginReadAnalogScalarF64Response* response) override;
::grpc::Status ReadBinaryI16(::grpc::ServerContext* context, const ReadBinaryI16Request* request, ReadBinaryI16Response* response) override;
::grpc::Status BeginReadBinaryI16(::grpc::ServerContext* context, const BeginReadBinaryI16Request* request, BeginReadBinaryI16Response* response) override;
::grpc::Status ReadBinaryI32(::grpc::ServerContext* context, const ReadBinaryI32Request* request, ReadBinaryI32Response* response) override;
::grpc::Status BeginReadBinaryI32(::grpc::ServerContext* context, const BeginReadBinaryI32Request* request, BeginReadBinaryI32Response* response) override;
::grpc::Status ReadBinaryU16(::grpc::ServerContext* context, const ReadBinaryU16Request* request, ReadBinaryU16Response* response) override;
::grpc::Status BeginReadBinaryU16(::grpc::ServerContext* context, const BeginReadBinaryU16Request* request, BeginReadBinaryU16Response* response) override;
::grpc::Status ReadBinaryU32(::grpc::ServerContext* context, const ReadBinaryU32Request* request, ReadBinaryU32Response* response) override;
::grpc::Status BeginReadBinaryU32(::grpc::ServerContext* context, const BeginReadBinaryU32Request* request, BeginReadBinaryU32Response* response) override;
::grpc::Status ReadCounterF64(::grpc::ServerContext* context, const ReadCounterF64Request* request, ReadCounterF64Response* response) override;
::grpc::Status BeginReadCounterF64(::grpc::ServerContext* context, const BeginReadCounterF64Request* request, BeginReadCounterF64Response* response) override;
::grpc::Status ReadCounterF64Ex(::grpc::ServerContext* context, const ReadCounterF64ExRequest* request, ReadCounterF64ExResponse* response) override;
::grpc::Status BeginReadCounterF64Ex(::grpc::ServerContext* context, const BeginReadCounterF64ExRequest* request, BeginReadCounterF64ExResponse* response) override;
::grpc::Status ReadCounterScalarF64(::grpc::ServerContext* context, const ReadCounterScalarF64Request* request, ReadCounterScalarF64Response* response) override;
::grpc::Status BeginReadCounterScalarF64(::grpc::ServerContext* context, const BeginReadCounterScalarF64Request* request, BeginReadCounterScalarF64Response* response) override;
::grpc::Status ReadCounterScalarU32(::grpc::ServerContext* context, const ReadCounterScalarU32Request* request, ReadCounterScalarU32Response* response) override;
::grpc::Status BeginReadCounterScalarU32(::grpc::ServerContext* context, const BeginReadCounterScalarU32Request* request, BeginReadCounterScalarU32Response* response) override;
::grpc::Status ReadCounterU32(::grpc::ServerContext* context, const ReadCounterU32Request* request, ReadCounterU32Response* response) override;
::grpc::Status BeginReadCounterU32(::grpc::ServerContext* context, const BeginReadCounterU32Request* request, BeginReadCounterU32Response* response) override;
::grpc::Status ReadCounterU32Ex(::grpc::ServerContext* context, const ReadCounterU32ExRequest* request, ReadCounterU32ExResponse* response) override;
::grpc::Status BeginReadCounterU32Ex(::grpc::ServerContext* context, const BeginReadCounterU32ExRequest* request, BeginReadCounterU32ExResponse* response) override;
::grpc::Status ReadCtrFreq(::grpc::ServerContext* context, const ReadCtrFreqRequest* request, ReadCtrFreqResponse* response) override;
::grpc::Status ReadCtrFreqScalar(::grpc::ServerContext* context, const ReadCtrFreqScalarRequest* request, ReadCtrFreqScalarResponse* response) override;
::grpc::Status ReadCtrTicks(::grpc::ServerContext* context, const ReadCtrTicksRequest* request, ReadCtrTicksResponse* response) override;
Expand All @@ -308,8 +348,11 @@ class NiDAQmxService final : public NiDAQmx::WithCallbackMethod_RegisterSignalEv
::grpc::Status ReadCtrTimeScalar(::grpc::ServerContext* context, const ReadCtrTimeScalarRequest* request, ReadCtrTimeScalarResponse* response) override;
::grpc::Status ReadDigitalLines(::grpc::ServerContext* context, const ReadDigitalLinesRequest* request, ReadDigitalLinesResponse* response) override;
::grpc::Status ReadDigitalScalarU32(::grpc::ServerContext* context, const ReadDigitalScalarU32Request* request, ReadDigitalScalarU32Response* response) override;
::grpc::Status BeginReadDigitalScalarU32(::grpc::ServerContext* context, const BeginReadDigitalScalarU32Request* request, BeginReadDigitalScalarU32Response* response) override;
::grpc::Status ReadDigitalU16(::grpc::ServerContext* context, const ReadDigitalU16Request* request, ReadDigitalU16Response* response) override;
::grpc::Status BeginReadDigitalU16(::grpc::ServerContext* context, const BeginReadDigitalU16Request* request, BeginReadDigitalU16Response* response) override;
::grpc::Status ReadDigitalU32(::grpc::ServerContext* context, const ReadDigitalU32Request* request, ReadDigitalU32Response* response) override;
::grpc::Status BeginReadDigitalU32(::grpc::ServerContext* context, const BeginReadDigitalU32Request* request, BeginReadDigitalU32Response* response) override;
::grpc::Status ReadDigitalU8(::grpc::ServerContext* context, const ReadDigitalU8Request* request, ReadDigitalU8Response* response) override;
::grpc::Status ReadPowerBinaryI16(::grpc::ServerContext* context, const ReadPowerBinaryI16Request* request, ReadPowerBinaryI16Response* response) override;
::grpc::Status ReadPowerF64(::grpc::ServerContext* context, const ReadPowerF64Request* request, ReadPowerF64Response* response) override;
Expand Down Expand Up @@ -419,14 +462,21 @@ class NiDAQmxService final : public NiDAQmx::WithCallbackMethod_RegisterSignalEv
::grpc::Status UnregisterSignalEvent(::grpc::ServerContext* context, const UnregisterSignalEventRequest* request, UnregisterSignalEventResponse* response) override;
::grpc::Status UnreserveNetworkDevice(::grpc::ServerContext* context, const UnreserveNetworkDeviceRequest* request, UnreserveNetworkDeviceResponse* response) override;
::grpc::Status WaitForNextSampleClock(::grpc::ServerContext* context, const WaitForNextSampleClockRequest* request, WaitForNextSampleClockResponse* response) override;
::grpc::Status BeginWaitForNextSampleClock(::grpc::ServerContext* context, const BeginWaitForNextSampleClockRequest* request, BeginWaitForNextSampleClockResponse* response) override;
::grpc::Status WaitForValidTimestamp(::grpc::ServerContext* context, const WaitForValidTimestampRequest* request, WaitForValidTimestampResponse* response) override;
::grpc::Status WaitUntilTaskDone(::grpc::ServerContext* context, const WaitUntilTaskDoneRequest* request, WaitUntilTaskDoneResponse* response) override;
::grpc::Status WriteAnalogF64(::grpc::ServerContext* context, const WriteAnalogF64Request* request, WriteAnalogF64Response* response) override;
::grpc::Status BeginWriteAnalogF64(::grpc::ServerContext* context, const BeginWriteAnalogF64Request* request, BeginWriteAnalogF64Response* response) override;
::grpc::Status WriteAnalogScalarF64(::grpc::ServerContext* context, const WriteAnalogScalarF64Request* request, WriteAnalogScalarF64Response* response) override;
::grpc::Status BeginWriteAnalogScalarF64(::grpc::ServerContext* context, const BeginWriteAnalogScalarF64Request* request, BeginWriteAnalogScalarF64Response* response) override;
::grpc::Status WriteBinaryI16(::grpc::ServerContext* context, const WriteBinaryI16Request* request, WriteBinaryI16Response* response) override;
::grpc::Status BeginWriteBinaryI16(::grpc::ServerContext* context, const BeginWriteBinaryI16Request* request, BeginWriteBinaryI16Response* response) override;
::grpc::Status WriteBinaryI32(::grpc::ServerContext* context, const WriteBinaryI32Request* request, WriteBinaryI32Response* response) override;
::grpc::Status BeginWriteBinaryI32(::grpc::ServerContext* context, const BeginWriteBinaryI32Request* request, BeginWriteBinaryI32Response* response) override;
::grpc::Status WriteBinaryU16(::grpc::ServerContext* context, const WriteBinaryU16Request* request, WriteBinaryU16Response* response) override;
::grpc::Status BeginWriteBinaryU16(::grpc::ServerContext* context, const BeginWriteBinaryU16Request* request, BeginWriteBinaryU16Response* response) override;
::grpc::Status WriteBinaryU32(::grpc::ServerContext* context, const WriteBinaryU32Request* request, WriteBinaryU32Response* response) override;
::grpc::Status BeginWriteBinaryU32(::grpc::ServerContext* context, const BeginWriteBinaryU32Request* request, BeginWriteBinaryU32Response* response) override;
::grpc::Status WriteCtrFreq(::grpc::ServerContext* context, const WriteCtrFreqRequest* request, WriteCtrFreqResponse* response) override;
::grpc::Status WriteCtrFreqScalar(::grpc::ServerContext* context, const WriteCtrFreqScalarRequest* request, WriteCtrFreqScalarResponse* response) override;
::grpc::Status WriteCtrTicks(::grpc::ServerContext* context, const WriteCtrTicksRequest* request, WriteCtrTicksResponse* response) override;
Expand All @@ -435,8 +485,11 @@ class NiDAQmxService final : public NiDAQmx::WithCallbackMethod_RegisterSignalEv
::grpc::Status WriteCtrTimeScalar(::grpc::ServerContext* context, const WriteCtrTimeScalarRequest* request, WriteCtrTimeScalarResponse* response) override;
::grpc::Status WriteDigitalLines(::grpc::ServerContext* context, const WriteDigitalLinesRequest* request, WriteDigitalLinesResponse* response) override;
::grpc::Status WriteDigitalScalarU32(::grpc::ServerContext* context, const WriteDigitalScalarU32Request* request, WriteDigitalScalarU32Response* response) override;
::grpc::Status BeginWriteDigitalScalarU32(::grpc::ServerContext* context, const BeginWriteDigitalScalarU32Request* request, BeginWriteDigitalScalarU32Response* response) override;
::grpc::Status WriteDigitalU16(::grpc::ServerContext* context, const WriteDigitalU16Request* request, WriteDigitalU16Response* response) override;
::grpc::Status BeginWriteDigitalU16(::grpc::ServerContext* context, const BeginWriteDigitalU16Request* request, BeginWriteDigitalU16Response* response) override;
::grpc::Status WriteDigitalU32(::grpc::ServerContext* context, const WriteDigitalU32Request* request, WriteDigitalU32Response* response) override;
::grpc::Status BeginWriteDigitalU32(::grpc::ServerContext* context, const BeginWriteDigitalU32Request* request, BeginWriteDigitalU32Response* response) override;
::grpc::Status WriteDigitalU8(::grpc::ServerContext* context, const WriteDigitalU8Request* request, WriteDigitalU8Response* response) override;
::grpc::Status WriteRaw(::grpc::ServerContext* context, const WriteRawRequest* request, WriteRawResponse* response) override;
::grpc::Status WriteToTEDSFromArray(::grpc::ServerContext* context, const WriteToTEDSFromArrayRequest* request, WriteToTEDSFromArrayResponse* response) override;
Expand Down
6 changes: 6 additions & 0 deletions generated/nidaqmx/nidaqmx_service_registrar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

#include "nidaqmx_service.h"
#include "nidaqmx_service_registrar.h"
#include <server/data_moniker_service.h>

namespace nidaqmx_grpc {

Expand All @@ -28,6 +29,11 @@ std::shared_ptr<void> register_service(
resource_repository,
toggles);
builder.RegisterService(service.get());

if (ni::data_monikers::is_sideband_streaming_enabled(feature_toggles)) {
nidaqmx_grpc::RegisterMonikerEndpoints();
}

return service;
}

Expand Down
Loading

0 comments on commit 2452661

Please sign in to comment.