dev_1
yejian 2 years ago committed by Gordon
parent 43d7d4ebe9
commit 50ac591a82
  1. 12
      c_wrapper/export.go
  2. 17
      c_wrapper/protocol.go

@ -12,14 +12,6 @@ extern void Call_CB_S_I_S_S(CB_S_I_S_S func,char *,int errCode,char* errMsg,char
extern void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char *,int errCode,char* errMsg,char* data,int progress);
extern CB_S DebugPrint;
int CheckDebugPrint(){
if(DebugPrint == NULL){
return 0;
}else{
return 1;
}
}
*/
import "C"
@ -33,9 +25,7 @@ func set_print(print C.CB_S) {
}
func DebugPrint(info string) {
if C.CheckDebugPrint() > 0 {
C.Call_CB_S(C.DebugPrint, C.CString(info))
}
C.Call_CB_S(C.DebugPrint, C.CString("DLL:"+info))
}
type Base struct {

@ -12,12 +12,20 @@ CB_S DebugPrint;
void Call_CB_S(CB_S func,char* data)
{
if(func == NULL){
printf("callback func is null\n");
return;
}
func(data);
}
void Call_CB_I_S(CB_I_S func,int event,char* data)
{
if(func == NULL){
printf("callback func is null\n");
return;
}
func(event,data);
if (data != NULL && data[0] != '\0')
{
@ -27,6 +35,10 @@ void Call_CB_I_S(CB_I_S func,int event,char* data)
}
void Call_CB_S_I_S_S(CB_S_I_S_S func,char* operationID, int errCode,char* errMsg,char* data)
{
if(func == NULL){
printf("callback func is null\n");
return;
}
func(operationID,errCode,errMsg,data);
if (errMsg != NULL && errMsg[0] != '\0')
{
@ -46,6 +58,10 @@ void Call_CB_S_I_S_S(CB_S_I_S_S func,char* operationID, int errCode,char* errMsg
}
void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char* operationID,int errCode,char* errMsg,char* data,int progress)
{
if(func == NULL){
printf("callback func is null\n");
return;
}
func(operationID,errCode,errMsg,data,progress);
if (errMsg != NULL && errMsg[0] != '\0')
{
@ -63,6 +79,7 @@ void Call_CB_S_I_S_S_I(CB_S_I_S_S_I func,char* operationID,int errCode,char* err
free(operationID);
}
}
enum CONN_EVENT{
CONNECTING,
CONNECT_SUCCESS,

Loading…
Cancel
Save