1
0
Fork 0
phizclip-desktop-demo/vendor/finclip/include/finclip_api.h

395 lines
9.7 KiB
C
Raw Normal View History

2021-11-18 22:25:15 +08:00
#ifndef __H_FINCLIP_WRAPPER_API_H__
#define __H_FINCLIP_WRAPPER_API_H__
#ifdef _WIN32
# ifndef FINSTDMETHODCALLTYPE
# define FINSTDMETHODCALLTYPE __stdcall
# define DLL_EXPORT _declspec(dllexport)
# endif
#else
# define FINSTDMETHODCALLTYPE
# define DLL_EXPORT
#endif
#define FIN_SID const char*
#define FIN_OK 0
#define FIN_FAIL 1
#include <windows.h>
2022-01-05 21:52:53 +08:00
namespace com::finogeeks::finclip::wrapper {
/**
* @brief
* kAsync:
* kBaseLibrarySync:
* kAppletSync:
*/
enum StartFlags
{
kAsync = 0,
kBaseLibrarySync = 1 << 0,
kAppletSync = 1 << 1,
};
2021-11-18 22:25:15 +08:00
/**
* @brief APIjssdk
2021-11-23 18:53:04 +08:00
*
2021-11-18 22:25:15 +08:00
*/
enum class FinClipApiType
{
kApplet,
kWebView
};
/**
* @brief
2021-11-23 18:53:04 +08:00
*
2021-11-18 22:25:15 +08:00
*/
struct IKnown
{};
/// SDK统一事件接口
/**
* @brief API
{
"size": 100,
"data": [[{},{}...],[{},{}...]]
}
2021-11-23 18:53:04 +08:00
2021-11-18 22:25:15 +08:00
*/
struct IResultSet : public IKnown
{
public:
///取字段数
/**@return 返回字段数.
*/
virtual int GetColCount() = 0;
///取字段名
/** @param column:字段序号(以0为基数)
* @return NULL
*/
virtual const char* GetColName(int column) = 0;
//按字段名,取字段值(字符串)
/**@param columnName: 字段名
*@return ,NULL
*/
virtual const char* GetStr(const char* columnName) = 0;
///取字段名对应的字段序号
/**@param columnName: 字段名
*@return . -1
*/
virtual int FindColIndex(const char* columnName) = 0;
//
//按字段序号(以0为基数),取字段值(字符串)
/**@param column:字段序号(以0为基数)
*@return ,NULL
*/
virtual const char* GetStrByIndex(int column) = 0;
///按字段序号获得字段值,二进制数据
/**@param column: 字段序号(以0为基数)
*@param lpRawLen: [out]
*@return :
*/
virtual void* GetRawByIndex(int column, int* lpRawLen) = 0;
///按字段名,取字段值
/**@param columnName:字段名
*@param lpRawLen: [out]
*@return :
*/
virtual void* GetRaw(const char* columnName, int* lpRawLen) = 0;
///最后一次取的字段值是否为NULL
/**@return 0 是, 1不是
*/
virtual int WasNull() = 0;
///取下一条记录
virtual void Next() = 0;
///判断是否为结尾
/**@return 1 是0 不是;
*/
virtual int IsEOF() = 0;
///判断是否为空
/**@return 1 是0 不是;
*/
virtual int IsEmpty() = 0;
virtual void* Destroy() = 0;
};
/**
* @brief SDK
2021-11-23 18:53:04 +08:00
*
2021-11-18 22:25:15 +08:00
*/
struct IEvent : public IResultSet
{
///取结果集个数
virtual int GetDatasetCount() = 0;
///设置当前结果集
/**
*@param int nIndex
*@return int 0
*/
virtual int SetCurrentDatasetByIndex(int nIndex) = 0;
///结果集行记录游标接口:取结果集的首条记录
virtual void First() = 0;
///结果集行记录游标接口:取结果集的最后一条记录
virtual void Last() = 0;
///结果集行记录游标接口取结果集的第n条记录取值范围[1, GetRowCount()]
virtual void Go(int nRow) = 0;
virtual const char* GetBuffer() = 0;
virtual void Release() = 0;
};
2021-11-23 18:53:04 +08:00
struct IApiCallback
{
public:
virtual void Callback(const char* event) = 0;
};
2021-11-18 22:25:15 +08:00
//函数指针回调
/**
* @params ret 0,1
* @params event IEvent
*
*
*/
2021-11-23 18:53:04 +08:00
typedef void (*FinClipSDKCallback)(IEvent*);
2021-11-18 22:25:15 +08:00
///数据打包器接口
struct IFinPacker : public IKnown
{
public:
/**
* @brief
*/
virtual void BeginPacker() = 0;
/**
* @brief
* @detail KEY,VALUE
*
* @param field
* @param value
* @return 01
*/
virtual void Add(const char* field, const char* value) = 0;
/**
* @brief
*/
virtual void EndPacker() = 0;
/**
* @brief
*/
virtual void Release() = 0;
/**
* @brief
* @return
*/
virtual int GetBufferSize() = 0;
/**
* @brief
* @param buffer
* @param size
* @return 01
*/
virtual int Dump(unsigned char* buffer, int* size) = 0;
};
///配置信息接口
struct IFinConfig
{
public:
/**
*
* SDK;
* domain;
*
*@param app_store
*@return void
*/
virtual void SetAppStore(int app_store) = 0;
/**
* @brief
* @param encrypt_type 0: 1:
* @return void
*/
virtual void SetEncryptType(int encrypt_type) = 0;
/**
* @brief
* @param domain : https://api.finogeeks.com
* @return void
*/
virtual void SetDomain(const char* domain) = 0;
/**
* @brief Api
* @param apiprefix /api/v1/mop
* @return void
*/
virtual void SetApiPrefix(const char* apiprefix) = 0;
/**
* @brief SDK
* @param appkey
* @return void
*/
virtual void SetAppKey(const char* appkey) = 0;
/**
* @brief SDK
* @param secret
* @return void
*/
virtual void SetSecret(const char* secret) = 0;
/**
* @brief SDK
* @param finger
* @return void
*/
virtual void SetFinger(const char* finger) = 0;
/**
* @brief
* @param type 0:1:
* @return void
*/
virtual void SetAppWindowStyle(int type) = 0;
2022-01-05 21:52:53 +08:00
/**
* @brief 线zip
* @param path
* @return void
*/
virtual void SetOfflineBaseLibrary(const char* path) = 0;
/**
* @brief 线zip
* @param path
* @return void
*/
virtual void SetOfflineApplet(const char* path) = 0;
/**
* @brief
* @param type 0:1:
* @return void
*/
virtual void SetShowLoading(int type) = 0;
/**
* @brief
* @param flag: StartFlags
* @return void
*/
virtual void SetStartFlag(int flag) = 0;
2021-11-18 22:25:15 +08:00
};
/*
* api
*/
struct IApi
{
/**
* @brief
*
* @param event
* @param param
* @param callback
*/
2021-11-23 18:53:04 +08:00
virtual void invoke(const char* event, const char* param, IApiCallback* callback) = 0;
2021-11-18 22:25:15 +08:00
/**
* @brief Apiapiwebview api
*
* @return FinClipApiType Api
*/
virtual FinClipApiType GetApiType() const = 0;
/**
* @brief Api
*
* @return char**
*/
virtual const char* apis() = 0;
/**
* @brief Api
*
* @return size_t
*/
virtual size_t size() = 0;
};
///配置打包器接口
struct IFinConfigPacker : public IKnown
{
public:
/**
* @brief
* @return
*/
virtual IFinConfig* NewConfig() = 0;
/**
* @brief
* @return 0
*/
virtual int AddConfig(IFinConfig* config) = 0;
/**
* @brief 使api
* @return 0
*/
virtual int RegisterApi(IApi* config) = 0;
/**
* @brief
* @return
*/
virtual IFinConfig* GetConfig(int type) = 0;
/**
* @brief
* @return
*/
virtual int GetConfigSize() = 0;
/**
* @brief
* @return
*/
virtual IFinConfig* GetConfigByIndex(int index) = 0;
/**
* @brief 使api
* @return 使api
*/
virtual int GetApiSize() = 0;
/**
* @brief 使api
* @return 使api
*/
virtual IApi* GetApiByIndex(int index) = 0;
};
struct IPackerFactory : public IKnown
{
public:
/**
* @brief
* @detail
*
* @return
*/
virtual IFinConfigPacker* GetFinConfigPacker() = 0;
/**
* @brief
* @detail
*
* @return
*/
virtual IFinPacker* GetFinPacker() = 0;
};
2022-01-05 21:52:53 +08:00
} // namespace com::finogeeks::finclip::wrapper
2021-11-18 22:25:15 +08:00
#endif // !__H_FINCLIPAPI_H__