Skip to content

General API Differences

Ryan Eckenrode edited this page Apr 26, 2023 · 4 revisions

General API Differences

The following is a list of general differences between the NI Driver C APIs and the gRPC API provided by grpc-device. These differences all affect all driver services in grpc-device.

  • In attribute names, the abbreviation ATTR (as used in the C API) is spelled out as ATTRIBUTE in the gRPC API.
  • In the gRPC API, parameter names are always snake case (e.g. example_parameter_name) rather than camel case (e.g. exampleParameterName), as used in the C API.
  • The return value of the C API function will always be a field named status in the in the grpc-device Response message. statusOrRequiredSize in the C API is just called status in the gRPC API. For more information on this, refer to Array Size Parameters.
  • Some functions in the C API use int32 parameters to represent booleans or enums. The corresponding functions in the gRPC API use enums or booleans for those parameters.
  • The driver names at the beginning of functions are removed, e.g. DAQmxCreateAIVoltageChan in C will be CreateAIVoltageChan in gRPC
  • Some parameters have different names and values than in the C API. To find the name, go to the proto file, search for the function. There, you will find the mapped request message. The proto file also contains the message structure, with the parameter names, and the possible parameter values.

Array Size Parameters

Many functions in the C API that take in arrays also take in the array size. For example, the C prototype of RFmxBT_ModAccFetchDf1maxTrace is :

int32 __stdcall RFmxBT_ModAccFetchDf1maxTrace (niRFmxInstrHandle instrumentHandle, char selectorString[], float64 timeout, float32 time[], float32 df1max[], int32 arraySize, int32* actualArraySize);

Here, arraySize is just the size of the time and df1max parameters.

In the gRPC API, the arraySize parameter is not present; the gRPC layer automatically determines the correct value to pass in.

Additionally, some functions behave similarly for character arrays. For example, RFmxBT_GetError's parameter errorDescriptionBufferSize is present in the C API but absent in the gRPC API, because the gRPC layer automatically determines the necessary buffer size.

8- and 16-bit Integer types

Protobuf does not support integer types narrower than 32 bits (see Scalar Value Types). When these types are used NI Driver C APIs, they are copy converted to or from the corresponding 32-bit type (int32 or uint32).

Table of Contents

Internal Development

Creating and Setting Up a gRPC Server

Server Security Support

Creating a gRPC Client

gRPC Client Examples

Session Utilities API Reference

Driver Documentation

gRPC API Differences From C API

Sharing Driver Sessions Between Clients

C API Docs
NI-DAQmx
NI-DCPOWER
NI-DIGITAL PATTERN DRIVER
NI-DMM
NI-FGEN
NI-FPGA
NI-RFmx Bluetooth
NI-RFmx NR
NI-RFmx WCDMA
NI-RFmx GSM
NI-RFmx CDMA2k
NI-RFmx Instr
NI-RFmx LTE
NI-RFmx SpecAn
NI-RFmx TD-SCDMA
NI-RFmx WLAN
NI-RFSA
NI-RFSG
NI-SCOPE
NI-SWITCH
NI-TCLK
NI-XNET
Clone this wiki locally