目录

sharekit_api.h

File Info

sharekit_api.h

API definition file.

Method Summary

Return Type

Method Name

int

InitShareKit(void* handle)

Initializes the Share Engine running environment.

int

UnInitShareKit(void)

Releases system resources.

int

StartShareService(ShareRole role, void* handle)

Enables the Huawei Share service.

int

StopShareService(void)

Disables the Huawei Share service.

int

GetAvailableDevice(ShareDeviceInfo** devInfo, int* devNum)

Searches for available devices.

Int

TransFile(const ShareDeviceInfo* device, const ShareFileInfo* files)

Sends files.

void

CancelTransFile(void)

Cancels file sending.

int

ConfirmRecvFile(char *path)

Accepts the file transfer request.

void

RefuseRecvFile(void)

Rejects file receiving.

Public Methods

[h2]InitShareKit

Method

int InitShareKit(void* handle)

Starts the request for initializing device resources for Share Engine.

Parameters

Method Name

Parameter Description

handle

  • void * type
  • Extended parameter, which is not used currently.

Return

Type

Description

int

0: Initialization is successful. -1: Initialization fails.

[h2]UnInitShareKit

Method

int UninitShareKit(void)

Releases system resources occupied by Share Engine.

Return

Type

Description

int

0: Release is successful. -1: Release fails.

[h2]StartShareService

Method

int StartShareService(ShareRole role, void* handle)

Starts the Huawei Share service so that Huawei phones can share files with the device using Huawei Share.

Parameters

Method Name

Parameter Description

role

Role in the share action: sender or receiver.

handle

  • void * type
  • Callback function of the Huawei Share service.

Return

Type

Description

int

0: Service is enabled. -1: Service fails to be enabled.

[h2]StopShareService

Method

int StopShareService (void)

Disables the Huawei Share service.

Return

Type

Description

int

0: Service is disabled. -1: Service fails to be disabled.

[h2]GetAvailableDevice

Method

int GetAvailableDevice(ShareDeviceInfo** devInfo, int* devNum)

Discovers available devices in close proximity using BLE advertising.

Parameters

Method Name

Parameter Description

devInfo

Output parameter: devices that have been found.

devNum

Output parameter: number of found devices.

Return

Type

Description

Int

0: Devices are obtained. -1: Failed to obtain devices.

[h2]TransFile

Method

int TransFile(const ShareDeviceInfo* device, const ShareFileInfo* files)

Selects a connected device to share specific files with it.

Parameters

Method Name

Parameter Description

device

Information about the receiving device, such as its MAC address.

files

Information about the files to share.

Return

Type

Description

Int

0: Request is rejected. -1: Failed to reject the request.

[h2]CancelTransFile

Method

void CancelTransFile(void)

Cancels sending.

[h2]ConfirmRecvFile

Method

int ConfirmFileRecv(char *path)

Instructs Share Engine to receive files and store them to the specified path, after the user chooses to accept the file transfer request.

Parameters

Method Name

Parameter Description

path

File storage path.

Return

Type

Description

int

0: Connection is successful. -1: Connection fails.

[h2]RefuseRecvFile

Method

void RefuseRecvFile(void)

Sends a reject notification after the user chooses to reject the file transfer request.