ncDeviceOpen()

Info Value
Header mvnc.h
Library libmvnc.so
Version 2.0
See also struct ncDeviceHandle_t, ncDeviceCreate(), ncDeviceClose(), ncDeviceDestroy()

Overview

This function initializes a neural compute device and opens communication.

Upon successful return from this function, the device will be ready for use.

ncDeviceClose() closes communication with devices opened with this function.

Prototype

ncStatus_t ncDeviceOpen(struct ncDeviceHandle_t* deviceHandle);

Parameters

Name Type Description
deviceHandle struct ncDeviceHandle_t* A pointer to an initialized ncDeviceHandle_t struct for the device that will be opened. The device state must be NC_DEVICE_CREATED.

Return

An appropriate value from the ncStatus_t enumeration.

Notes

Example

#include <stdio.h>
#include <stdlib.h>
#include <mvnc.h>

int main(int argc, char** argv)
{
    ncStatus_t retCode;
    struct ncDeviceHandle_t* deviceHandlePtr;
    
    ncDeviceCreate(0, &deviceHandlePtr);

    // Open the device
    retCode = ncDeviceOpen(deviceHandlePtr);
    if (retCode != NC_OK)
    {
        // Failed to open the device
        printf("ncDeviceOpen Failed [%d]: Could not open the device.\n", retCode);
    } 
    else 
    {
        // Device handle is ready to use now, pass it to other API calls as needed...
    
        ncDeviceClose(deviceHandlePtr);
    }

    ncDeviceDestroy(&deviceHandlePtr);
}