Discusiones sobre Productos NI

cancelar
Mostrando los resultados de 
Buscar en lugar de 
Quiere decir: 

configuration store IVI

Hola muchachos.
 
Alguien me puede ayudar con la configuration store.
 
Tengo el siguiente codigo
 

#include

"stdafx.h"

#import

"IviConfigServer.dll"

using

namespace IVICONFIGSERVERLib;

int

main(int argc, char* argv[])

{

HRESULT hr;

hr = CoInitialize(NULL);

if

(FAILED(hr))

exit(1);

{

IIviConfigStorePtr cs(

__uuidof(IviConfigStore));

try

{

// Deserialize the master configuration store.

cs->Deserialize(cs->MasterLocation);

try

{

// Create an empty Hardware Asset

IIviHardwareAssetPtr ha(

__uuidof(IviHardwareAsset));

//Set its properties

ha->Name = _bstr_t("Multimeter");

ha->Description = _bstr_t("Multimeter connected to the switch");

ha->IOResourceDescriptor = _bstr_t("GPIB::22::INSTR");

// Add it to the global hardware asset collection

printf("hasta aqui");

cs->HardwareAssets->Add(ha);

}

catch (_com_error e) {

printf("Add HardwareAsset failed.\n");

printf("Error description is: %s\n",(

char*)e.Description());

getchar();

}

try

{

// Create an empty DriverSession

IIviDriverSessionPtr ds(

__uuidof(IviDriverSession));

// Set its properties

ds->Name = _bstr_t("Crack");

ds->Description = _bstr_t("DriverSession for the system multimeter");

ds->Cache =

true;

ds->InterchangeCheck =

false;

ds->QueryInstrStatus =

false;

ds->RangeCheck =

true;

ds->RecordCoercions =

false;

ds->Simulate =

false;

ds->DriverSetup = _bstr_t("");

// Add the HardwareAsset reference to the Session

ds->HardwareAsset = cs->HardwareAssets->Item["Crack"];

// Add the SoftwareModule reference to the Session.

printf("hasta aqui");

ds->SoftwareModule = cs->SoftwareModules->Item["Crack"];

// Add it to the global driver session collection

cs->DriverSessions->Add(ds);

}

catch (_com_error e) {

printf("Add DriverSession failed.\n");

printf("Error description is: %s\n",(

char*)e.Description());

getchar();

}

try

{

// Create the Logical Name

IIviLogicalNamePtr ln(

__uuidof(IviLogicalName));

// Set its properties

ln->Name = _bstr_t("DMM");

ln->Description = _bstr_t("The name used in the test program");

ln->Session = cs->Sessions->Item["Crack"];

// Add it to the global logical name collection

cs->LogicalNames->Add(ln);

}

catch (_com_error e) {

printf("Add LogicalName failed.\n");

printf("Error description is: %s\n",(

char*)e.Description());

getchar();

}

// Overwrite the master with the modified configuration store

try

{

cs->Serialize(cs->MasterLocation);

}

catch (_com_error e) {

printf("Serialize failed.\n");

printf("Error description is: %s\n",(

char*)e.Description());

getchar();

}

}

catch (_com_error e) {

printf("Deserialize failed.\n");

printf("Error description is: %s\n",(

char*)e.Description());

getchar();

}

}

CoUninitialize();

return

0;

}

 

 

El resultado que me da por pantalla es:

hasta aquiAdd HardwareAsset failed.
Error description is: IviConfigServer.IviHardwareAssetCollection.1: Add failed.
 Multimeter already exists in the collection or it has already been owned by ano
ther collection.

hasta aquiAdd DriverSession failed.
Error description is: IviConfigServer.IviSoftwareModuleCollection.1: get_Item fa
iled.  Crack does not exist in the collection.

Add LogicalName failed.
Error description is: IviConfigServer.IviSessionCollection.1: get_Item failed.
Crack does not exist in the collection.

 

Realmente no tengo ningun intrumento aun en red: NO se si ese puede ser el problema, aunque entiendo que para el config server deberia de dar igual ya que es un paso previo a la conexion.

 

Otra duda que tengo es que es exactamente el SoftwareModule, me refiero a si es algo dependiente de cada instrumento o es algo que "pone" el config server

 

Espero vuestra ayuda y si m podeis aclarar si ustedes conseguis que este software funcione decidme como porfavor..

 

Saludos y gracias

0 kudos
Mensaje 1 de 1
3.878 Vistas