示例#1
0
    raise Exception(error_message_response.error_message)


# Read in cmd args
if len(sys.argv) >= 2:
    server_address = sys.argv[1]
if len(sys.argv) >= 3:
    server_port = sys.argv[2]
if len(sys.argv) >= 4:
    resource = sys.argv[3]
    options = ""

# Create the communication channel for the remote host (in this case we are connecting to a local server)
# and create a connection to the NI-SCOPE service
channel = grpc.insecure_channel(f"{server_address}:{server_port}")
scope_service = grpc_scope.NiScopeStub(channel)

try:
    # Initialize the scope
    init_result = scope_service.InitWithOptions(
        niscope_types.InitWithOptionsRequest(session_name="demo",
                                             resource_name=resource,
                                             id_query=False,
                                             option_string=options))
    vi = init_result.vi
    CheckForError(vi, init_result.status)

    # Configure Vertical
    vertical_result = scope_service.ConfigureVertical(
        niscope_types.ConfigureVerticalRequest(
            vi=vi,
示例#2
0
    error_message_response = client.GetErrorMessage(error_message_request)
    raise Exception(error_message_response.error_message)


# Read in cmd args
if len(sys.argv) >= 2:
    server_address = sys.argv[1]
if len(sys.argv) >= 3:
    server_port = sys.argv[2]
if len(sys.argv) >= 4:
    resource = sys.argv[3]
    options = ""

# Create the communication channel for the remote host and create a connection to the NI-SCOPE service.
channel = grpc.insecure_channel(f"{server_address}:{server_port}")
client = grpc_niscope.NiScopeStub(channel)

try:
    # Open session to NI-SCOPE module with options.
    init_with_options_response = client.InitWithOptions(
        niscope_types.InitWithOptionsRequest(resource_name=resource,
                                             id_query=False,
                                             option_string=options))
    vi = init_with_options_response.vi
    CheckForError(vi, init_with_options_response.status)

    # Configure vertical.
    voltage = 10.0
    CheckForError(vi, (client.ConfigureVertical(
        niscope_types.ConfigureVerticalRequest(
            vi=vi,