Lab-Zhinst

 view release on metacpan or  search on metacpan

Zhinst.xs  view on Meta::CPAN

INCLUDE: const-xs.inc


#
# Connecting to Data Server
#


void
ziAPIInit(const char *class)
PPCODE:
    ZIConnection conn;
    int rv = ziAPIInit(&conn);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHs(pointer_object(aTHX_ class, conn));


void
DESTROY(Lab::Zhinst conn)
CODE:

Zhinst.xs  view on Meta::CPAN



IV
ziAPIDisconnect(Lab::Zhinst conn)


MODULE = Lab::Zhinst		PACKAGE = Lab::Zhinst

void
ziAPIListImplementations()
PPCODE:
    size_t buffer_len = 100;
    char *buffer;
    Newx(buffer, buffer_len, char);
    int rv = ziAPIListImplementations(buffer, buffer_len);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHp(buffer, strlen(buffer));
    Safefree(buffer);

MODULE = Lab::Zhinst		PACKAGE = Lab::Zhinst		PREFIX = ziAPI

# FIXME: ziAPIConnectEx not needed?
  
void
ziAPIGetConnectionAPILevel(Lab::Zhinst conn)
PPCODE:
    ZIAPIVersion_enum apiLevel;
    int rv = ziAPIGetConnectionAPILevel(conn, &apiLevel);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHi(apiLevel);

# FIXME: ziAPIGetRevision


#
# Tree
#


void
ziAPIListNodes(Lab::Zhinst conn, const char *path, uint32_t bufferSize, uint32_t flags)
PPCODE:
    char *nodes;
    Newx(nodes, bufferSize, char);
    int rv = ziAPIListNodes(conn, path, nodes, bufferSize, flags);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHp(nodes, strlen(nodes));
    Safefree(nodes);


#
# Set and Get Parameters
#


void
ziAPIGetValueD(Lab::Zhinst conn, const char *path)
PPCODE:
    ZIDoubleData result;
    int rv = ziAPIGetValueD(conn, path, &result);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHn(result);

void
ziAPIGetValueI(Lab::Zhinst conn, const char *path)
PPCODE:
    IV result;
    int rv = ziAPIGetValueI(conn, path, &result);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHi(result);


void
ziAPIGetDemodSample(Lab::Zhinst conn, const char *path)
PPCODE:
    ZIDemodSample sample;
    int rv = ziAPIGetDemodSample(conn, path, &sample);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHs(demod_sample_to_hash(aTHX_ &sample));


void
ziAPIGetDIOSample(Lab::Zhinst conn, const char *path)
PPCODE:
    ZIDIOSample sample;
    int rv = ziAPIGetDIOSample(conn, path, &sample);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHs(dio_sample_to_hash(aTHX_ &sample));

void
ziAPIGetAuxInSample(Lab::Zhinst conn, const char *path)
PPCODE:
    ZIAuxInSample sample;
    int rv = ziAPIGetAuxInSample(conn, path, &sample);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHs(aux_in_sample_to_hash(aTHX_ &sample));



void
ziAPIGetValueB(Lab::Zhinst conn, const char *path, unsigned int bufferSize)
PPCODE:
    char *buffer;
    Newx(buffer, bufferSize, char);
    unsigned int length;
    int rv = ziAPIGetValueB(conn, path, (unsigned char *) buffer, &length, bufferSize);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHp(buffer, length);
    Safefree(buffer);


IV
ziAPISetValueD(Lab::Zhinst conn, const char *path, ZIDoubleData value)


IV
ziAPISetValueI(Lab::Zhinst conn, const char *path, IV value)


void
ziAPISetValueB(Lab::Zhinst conn, const char *path, SV *value)
PPCODE:
    if (!SvOK(value)) {
       croak("value is not a valid scalar");
    }
    const char *bytes;
    STRLEN len;
    bytes = SvPV(value, len);
    int rv = ziAPISetValueB(conn, path, (unsigned char *) bytes, len);
    mXPUSHi(rv);

void
ziAPISyncSetValueD(Lab::Zhinst conn, const char *path, ZIDoubleData value)
PPCODE:
    ZIDoubleData result = value;
    int rv = ziAPISyncSetValueD(conn, path, &result);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHn(result);


void
ziAPISyncSetValueI(Lab::Zhinst conn, const char *path, ZIIntegerData value)
PPCODE:
    ZIIntegerData result = value;
    int rv = ziAPISyncSetValueI(conn, path, &result);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHi(result);

void
ziAPISyncSetValueB(Lab::Zhinst conn, const char *path, SV *value)
PPCODE:
    if (!SvOK(value)) {
       croak("value is not a valid scalar");
    }
    const char *original;
    STRLEN len;
    original = SvPV(value, len);

    char *new_string;
    Newx(new_string, len, char);
    Copy(original, new_string, len, char);

Zhinst.xs  view on Meta::CPAN

ziAPIEchoDevice(Lab::Zhinst conn, const char *device_serial)

#
# Data Streaming
#

MODULE = Lab::Zhinst		PACKAGE = Lab::Zhinst

void
ziAPIAllocateEventEx()
PPCODE:
    ZIEvent *event = ziAPIAllocateEventEx();
    mXPUSHs(pointer_object(aTHX_ "Lab::Zhinst::ZIEvent", event));


MODULE = Lab::Zhinst        PACKAGE = Lab::Zhinst::ZIEvent

void
DESTROY(Lab::Zhinst::ZIEvent ev)
CODE:
    ziAPIDeallocateEventEx(ev);

Zhinst.xs  view on Meta::CPAN

MODULE = Lab::Zhinst		PACKAGE = Lab::Zhinst		PREFIX = ziAPI

IV
ziAPISubscribe(Lab::Zhinst conn, const char *path)

IV
ziAPIUnSubscribe(Lab::Zhinst conn, const char *path)

void
ziAPIPollDataEx(Lab::Zhinst conn, Lab::Zhinst::ZIEvent ev, uint32_t timeOutMilliseconds)
PPCODE:
    int rv = ziAPIPollDataEx(conn, ev, timeOutMilliseconds);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHs(zievent_to_hash(aTHX_ ev));


IV
ziAPIGetValueAsPollData(Lab::Zhinst conn, const char *path)


#
# Error Handling and Logging in the LabOne C API
#


MODULE = Lab::Zhinst		PACKAGE = Lab::Zhinst

void
ziAPIGetError(ZIResult_enum result)
PPCODE:
    int base;
    char *buffer;
    int rv = ziAPIGetError(result, &buffer, &base);
    mXPUSHi(rv);
    if (rv == 0) {
        mXPUSHp(buffer, strlen(buffer));
        mXPUSHi(base);
    }


MODULE = Lab::Zhinst		PACKAGE = Lab::Zhinst		PREFIX = ziAPI

void
ziAPIGetLastError(Lab::Zhinst conn, uint32_t bufferSize)
PPCODE:
    char *buffer;
    Newx(buffer, bufferSize, char);
    int rv = ziAPIGetLastError(conn, buffer, bufferSize);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHp(buffer, strlen(buffer));
    Safefree(buffer);


MODULE = Lab::Zhinst		PACKAGE = Lab::Zhinst

Zhinst.xs  view on Meta::CPAN

#
# Device discovery
#


MODULE = Lab::Zhinst		PACKAGE = Lab::Zhinst		PREFIX = ziAPI


void
ziAPIDiscoveryFind(Lab::Zhinst conn, const char *device_address)
PPCODE:
    const char *device_id;
    int rv = ziAPIDiscoveryFind(conn, device_address, &device_id);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHp(device_id, strlen(device_id));


void
ziAPIDiscoveryGet(Lab::Zhinst conn, const char *device_id)
PPCODE:
    const char *props_json;
    int rv = ziAPIDiscoveryGet(conn, device_id, &props_json);
    mXPUSHi(rv);
    if (rv == 0)
        mXPUSHp(props_json, strlen(props_json));



( run in 1.030 second using v1.01-cache-2.11-cpan-5511b514fd6 )