sntlSetPersistenceDevice

Syntax

int sntlSetPersistenceDevice(	 	 
VLScpdPersistenceDeviceT 	 persistenceDevice,
VLScpdIfImpl   	 	*deviceIoImpl,
unsigned long 	 		*reserved1,
unsigned char 	 		*reserved2)

Argument

Direction

Data Type

Description

persistenceDevice

IN

VLScpdPersistenceDeviceT 

Enable or disable custom persistence device feature.

Allowed values are:

> VLS_CPD_NO_DEVICE (Disabled)

>VLS_CPD_CUSTOM_DEVICE (Use custom persistence device)

deviceIoImp

IN

VLScpdIfImpl

Structure for passing pointers to the implementation of call back functions by the developer. See Code Snippet section for a detailed description.

reserved1

 

unsigned long

Reserved for future use.

reserved2

 

unsigned char

Reserved for future use.

Description

This API initializes the client machine for using the custom persistence device interface in place of regular file system.

Returns

The status code VLS_CPD_SUCCESS is returned if successful. Otherwise, a specific status code is returned indicating the reason for failure. For a list of error codes, see System Initialization Error Codes.

Code Snippet

main()
{
VLScpdIfImpl cpdImpl;
/* Register the function pointer to callback API*/
   cpdImpl.szStruct           = sizeof(VLScpdIfImpl);		
   cpdImpl.implInitDevice     = &VLScpdInitializeDevice; 
   cpdImpl.implExitDevice     = &VLScpdExitDevice;
   cpdImpl.implCreateObject   = &VLScpdCreateObject;
   cpdImpl.implWriteRecord    = &VLScpdWriteRecord;
   cpdImpl.implReadRecord     = &VLScpdReadRecord;
   cpdImpl.implReadNextRecord = &VLScpdReadNextRecord;
   cpdImpl.implDeleteRecord   = &VLScpdDeleteRecord;

   /* Configure Sentinel RMS libraries in Custom Persistence Device mode
   /* Use VLS_CPD_NO_DEVICE to discard persistence data*/
   retCode = sntlSetPersistenceDevice(VLS_CPD_CUSTOM_DEVICE, &cpdImpl, NULL, NULL);
   if(retCode != 0)
   {
      printf("RMS Error: Failed to configure the custom device, api returned %d \n", retCode);
      return 1;
   }
   retCode = sntlInitStandaloneSystem("GUID", "featureName", "featureVersion");

} 

Steps to Perform

1.Include the custom persistence device header file lscpdif.h in your source code.

2.Define the implementation for Custom Persistence Device interface callback API.

3.Call the sntlSetPersistenceDevice API before calling any system initialization API.

4.Build the application.