neoVI API Docs
All DocsProductsLearning CenterSupport
  • The neoVI API - Create your own software applications
  • Basic Operation - neoVI API
    • Using the neoVI API in Visual Studio: 32 bit DLL and 64 bit OS - neoVI API
    • Using the intrepidcs API in Visual Basic - neoVI API
    • Using the neoVI API in Visual C++ - neoVI API
    • Using the neoVI API in C# - neoVI API
    • Using the neoVI API in Borland C++ Builder - neoVI API
    • Using the neoVI API in Delphi - neoVI API
    • Using the API in LabVIEW - neoVI API
    • Using the neoVI API in LabWindows CVI - neoVI API
    • Unity3D Graphic Display API
    • Using the neoVI API in Excel - neoVI API
  • WIN32 API Overview - neoVI API
    • Basic Functions Overview - neoVI API
      • FindDevices Method
      • OpenNeoDevice Method - neoVI API
      • ClosePort Method - neoVI API
      • FreeObject Method - neoVI API
    • Message Functions Overview - neoVI API
      • GetMessages Method - neoVI API
      • TxMessages Method - neoVI API
      • TxMessagesEx Method - neoVI API
      • WaitForRxMessagesWithTimeOut Method - neoVI API
      • GetTimeStampForMsg Method - neoVI API
      • ISO15765 Message Functions Overview - neoVI API
        • ISO15765_EnableNetworks Method - neoVI API
        • ISO15765_TransmitMessage Method - neoVI API
        • ISO15765_ReceiveMessage Method - neoVI API
      • Transmitting Long Messages - neoVI API
    • Device Settings Functions Overview - neoVI API
      • GetConfiguration Method - neoVI API
      • SendConfiguration Method - neoVI API
      • neoVI Fire - neoVI API
        • GetFireSettings Method - neoVI API
        • SetFireSettings Method - neoVI API
      • neoVI FIRE 2 - neoVI API
        • GetFIRE2Settings Method - neoVI API
        • SetFire2Settings Method - neoVI API
      • ValueCAN3 - neoVI API
        • GetVCAN3Settings Method - neoVI API
        • SetVCAN3Settings Method - neoVI API
      • ValueCAN 4-1 and 4-2 - neoVI API
        • GetVCAN412Settings Method - neoVI API
        • SetVCAN412Settings Method - neoVI API
      • ValueCAN 4-4 - neoVI API
        • GetVCAN4Settings Method - neoVI API
        • SetVCAN4Settings Method - neoVI API
      • ValueCAN RF - neoVI API
        • GetVCANRFSettings Method - neoVI API
        • SetVCANRFSettings Method - neoVI API
      • RAD Galaxy - neoVI API
        • GetRADGalaxySettings Method - neoVI API
        • SetRADGalaxySettings Method - neoVI API
      • General Device Settings - neoVI API
        • SetBitRate Method - neoVI API
        • SetFDBitRate Method - neoVI API
        • GetDeviceSettings Method - neoVI API
        • SetDeviceSettings Method - neoVI API
        • GetHWFirmwareInfo Method - neoVI API
        • GetDLLFirmwareInfo Method - neoVI API
        • ForceFirmwareUpdate Method - neoVI API
        • GetDeviceParameters Method - neoVI API
        • SetDeviceParameters Method - neoVI API
        • SetReflashDisplayCallbacks Method - neoVI API
        • ClearReflashDisplayCallbacks Method - neoVI API
        • GetRTC Method - neoVI API
        • SetRTC Method - neoVI API
    • Error Functions Overview - neoVI API
      • GetLastAPIError Method - neoVI API
      • GetErrorMessages Method - neoVI API
      • GetErrorInfo Method - neoVI API
      • Error Messages - neoVI API
    • General Utility Functions Overview - neoVI API
      • ValidateHObject Method - neoVI API
      • GetDLLVersion Method - neoVI API
      • StartSocketServer Method - neoVI API
      • StopSocketServer Method - neoVI API
      • GetPerformanceParameters Method - neoVI API
      • ReadWritePhySettings Method - neoVI API
      • EnableDOIPLine Method - neoVI API
      • GetGPTPStatus Method - neoVI API
    • Deprecated Functions Overview - neoVI API
      • OpenPortEx Method - neoVI API
        • OpenPortEx Hardware Type Information - neoVI API
      • FindAllCOMDevices Method - neoVI API
      • FindAllUSBDevices Method - neoVI API
      • FindNeoDevices Method - neoVI API
      • EnableNetworkCom Method - neoVI API
      • CoreMini Script interface Overview - neoVI API
        • ScriptStart Method - neoVI API
        • ScriptStop Method - neoVI API
        • ScriptLoad Method - neoVI API
        • ScriptClear Method - neoVI API
        • ScriptStartFBlock Method - neoVI API
        • ScriptGetFBlockStatus Method - neoVI API
        • ScriptStopFBlock Method - neoVI API
        • ScriptGetScriptStatus Method - neoVI API
        • ScriptReadAppSignal Method - neoVI API
        • ScriptWriteAppSignal Method - neoVI API
    • Structures, Types, and Defines Overview - neoVI API
      • Setting Structures Overview - neoVI API
        • SFireSettings Structure
        • SFire2Settings Structure
        • SVCAN3Settings Structure
        • SVCANRFSettings Structure
        • SVCAN412Settings Structure
        • SVCAN4Settings Structure
        • SVCAN4IndSettings Structure
        • SRADGalaxySettings Structure
        • SRADStar2Settings Structure
        • SRADPlutoSettings Structure
        • SRADSuperMoonSettings Structure
        • SRADMoon2Settings Structure
        • SDeviceSettings Structure
        • Sub Setting Structures Overview - neoVI API
          • CAN_SETTINGS Structure
          • SWCAN_SETTINGS Structure
          • CANFD_SETTINGS Structure
          • LIN_SETTINGS Structure
          • ISO9141_KEYWORD2000_SETTINGS Structure
          • ISO9141_KEYWORD2000__INIT_STEP Structure
          • ETHERNET_SETTINGS Structure
          • ETHERNET_SETTINGS2 Structure
          • OP_ETH_GENERAL_SETTINGS Structure
          • OP_ETH_SETTINGS Structure
          • SPluto_CustomParams Structure
          • UART_SETTINGS Structure
          • RAD_GPTP_SETTINGS Structure
          • LOGGER_SETTINGS Structure
          • DISK_SETTINGS Structure
          • TIMESYNC_ICSHARDWARE_SETTINGS Structure
          • RAD_REPORTING_SETTINGS Structure
          • STextAPISettings Structure
          • gPTP Structures
            • GPTPStatus Structure
            • timestamp Structure
            • priority_vector Structure
            • port_identity Structure
            • clock_quality Structure
            • system_identity Structure
        • NeoDevice Structure
        • NeoDeviceEx Structure
        • stAPIFirmwareInfo Structure
        • Message Structures - neoVI API
        • Status Bitfields - neoVI API
        • Using an array instead of a message structure - intrepidcs API
        • icsSpyTime Structure
        • stCM_ISO157652_TxMessage Structure
        • stCM_ISO157652_RxMessage Structure
        • Valid parameter names for the SetDeviceParameter and GetDeviceParameter methods
        • neoVI API Data Types
        • PhyRegPktClauseMess_t Structure
        • neoVI Network ID List
  • Development FAQ's
    • How do I detect and handle disconnects?
    • How do I set parameters on a neoVI device?
    • How do I open more than one channel on a single piece of hardware? - neoVI API
    • How do I communicate on LIN - neoVI API
    • How do I send a Extended Frame or a High Voltage Wakeup or ISO9141/KW2K Init? - neoVI API
  • Unix-like Operating Systems - Support
  • J2534 Support - neoVI API
  • Vehicle Spy Text API
    • ECU Object - Vehicle Spy Text API
    • Labview Text API Interface to Vehicle Spy 3
  • Vehicle Spy VSB file Spec
  • Contact Us
    • Contact Information - Intrepid Control Systems, Inc
Powered by GitBook
LogoLogo

Applications

  • Cybersecurity
  • Data Logging
  • Simulate ECU Functions
  • Diagnostics, Testing and Validation

Products

  • Vehicle Network Adapters
  • Data Loggers
  • Software
  • Automotive Ethernet Tools

Support

  • Support Resources
  • Contact Support
  • Class Schedule & Registration
  • Training Video Library

Company

  • About
  • News
  • Events
  • Contact Us

Copyright © 2025 | All Rights Reserved

On this page
Edit on GitHub
Export as PDF
  1. WIN32 API Overview - neoVI API
  2. Deprecated Functions Overview - neoVI API
  3. CoreMini Script interface Overview - neoVI API

ScriptLoad Method - neoVI API

PreviousScriptStop Method - neoVI APINextScriptClear Method - neoVI API

Last updated 2 years ago

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);
Public Declare Function icsneoScriptLoad Lib “icsneo40.dll” (ByVal hObject As IntPtr, ByRef bin As Byte, ByVal Len_Bytes As UInt32, ByVal iLocation As Int32) As Int32
[DllImport(“icsneo40.dll”)] public static extern Int32 icsneoScriptLoad(IntPtr hObject, ref byte bin, UInt32 len_bytes, Int32 iLocation);

Parameters

hObject

[in] Specifies the driver object created by .

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. 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

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");
}
Int32 iResult;
UInt32 iLength=0;
byte[] CoreMiniData=new byte[1];

'//Helper function
iResult = GetCoreMiniData(ref CoreMiniData,ref iLength);

if(iResult != 1)
{
    MessageBox.Show("Problem Loading CoreMini");
    return;
}

iResult = icsNeoDll.icsneoScriptLoad(m_hObject,ref CoreMiniData[0], iLength, Convert.ToInt32(CoreMiniStoreLocation.SCRIPT_LOCATION_FLASH_MEM));

if(iResult == 0)
{
    lblCMStatus.Text = "CoreMini Not Loaded";
}
else
{
    lblCMStatus.Text = "CoreMini loaded into hardware";
}


//Helper function for reading the *.vs3cmbeMini file

private Int32 GetCoreMiniData(ref byte[] DataArray,ref UInt32 DataLength)
{
string sNameOfFile;
System.IO.FileStream ReadFileStream;
System.IO.BinaryReader ReadBinaryData;

    //Open file Dialog
    OpenFileDialog.ShowDialog();
    sNameOfFile = OpenFileDialog.FileName;
    // Check for the file to exist
    if(!System.IO.File.Exists(sNameOfFile)) return 0;
    //Read data in
    try
    {
        ReadFileStream = new System.IO.FileStream(sNameOfFile, System.IO.FileMode.Open);
        ReadBinaryData = new System.IO.BinaryReader(ReadFileStream);
        DataLength = Convert.ToUInt32(ReadFileStream.Length);
        DataArray = ReadBinaryData.ReadBytes(Convert.ToInt32(DataLength));
        ReadFileStream.Close();
        return 1;
    }
    catch(System.Exception ex)
    {
        return 0;
    }
}
Dim iResult As Int32
Dim iLength As UInt32
Dim CoreMiniData(1) As Byte

'//Helper function
iResult = GetCoreMiniData(CoreMiniData, iLength)

If iResult <> 1 Then MsgBox("Problem Loading CoreMini", MsgBoxStyle.OKOnly) : Exit Sub

Select Case iOpenDeviceType
    Case NEODEVICE_VCAN3
        iResult = icsneoScriptLoad(m_hObject, CoreMiniData(0), iLength, SCRIPT_LOCATION_VCAN3_MEM)
    Case NEODEVICE_FIRE
        iResult = icsneoScriptLoad(m_hObject, CoreMiniData(0), iLength, SCRIPT_LOCATION_FLASH_MEM)
    Case Else
        MsgBox("Hardware does not support CoreMini")
        iResult = 0
End Select

If iResult = 0 Then
    lblCMStatus.Text = "CoreMini Not Loaded"
Else
    lblCMStatus.Text = "CoreMini loaded into hardware"
End If

'//Helper function for reading the \*.vs3cmbeMini file
Private Function GetCoreMiniData(ByRef DataArray() As Byte, ByRef DataLength As UInt32) As Int32
Dim sNameOfFile As String
Dim ReadFileStream As IO.FileStream

'//Open file Dialog
OpenFileDialog.ShowDialog()
sNameOfFile = OpenFileDialog.FileName

'// Check for the file to exist
If Not IO.File.Exists(sNameOfFile) Then Return 0
'//get the data length
DataLength = Convert.ToUInt32(FileLen(sNameOfFile))
'//Read data in
Try
    ReadFileStream = New IO.FileStream(sNameOfFile, IO.FileMode.Open)
    Dim ReadBinaryData As New IO.BinaryReader(ReadFileStream)
    DataArray = ReadBinaryData.ReadBytes(Convert.ToInt32(DataLength))
    ReadFileStream.Close()
Catch ex As Exception
    ReadFileStream.Close()
    Return 0
End Try

Return 1
End Function

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 . 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.

OpenNeoDevice
GetLastAPIError
ScriptClear