Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patch for function arg/return types in frontier_client.py #2

Merged
merged 1 commit into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions frontier.c
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,14 @@ static void frontier_fini()
FrontierChannel frontier_createChannel(const char *srv,const char *proxy,int *ec)
{
Channel *chn=channel_create(srv,proxy,ec);
return (unsigned long)chn;
return (FrontierChannel)chn;
}

FrontierChannel frontier_createChannel2(FrontierConfig* config, int *ec) {
FrontierChannel frontier_createChannel2(FrontierConfig* config, int *ec)
{
Channel *chn = channel_create2(config, ec);
return (unsigned long)chn;
}
return (FrontierChannel)chn;
}


void frontier_closeChannel(FrontierChannel fchn)
Expand Down
3 changes: 2 additions & 1 deletion include/frontier_client/frontier.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,15 @@
#ifndef __HEADER_H_FRONTIER_H
#define __HEADER_H_FRONTIER_H

#include <inttypes.h>
#include <sys/types.h>
#include "frontier_config.h"
#include "frontier_log.h"
#include "frontier_error.h"

#define FRONTIER_MAX_PAYLOADNUM 32

typedef unsigned long FrontierChannel;
typedef uintptr_t FrontierChannel;
typedef void FrontierRSBlob;

/*frontierRSBlob_get is deprecated, use frontierRSBlob_open instead*/
Expand Down
14 changes: 12 additions & 2 deletions python/lib/frontier_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,27 @@


libfc = ctypes.cdll.LoadLibrary('libfrontier_client.so.2')
libfc.frontier_getErrorMsg.restype = ctypes.c_char_p
libfc.frontier_closeChannel.restype = None
libfc.frontierRSBlob_open.argtypes = [ctypes.c_int64, ctypes.c_void_p]
libfc.frontierRSBlob_open.restype = ctypes.c_void_p # not a NUL-terminated string
libfc.frontierRSBlob_close.restype = None
libfc.frontierRSBlob_payload_error.argtypes = [ctypes.c_void_p]
libfc.frontierRSBlob_payload_msg.restype = ctypes.c_char_p
libfc.frontierRSBlob_getByte.argtypes = [ctypes.c_void_p]
libfc.frontierRSBlob_getByte.restype = ctypes.c_byte # c_char
libfc.frontierRSBlob_getInt.argtypes = [ctypes.c_void_p]
libfc.frontierRSBlob_getInt.restype = ctypes.c_int32 # c_int
libfc.frontierRSBlob_getLong.restype = ctypes.c_int64 # c_longlong
libfc.frontierRSBlob_getDouble.restype = ctypes.c_double
libfc.frontierRSBlob_getFloat.restype = ctypes.c_float
libfc.frontierRSBlob_getByteArray.argtypes = [ctypes.c_void_p]
libfc.frontierRSBlob_getByteArray.restype = ctypes.c_void_p # not a NUL-terminated string
libfc.frontierRSBlob_getRecNum.argtypes = [ctypes.c_void_p]
libfc.frontierRSBlob_getRecNum.restype = ctypes.c_int64
libfc.frontier_createChannel.restype = ctypes.c_int64
libfc.frontier_closeChannel.argtypes = [ctypes.c_int64]
libfc.frontier_closeChannel.restype = None
libfc.frontier_getErrorMsg.restype = ctypes.c_char_p
libfc.frontier_getRawData.argtypes = [ctypes.c_int64]


FRONTIER_OK = 0
Expand Down