Core

Overview

Provides OpenHarmony Driver Foundation (HDF) APIs.

The HDF implements driver framework capabilities such as driver loading, service management, and driver message model. You can develop drivers based on the HDF.

Since:

1.0

Summary

Files

File Name

Description

hdf_device_desc.h

Declares functions related to driver loading, service obtaining, and power management.

hdf_io_service_if.h

Declares the structures defining driver service objects and event listeners, as well as the functions for obtaining a driver service object, dispatching a driver service call, and registering or unregistering an event listener.

hdf_object.h

Declares the base object provided by the HDF for the driver.

hdf_sbuf.h

Defines functions related to a HdfSBuf. The HDF provides data serialization and deserialization capabilities for data transmission between user-mode applications and kernel-mode drivers.

Data Structures

Data Structure Name

Description

HdfDeviceObject

Defines the device object.

HdfDeviceIoClient

Defines the client object structure of the I/O service.

IDeviceIoService

Defines the driver service.

SubscriberCallback

Called when the driver subscribes to other driver services.

IPowerEventListener

Defines the power management functions provided by the HDF for the driver.

HdfDriverEntry

Defines the entry structure of the driver in the HDF.

HdfDevEventlistener

Defines a driver event listener object.

HdfIoDispatcher

Defines a driver service call dispatcher.

HdfIoService

Defines a driver service object.

HdfObject

Describes base class objects defined by the HDF.

HdfSBuf

Defines a HdfSBuf.

Macros

Macro Name and Value

Description

MAX_PRIORITY_NUM    200

The maximum priority for loading the host and device.

HDF_INIT(module)   HDF_DRIVER_INIT(module)

Registers the driver with the HDF.

Typedefs

Typedef Name

Description

OnEventReceived) (void priv, uint32_t id, struct HdfSBufdata)

typedef int(* 

Called when a driver event occurs.

Enumerations

Enumeration Name

Description

ServicePolicy {   SERVICE_POLICY_NONE = 0, SERVICE_POLICY_PUBLIC, SERVICE_POLICY_CAPACITY, SERVICE_POLICY_FRIENDLY,   SERVICE_POLICY_PRIVATE, SERVICE_POLICY_INVALID }

Enumerates policies for releasing driver services developed based on the HDF.

DevicePreload { DEVICE_PRELOAD_ENABLE = 0, DEVICE_PRELOAD_DISABLE, DEVICE_PRELOAD_INVALID }

Enumerates driver loading policies.

Functions

Function Name

Description

DevSvcManagerClntGetService (const char svcName)

const struct HdfObject  

Obtains the driver service object based on a driver service name.

HdfDeviceGetServiceName (const struct HdfDeviceObjectdeviceObject)

const char  

Obtains the service name of a driver.

HdfDeviceSubscribeService (struct HdfDeviceObjectdeviceObject, const char serviceName, struct SubscriberCallback callback)

int32_t 

Subscribes to a driver service.

HdfDeviceSendEvent (const struct HdfDeviceObjectdeviceObject, uint32_t id, const struct HdfSBufdata)

int32_t 

Sends event messages.

HdfDeviceSendEventToClient (const struct HdfDeviceIoClientclient, uint32_t id, const struct HdfSBufdata)

int32_t 

Sends an event message to a specified client object.

HdfIoServiceBind (const char serviceName, mode_t permission)

struct HdfIoService  

Obtains a driver service object.

HdfIoServiceRecycle (struct HdfIoServiceservice)

void 

Destroys a specified driver service object to release resources if it is no longer required.

HdfDeviceRegisterEventListener (struct HdfIoService target, struct HdfDevEventlistenerlistener)

int 

Registers a custom HdfDevEventlistener for listening for events reported by a specified driver service object.

HdfDeviceUnregisterEventListener (struct HdfIoService target, struct HdfDevEventlistenerlistener)

int 

Unregisters a previously registered HdfDevEventlistener to release resources if it is no longer required.

HdfSbufWriteBuffer (struct HdfSBuf sbuf, const void data, uint32_t writeSize)

bool 

Writes a data segment to a SBuf.

HdfSbufWriteUint64 (struct HdfSBuf sbuf, uint64_t value)

bool 

Writes a 64-bit unsigned integer to a SBuf.

HdfSbufWriteUint32 (struct HdfSBufsbuf, uint32_t value)

bool 

Writes a 32-bit unsigned integer to a SBuf.

HdfSbufWriteUint16 (struct HdfSBuf sbuf, uint16_t value)

bool 

Writes a 16-bit unsigned integer to a SBuf.

HdfSbufWriteUint8 (struct HdfSBufsbuf, uint8_t value)

bool 

Writes an 8-bit unsigned integer to a SBuf.

HdfSbufWriteInt64 (struct HdfSBuf sbuf, int64_t value)

bool 

Writes a 64-bit signed integer to a SBuf.

HdfSbufWriteInt32 (struct HdfSBufsbuf, int32_t value)

bool 

Writes a 32-bit signed integer to a SBuf.

HdfSbufWriteInt16 (struct HdfSBuf sbuf, int16_t value)

bool 

Writes a 16-bit signed integer to a SBuf.

HdfSbufWriteInt8 (struct HdfSBufsbuf, int8_t value)

bool 

Writes an 8-bit signed integer to a SBuf.

HdfSbufWriteString (struct HdfSBuf sbuf, const char value)

bool 

Writes a string to a SBuf.

HdfSbufReadBuffer (struct HdfSBuf sbuf, const void *data, uint32_t readSize)

bool 

Reads a data segment from a SBuf.

HdfSbufReadUint64 (struct HdfSBufsbuf, uint64_t value)

bool 

Reads a 64-bit unsigned integer from a SBuf.

HdfSbufReadUint32 (struct HdfSBufsbuf, uint32_t value)

bool 

Reads a 32-bit unsigned integer from a SBuf.

HdfSbufReadUint16 (struct HdfSBufsbuf, uint16_t value)

bool 

Reads a 16-bit unsigned integer from a SBuf.

HdfSbufReadUint8 (struct HdfSBufsbuf, uint8_t value)

bool 

Reads an 8-bit unsigned integer from a SBuf.

HdfSbufReadInt64 (struct HdfSBufsbuf, int64_t value)

bool 

Reads a 64-bit signed integer from a SBuf.

HdfSbufReadInt32 (struct HdfSBufsbuf, int32_t value)

bool 

Reads a 32-bit signed integer from a SBuf.

HdfSbufReadInt16 (struct HdfSBufsbuf, int16_t value)

bool 

Reads a 16-bit signed integer from a SBuf.

HdfSbufReadInt8 (struct HdfSBufsbuf, int8_t value)

bool 

Reads an 8-bit signed integer from a SBuf.

HdfSbufReadString (struct HdfSBufsbuf)

const char  

Reads a string from a SBuf.

HdfSbufGetData (const struct HdfSBufsbuf)

uint8_t  

Obtains the pointer to the data stored in aSBuf.

HdfSbufFlush (struct HdfSBufsbuf)

void 

Clears the data stored in a SBuf.

HdfSbufGetCapacity (const struct HdfSBuf sbuf)

size_t 

Obtains the capacity of a SBuf.

HdfSbufGetDataSize (const struct HdfSBufsbuf)

size_t 

Obtains the size of the data stored in a SBuf.

HdfSBufObtain (size_t capacity)

struct HdfSBuf  

Obtains a SBuf instance.

HdfSBufObtainDefaultSize (void)

struct HdfSBuf 

Obtains a SBuf instance of the default capacity (256 bytes).

HdfSBufBind (uintptr_t base, size_t size)

struct HdfSBuf  

Creates a SBuf instance with the specified data and size. The pointer to the data stored in the SBuf is released by the caller, and the written data size should not exceed the specified value of size.

HdfSBufRecycle (struct HdfSBufsbuf)

void 

Releases a SBuf .

HdfSBufMove (struct HdfSBuf sbuf)

struct HdfSBuf 

Creates a SBuf instance with an original SBuf. This function moves the data stored in the original SBuf to the new one without memory copy.

HdfSBufCopy (const struct HdfSBuf sbuf)

struct HdfSBuf 

Creates a SBuf instance with an original SBuf. This function copies the data stored in the original SBuf to the new one.

HdfSbufTransDataOwnership (struct HdfSBuf sbuf)

void 

Transfers the data ownership to a SBuf. Once the SBuf is released, the bound data memory is also released. This function is used together with HdfSBufBind.

Details

Macro Definition Documentation

HDF_INIT

  1. #define HDF_INIT(module) HDF_DRIVER_INIT(module)

Description:

Registers the driver with the HDF.

For a driver developed based on the HDF, HDF_INIT must be used to register an entry with the HDF, and the registered object must be of the HdfDriverEntry type.

Parameters:

Name

Description

moduleIndicates the global variable of the HdfDriverEntry type

Typedef Documentation

OnEventReceived

  1. typedefint(*OnEventReceived)(void*priv,uint32_t id,struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)*data)

Description:

Called when a driver event occurs.

You can implement this function and bind it to the custom HdfDevEventlistener object.

Parameters:

Name

Description

privIndicates the pointer to the private data bound to this listener.
idIndicates the serial number of the driver event occurred.
dataIndicates the pointer to the content data of the driver event.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

Enumeration Type Documentation

DevicePreload

  1. enum[DevicePreload]($api-api-SmartVision-Devices-Core.md#ga0f3d81b5ff5d3896f7d8cf15f76b451e)

Description:

Enumerates driver loading policies.

If a driver developed based on the HDF needs to use the on-demand loading mechanism in the HDF, the PRELOAD field must be correctly set in the driver configuration information to control the driver loading mode.

Enumerator

Description

DEVICE_PRELOAD_ENABLE 

The driver is loaded during system startup by default.

DEVICE_PRELOAD_DISABLE 

The driver is not loaded during system startup by default.

DEVICE_PRELOAD_INVALID 

The loading policy is incorrect.

ServicePolicy

  1. enum[ServicePolicy]($api-api-SmartVision-Devices-Core.md#ga172844da8a6908bf7226eee703ad9f80)

Description:

Enumerates policies for releasing driver services developed based on the HDF.

If a driver is developed based on the HDF and uses the service management feature of the HDF, you need to configure the policy for releasing services to external systems.

Enumerator

Description

SERVICE_POLICY_NONE 

The driver does not provide services externally.

SERVICE_POLICY_PUBLIC 

The driver provides services for kernel-level applications.

SERVICE_POLICY_CAPACITY 

The driver provides services for both kernel- and user-level applications.

SERVICE_POLICY_FRIENDLY 

Driver services are not released externally but can be subscribed to.

SERVICE_POLICY_PRIVATE 

Driver services are only internally available. They are not released externally and cannot be subscribed to by external users.

SERVICE_POLICY_INVALID 

The service policy is incorrect.

Function Documentation

DevSvcManagerClntGetService()

  1. conststruct[HdfObject]($api-api-SmartVision-Devices-HdfObject.md)*DevSvcManagerClntGetService(constchar* svcName)

Description:

Obtains the driver service object based on a driver service name.

Parameters:

Name

Description

serviceNameIndicates the pointer to the released driver service name.

Returns:

Returns the driver service object if the operation is successful; returns NULL otherwise.

HdfDeviceGetServiceName()

  1. constchar*HdfDeviceGetServiceName(conststruct[HdfDeviceObject]($api-api-SmartVision-Devices-HdfDeviceObject.md)* deviceObject)

Description:

Obtains the service name of a driver.

If a driver does not save its service name, it can use this function to obtain the service name.

Parameters:

Name

Description

deviceObjectIndicates the pointer to the driver device object.

Returns:

Returns the service name if the operation is successful; returns NULL otherwise.

HdfDeviceRegisterEventListener()

  1. intHdfDeviceRegisterEventListener(struct[HdfIoService]($api-api-SmartVision-Devices-HdfIoService.md)* target,struct[HdfDevEventlistener]($api-api-SmartVision-Devices-HdfDevEventlistener.md)* listener )

Description:

Registers a custom HdfDevEventlistener for listening for events reported by a specified driver service object.

Parameters:

Name

Description

targetIndicates the pointer to the driver service object to listen, which is obtained through the HdfIoServiceBind function.
listenerIndicates the pointer to the listener to register.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

HdfDeviceSendEvent()

  1. int32_tHdfDeviceSendEvent(conststruct[HdfDeviceObject]($api-api-SmartVision-Devices-HdfDeviceObject.md)* deviceObject,uint32_t id,conststruct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* data )

Description:

Sends event messages.

When the driver service invokes this function to send a message, all user-level applications that have registered listeners through HdfDeviceRegisterEventListener will receive the message.

Parameters:

Name

Description

deviceObjectIndicates the pointer to the driver device object.
idIndicates the ID of the message sending event.
dataIndicates the pointer to the message content sent by the driver.

Returns:

Returns 0 if the operation is successful; returns a non-zero value otherwise.

HdfDeviceSendEventToClient()

  1. int32_tHdfDeviceSendEventToClient(conststruct[HdfDeviceIoClient]($api-api-SmartVision-Devices-HdfDeviceIoClient.md)* client,uint32_t id,conststruct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* data )

Description:

Sends an event message to a specified client object.

When the driver service invokes this function to send a message, the user-level applications that have registered listeners through HdfDeviceRegisterEventListener and correspond to this client object will receive the message.

Parameters:

Name

Description

clientIndicates the pointer to the client object of the driver service.
idIndicates the ID of the message sending event.
dataIndicates the pointer to the message content sent by the driver.

Returns:

Returns 0 if the operation is successful; returns a non-zero value otherwise.

HdfDeviceSubscribeService()

  1. int32_tHdfDeviceSubscribeService(struct[HdfDeviceObject]($api-api-SmartVision-Devices-HdfDeviceObject.md)* deviceObject,constchar* serviceName,struct[SubscriberCallback]($api-api-SmartVision-Devices-SubscriberCallback.md) callback )

Description:

Subscribes to a driver service.

If the driver loading time is not perceived, this function can be used to subscribe to the driver service. (The driver service and the subscriber must be on the same host.) After the subscribed-to driver service is loaded by the HDF, the framework proactively releases the service interface to the subscriber.

Parameters:

Name

Description

deviceObjectIndicates the pointer to the driver device object of the subscriber.
serviceNameIndicates the pointer to the driver service name.
callbackIndicates the callback invoked by the HDF after the subscribed-to driver service is loaded.

Returns:

Returns 0 if the operation is successful; returns a non-zero value otherwise.

HdfDeviceUnregisterEventListener()

  1. intHdfDeviceUnregisterEventListener(struct[HdfIoService]($api-api-SmartVision-Devices-HdfIoService.md)* target,struct[HdfDevEventlistener]($api-api-SmartVision-Devices-HdfDevEventlistener.md)* listener )

Description:

Unregisters a previously registered HdfDevEventlistener to release resources if it is no longer required.

Parameters:

Name

Description

targetIndicates the pointer to the driver service object that has been listened.
listenerIndicates the listener object registered by HdfDeviceRegisterEventListener.

Returns:

Returns 0 if the operation is successful; returns a negative value otherwise.

HdfIoServiceBind()

  1. struct[HdfIoService]($api-api-SmartVision-Devices-HdfIoService.md)*HdfIoServiceBind(constchar* serviceName,mode_t permission )

Description:

Obtains a driver service object.

Parameters:

Name

Description

serviceNameIndicates the pointer to the name of the service to obtain.
permissionIndicates the permission to create device nodes. The default value 0 can be used when this function is called from user space.

Returns:

Returns the pointer to the driver service object if the operation is successful; returns NULL otherwise.

HdfIoServiceRecycle()

  1. voidHdfIoServiceRecycle(struct[HdfIoService]($api-api-SmartVision-Devices-HdfIoService.md)* service)

Description:

Destroys a specified driver service object to release resources if it is no longer required.

Parameters:

Name

Description

serviceIndicates the pointer to the driver service object to destroy.

HdfSBufBind()

  1. struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)*HdfSBufBind(uintptr_tbase,size_t size )

Description:

Creates a SBuf instance with the specified data and size. The pointer to the data stored in the SBuf is released by the caller, and the written data size should not exceed the specified value of size.

Parameters:

Name

Description

baseIndicates the base of the data to use.
sizeIndicates the size of the data to use.

Returns:

Returns the SBuf instance.

HdfSBufCopy()

  1. struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)*HdfSBufCopy(conststruct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf)

Description:

Creates a SBuf instance with an original SBuf. This function copies the data stored in the original SBuf to the new one.

Parameters:

Name

Description

sbufIndicates the pointer to the original SBuf.

Returns:

Returns the new SBuf instance.

HdfSbufFlush()

  1. voidHdfSbufFlush(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf)

Description:

Clears the data stored in a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.

HdfSbufGetCapacity()

  1. size_tHdfSbufGetCapacity(conststruct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf)

Description:

Obtains the capacity of a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.

Returns:

Returns the SBuf capacity.

HdfSbufGetData()

  1. uint8_t*HdfSbufGetData(conststruct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf)

Description:

Obtains the pointer to the data stored in aSBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.

Returns:

Returns the pointer to the data stored in the target SBuf.

HdfSbufGetDataSize()

  1. size_tHdfSbufGetDataSize(conststruct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf)

Description:

Obtains the size of the data stored in a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.

Returns:

Returns the data size.

HdfSBufMove()

  1. struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)*HdfSBufMove(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf)

Description:

Creates a SBuf instance with an original SBuf. This function moves the data stored in the original SBuf to the new one without memory copy.

Parameters:

Name

Description

sbufIndicates the pointer to the original SBuf.

Returns:

Returns the new SBuf instance.

HdfSBufObtain()

  1. struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)*HdfSBufObtain(size_t capacity)

Description:

Obtains a SBuf instance.

Parameters:

Name

Description

capacityIndicates the initial capacity of theSBuf.

Returns:

Returns the SBuf instance.

HdfSBufObtainDefaultSize()

  1. struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)*HdfSBufObtainDefaultSize(void)

Description:

Obtains a SBuf instance of the default capacity (256 bytes).

Returns:

Returns the SBuf instance.

HdfSbufReadBuffer()

  1. boolHdfSbufReadBuffer(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,constvoid** data,uint32_t* readSize )

Description:

Reads a data segment from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
dataIndicates the double pointer to the data read. The data read is stored in data, which is requested by the caller. The memory pointed to by data is managed by the SBuf and they share the same lifecycle.
readSizeIndicates the pointer to the size of the data read.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufReadInt16()

  1. boolHdfSbufReadInt16(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,int16_t* value )

Description:

Reads a 16-bit signed integer from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the pointer to the 16-bit signed integer read, which is requested by the caller.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufReadInt32()

  1. boolHdfSbufReadInt32(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,int32_t* value )

Description:

Reads a 32-bit signed integer from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the pointer to the 32-bit signed integer read, which is requested by the caller.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufReadInt64()

  1. boolHdfSbufReadInt64(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,int64_t* value )

Description:

Reads a 64-bit signed integer from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the pointer to the 64-bit signed integer read, which is requested by the caller.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufReadInt8()

  1. boolHdfSbufReadInt8(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,int8_t* value )

Description:

Reads an 8-bit signed integer from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the pointer to the 8-bit signed integer read, which is requested by the caller.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufReadString()

  1. constchar*HdfSbufReadString(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf)

Description:

Reads a string from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.

Returns:

Returns the pointer to the string read if the operation is successful; returns NULL otherwise. The memory pointed to by this pointer is managed by the SBuf and they share the same lifecycle.

HdfSbufReadUint16()

  1. boolHdfSbufReadUint16(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,uint16_t* value )

Description:

Reads a 16-bit unsigned integer from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the pointer to the 16-bit unsigned integer read, which is requested by the caller.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufReadUint32()

  1. boolHdfSbufReadUint32(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,uint32_t* value )

Description:

Reads a 32-bit unsigned integer from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the pointer to the 32-bit unsigned integer read, which is requested by the caller.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufReadUint64()

  1. boolHdfSbufReadUint64(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,uint64_t* value )

Description:

Reads a 64-bit unsigned integer from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the pointer to the 64-bit unsigned integer read, which is requested by the caller.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufReadUint8()

  1. boolHdfSbufReadUint8(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,uint8_t* value )

Description:

Reads an 8-bit unsigned integer from a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the pointer to the 8-bit unsigned integer read, which is requested by the caller.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSBufRecycle()

  1. voidHdfSBufRecycle(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf)

Description:

Releases a SBuf .

Parameters:

Name

Description

sbufIndicates the pointer to the SBuf to release.

HdfSbufTransDataOwnership()

  1. voidHdfSbufTransDataOwnership(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf)

Description:

Transfers the data ownership to a SBuf. Once the SBuf is released, the bound data memory is also released. This function is used together with HdfSBufBind.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.

HdfSbufWriteBuffer()

  1. boolHdfSbufWriteBuffer(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,constvoid* data,uint32_t writeSize )

Description:

Writes a data segment to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
dataIndicates the pointer to the data segment to write.
writeSizeIndicates the size of the data segment to write. The maximum value is 512 KB.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufWriteInt16()

  1. boolHdfSbufWriteInt16(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,int16_t value )

Description:

Writes a 16-bit signed integer to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the 16-bit signed integer to write.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufWriteInt32()

  1. boolHdfSbufWriteInt32(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,int32_t value )

Description:

Writes a 32-bit signed integer to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the 32-bit signed integer to write.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufWriteInt64()

  1. boolHdfSbufWriteInt64(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,int64_t value )

Description:

Writes a 64-bit signed integer to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the 64-bit signed integer to write.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufWriteInt8()

  1. boolHdfSbufWriteInt8(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,int8_t value )

Description:

Writes an 8-bit signed integer to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the 8-bit signed integer to write.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufWriteString()

  1. boolHdfSbufWriteString(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,constchar* value )

Description:

Writes a string to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the pointer to the string to write.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufWriteUint16()

  1. boolHdfSbufWriteUint16(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,uint16_t value )

Description:

Writes a 16-bit unsigned integer to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the 16-bit unsigned integer to write.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufWriteUint32()

  1. boolHdfSbufWriteUint32(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,uint32_t value )

Description:

Writes a 32-bit unsigned integer to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the 32-bit unsigned integer to write.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufWriteUint64()

  1. boolHdfSbufWriteUint64(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,uint64_t value )

Description:

Writes a 64-bit unsigned integer to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the 64-bit unsigned integer to write.

Returns:

Returns true if the operation is successful; returns false otherwise.

HdfSbufWriteUint8()

  1. boolHdfSbufWriteUint8(struct[HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* sbuf,uint8_t value )

Description:

Writes an 8-bit unsigned integer to a SBuf.

Parameters:

Name

Description

sbufIndicates the pointer to the target SBuf.
valueIndicates the 8-bit unsigned integer to write.

Returns:

Returns true if the operation is successful; returns false otherwise.