ScriptLoad Method - neoVI API

This method downloads a script to a connected neoVI device into a specified location.

int _stdcall icsneoScriptLoad(void * hObject, const unsigned char *bin, unsigned long len_bytes, int iLocation);

Parameters

hObject

[in] Specifies the driver object created by OpenNeoDevice.

bin[in] An array of bytes that represent a compiled script. These bytes are contained in a header file called cmvspy.h.

This file is created by Vehicle Spy when a script is compiled. Please see Vehicle Spy documentation for details.

len_bytes

[in] Specifies the number of bytes represented by the bin parameter

iLocation

[in] Specifies the physical location to where the script will be loaded on the neoVI device. Valid values are as follows:

SCRIPT_LOCATION_FLASH_MEM = 0 (Valid only on a neoVI Fire or neoVI Red)SCRIPT_LOCATION_SDCARD = 1 (Valid only on a neoVI Fire or neoVI Red)SCRIPT_LOCATION_VCAN3_MEM = 4 (Valid only on a ValueCAN 3 device)

These values are defined in the icsnVC40.h file

Return Values

1 if the function succeeded. 0 if it failed for any reason. GetLastAPIError must be called to obtain the specific error. The errors that can be generated by this function are:

NEOVI_ERROR_DLL_NEOVI_NO_RESPONSE = 75

NEOVI_ERROR_DLL_INVALID_SCRIPT_LOCATION = 213

NEOVI_ERROR_DLL_SDCARD_NOT_INSERTED = 214

NEOVI_ERROR_DLL_SDCARD_WRITE_ERROR = 216

NEOVI_ERROR_DLL_SCRIPT_ERROR_DOWNLOADING_SCRIPT = 220

NEOVI_ERROR_DLL_SDCARD_READ_ERROR = 217

Remarks

The script will be stored on the device in the specified location. If the location is SCRIPT_LOCATION_FLASH_MEM or SCRIPT_LOCATION_SDCARD the script will persist in the device in that location until cleared by ScriptClear. If the neoVI device is booted (plugged in to power) without being connected to a USB port the stored script will execute. The location SCRIPT_LOCATION_VCAN3_MEM applies only to the ValueCAN 3 device and the storage will be cleared when power is removed from the device.

Examples

int iRetVal;
unsigned long lLastErrNum;
unsigned long NumBinBytes;
NumBinBytes = CM_EXE_SIZE; //from the cmvspy.h file. The length of the compiled script
//ucharConfigurationArrayPM is defined in cmvspy.h.
//It is a pointer to the array of compiled script bytes

iRetVal = icsneoScriptLoad(hObject, ucharConfigurationArrayPM, NumBinBytes, DefaultScriptLocation);
if(iRetVal == 0)
{
    printf("\nFailed to load the script into the neo device);
}
else
{
    printf("\nSuccessfully loaded the script into the neoVI");
}

Last updated