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 HdfSBuf data)

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 HdfDeviceObject deviceObject)

const char  

Obtains the service name of a driver.

HdfDeviceSubscribeService (struct HdfDeviceObject deviceObject, const char serviceName, struct SubscriberCallback callback)

int32_t 

Subscribes to a driver service.

HdfDeviceSendEvent (const struct HdfDeviceObject deviceObject, uint32_t id, const struct HdfSBuf data)

int32_t 

Sends event messages.

HdfDeviceSendEventToClient (const struct HdfDeviceIoClient client, uint32_t id, const struct HdfSBuf data)

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 HdfIoService service)

void 

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

HdfDeviceRegisterEventListener (struct HdfIoService target, struct HdfDevEventlistener listener)

int 

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

HdfDeviceUnregisterEventListener (struct HdfIoService target, struct HdfDevEventlistener listener)

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 HdfSBuf sbuf, 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 HdfSBuf sbuf, 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 HdfSBuf sbuf, 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 HdfSBuf sbuf, 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 HdfSBuf sbuf, uint64_t value)

bool 

Reads a 64-bit unsigned integer from a SBuf.

HdfSbufReadUint32 (struct HdfSBuf sbuf, uint32_t value)

bool 

Reads a 32-bit unsigned integer from a SBuf.

HdfSbufReadUint16 (struct HdfSBuf sbuf, uint16_t value)

bool 

Reads a 16-bit unsigned integer from a SBuf.

HdfSbufReadUint8 (struct HdfSBuf sbuf, uint8_t value)

bool 

Reads an 8-bit unsigned integer from a SBuf.

HdfSbufReadInt64 (struct HdfSBuf sbuf, int64_t value)

bool 

Reads a 64-bit signed integer from a SBuf.

HdfSbufReadInt32 (struct HdfSBuf sbuf, int32_t value)

bool 

Reads a 32-bit signed integer from a SBuf.

HdfSbufReadInt16 (struct HdfSBuf sbuf, int16_t value)

bool 

Reads a 16-bit signed integer from a SBuf.

HdfSbufReadInt8 (struct HdfSBuf sbuf, int8_t value)

bool 

Reads an 8-bit signed integer from a SBuf.

HdfSbufReadString (struct HdfSBuf sbuf)

const char  

Reads a string from a SBuf.

HdfSbufGetData (const struct HdfSBuf sbuf)

uint8_t  

Obtains the pointer to the data stored in aSBuf.

HdfSbufFlush (struct HdfSBuf sbuf)

void 

Clears the data stored in a SBuf.

HdfSbufGetCapacity (const struct HdfSBuf sbuf)

size_t 

Obtains the capacity of a SBuf.

HdfSbufGetDataSize (const struct HdfSBuf sbuf)

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 HdfSBuf sbuf)

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

module Indicates the global variable of the HdfDriverEntry type

Typedef Documentation

OnEventReceived

  1. typedef int(* 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

priv Indicates the pointer to the private data bound to this listener.
id Indicates the serial number of the driver event occurred.
data Indicates 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. const struct [HdfObject]($api-api-SmartVision-Devices-HdfObject.md)* DevSvcManagerClntGetService (const char * svcName)

Description:

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

Parameters:

Name

Description

serviceName Indicates the pointer to the released driver service name.

Returns:

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

HdfDeviceGetServiceName()

  1. const char* HdfDeviceGetServiceName (const struct [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

deviceObject Indicates the pointer to the driver device object.

Returns:

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

HdfDeviceRegisterEventListener()

  1. int HdfDeviceRegisterEventListener (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

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

Returns:

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

HdfDeviceSendEvent()

  1. int32_t HdfDeviceSendEvent (const struct [HdfDeviceObject]($api-api-SmartVision-Devices-HdfDeviceObject.md) * deviceObject, uint32_t id, const struct [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

deviceObject Indicates the pointer to the driver device object.
id Indicates the ID of the message sending event.
data Indicates 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_t HdfDeviceSendEventToClient (const struct [HdfDeviceIoClient]($api-api-SmartVision-Devices-HdfDeviceIoClient.md) * client, uint32_t id, const struct [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

client Indicates the pointer to the client object of the driver service.
id Indicates the ID of the message sending event.
data Indicates 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_t HdfDeviceSubscribeService (struct [HdfDeviceObject]($api-api-SmartVision-Devices-HdfDeviceObject.md) * deviceObject, const char * 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

deviceObject Indicates the pointer to the driver device object of the subscriber.
serviceName Indicates the pointer to the driver service name.
callback Indicates 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. int HdfDeviceUnregisterEventListener (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

target Indicates the pointer to the driver service object that has been listened.
listener Indicates 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 (const char * serviceName, mode_t permission )

Description:

Obtains a driver service object.

Parameters:

Name

Description

serviceName Indicates the pointer to the name of the service to obtain.
permission Indicates 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. void HdfIoServiceRecycle (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

service Indicates the pointer to the driver service object to destroy.

HdfSBufBind()

  1. struct [HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* HdfSBufBind (uintptr_t base, 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

base Indicates the base of the data to use.
size Indicates the size of the data to use.

Returns:

Returns the SBuf instance.

HdfSBufCopy()

  1. struct [HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md)* HdfSBufCopy (const struct [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

sbuf Indicates the pointer to the original SBuf.

Returns:

Returns the new SBuf instance.

HdfSbufFlush()

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

Description:

Clears the data stored in a SBuf.

Parameters:

Name

Description

sbuf Indicates the pointer to the target SBuf.

HdfSbufGetCapacity()

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

Description:

Obtains the capacity of a SBuf.

Parameters:

Name

Description

sbuf Indicates the pointer to the target SBuf.

Returns:

Returns the SBuf capacity.

HdfSbufGetData()

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

Description:

Obtains the pointer to the data stored in aSBuf.

Parameters:

Name

Description

sbuf Indicates the pointer to the target SBuf.

Returns:

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

HdfSbufGetDataSize()

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

Description:

Obtains the size of the data stored in a SBuf.

Parameters:

Name

Description

sbuf Indicates 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

sbuf Indicates 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

capacity Indicates 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. bool HdfSbufReadBuffer (struct [HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md) * sbuf, const void ** data, uint32_t * readSize )

Description:

Reads a data segment from a SBuf.

Parameters:

Name

Description

sbuf Indicates the pointer to the target SBuf.
data Indicates 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.
readSize Indicates the pointer to the size of the data read.

Returns:

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

HdfSbufReadInt16()

  1. bool HdfSbufReadInt16 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates 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. bool HdfSbufReadInt32 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates 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. bool HdfSbufReadInt64 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates 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. bool HdfSbufReadInt8 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates 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. const char* HdfSbufReadString (struct [HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md) * sbuf)

Description:

Reads a string from a SBuf.

Parameters:

Name

Description

sbuf Indicates 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. bool HdfSbufReadUint16 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates 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. bool HdfSbufReadUint32 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates 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. bool HdfSbufReadUint64 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates 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. bool HdfSbufReadUint8 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates 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. void HdfSBufRecycle (struct [HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md) * sbuf)

Description:

Releases a SBuf .

Parameters:

Name

Description

sbuf Indicates the pointer to the SBuf to release.

HdfSbufTransDataOwnership()

  1. void HdfSbufTransDataOwnership (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

sbuf Indicates the pointer to the target SBuf.

HdfSbufWriteBuffer()

  1. bool HdfSbufWriteBuffer (struct [HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md) * sbuf, const void * data, uint32_t writeSize )

Description:

Writes a data segment to a SBuf.

Parameters:

Name

Description

sbuf Indicates the pointer to the target SBuf.
data Indicates the pointer to the data segment to write.
writeSize Indicates 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. bool HdfSbufWriteInt16 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates the 16-bit signed integer to write.

Returns:

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

HdfSbufWriteInt32()

  1. bool HdfSbufWriteInt32 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates the 32-bit signed integer to write.

Returns:

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

HdfSbufWriteInt64()

  1. bool HdfSbufWriteInt64 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates the 64-bit signed integer to write.

Returns:

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

HdfSbufWriteInt8()

  1. bool HdfSbufWriteInt8 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates the 8-bit signed integer to write.

Returns:

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

HdfSbufWriteString()

  1. bool HdfSbufWriteString (struct [HdfSBuf]($api-api-SmartVision-Devices-HdfSBuf.md) * sbuf, const char * value )

Description:

Writes a string to a SBuf.

Parameters:

Name

Description

sbuf Indicates the pointer to the target SBuf.
value Indicates the pointer to the string to write.

Returns:

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

HdfSbufWriteUint16()

  1. bool HdfSbufWriteUint16 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates the 16-bit unsigned integer to write.

Returns:

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

HdfSbufWriteUint32()

  1. bool HdfSbufWriteUint32 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates the 32-bit unsigned integer to write.

Returns:

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

HdfSbufWriteUint64()

  1. bool HdfSbufWriteUint64 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates the 64-bit unsigned integer to write.

Returns:

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

HdfSbufWriteUint8()

  1. bool HdfSbufWriteUint8 (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

sbuf Indicates the pointer to the target SBuf.
value Indicates the 8-bit unsigned integer to write.

Returns:

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