Home > Back-end >  DELPHI realize news push: push the C language of DLL how to call in DELPHI7, I want to know how to c
DELPHI realize news push: push the C language of DLL how to call in DELPHI7, I want to know how to c

Time:09-27

# # ifndef _I_GT_PUSH_H_
# define _I_GT_PUSH_H_

/* * * * * * * * * * * * * * * * * * * * * * * * * * * version log * * * * * * * * * * * * * * * * * * * * * * * * * * *
*==========V1.0.1, chenjb, 2014-07-28==========
* 1. Remove pushMessageToListB interface, pushMessageToListA renamed pushMessageToList
* 2. Details pushMessageToList increase return to push function
*
*==========V1.0.2, chenjb, 2015-01-14==========
* 1. Curl bug fixes, http://blog.chinaunix.net/uid-20761674-id-3391182.html
*/

# ifdef __cplusplus
Extern "C" {
# endif

# if defined (WIN32) | | defined (_WIN32)
# define STDCALL _stdcall
# if defined (GTPUSHSDK_EXPORTS)
# define DLL_EXTERN __declspec (dllexport)
# the else
# define DLL_EXTERN __declspec (dllimport)
# endif
# the else
# define DLL_EXTERN
# define STDCALL
# endif

//call returns results structure: SUCCESS (SUCCESS)/FAILED (fail)
Typedef enum result_t {
SUCCESS=0,
FAILED=1,
ERR_ENCODE=2
} the Result;

//a single result key/value pair structure
Typedef struct entry_t {
Char key [100].
Char value [1024].
} Entry;

//push results structure
Typedef struct i_push_result_t {
Int size;//the result Entry exists in
Entry Entry [10].
} IPushResult;

//basic message structure
Typedef struct message_t {
Int isOffline;
Long offlineExpireTime;
Int priority;
} Message;

//a single message structure
Typedef struct single_message_t {
The Message MSG.
} SingleMessage;

//CID list message structure
Typedef struct list_message_t {
The Message MSG.
} ListMessage;

//application message structure
Typedef struct app_message_t {
The Message MSG.
Char * * appIdList;
Int appIdListSize;
Char * * phoneTypeList;
Int phoneTypeListSize;
Char * * provinceList;
Int provinceListSize;
Char * * tagList;
Int tagListSize;
} AppMessage;

//push the target structure
Typedef struct target_t {
Char * appId;
Char * clientId.
} Target;

//template type enum
Typedef enum template_type_t {
Transmission, PopupTransmission NotyPopLoad, Notification, the Link
} TemplateType;

//used in IOS mobile phone
Typedef struct push_info_t {
Char * actionLocKey;
Int badge;
Char * message;
Char * sound;
Char * content;
Char * locKey;
Char * locArgs;
Char * launchImage;
} PushInfo;

//basic template structure
Typedef struct template_t {
Char * appId;
Char * appKey.
PushInfo PushInfo;
} the Template;

//passthrough template structure
Typedef struct transmission_template_t {
The Template t;
Int transmissionType;
Char * transmissionContent;
} TransmissionTemplate;

//popup window passthrough template structure
Typedef struct popup_transmission_template_t {
The Template t;
Int transmissionType;
Char * transmissionContent;
Char * title;
Char * text;
Char * img.
Char * confirmButtonText;
Char * cancelButtonText;
} PopupTransmissionTemplate;

//notification pop-up window to download the template structure
Typedef struct noty_pop_load_template_t {
The Template t;
Char * notyIcon;
Char * logoUrl;
Char * notyTitle;
Char * notyContent;
Int isCleared;
Int isBelled;
Int isVibrationed;
Char * popTitle;
Char * popContent;
Char * popImage;
Char * popButton1;
Char * popButton2;
Char * loadIcon;
Char * loadTitle;
Char * loadUrl;
Int isAutoInstall;
Int isActived;
Char * androidMark;
Char * symbianMark;
Char * iphoneMark;
} NotyPopLoadTemplate;

//notice template structure
Typedef struct notification_template_t {
The Template t;
Int transmissionType;
Char * transmissionContent;
Char * text;
Char * title;
Char * logo;
Char * logoUrl;
Int isRing;
Int isVibrate;
Int isClearable;
} NotificationTemplate;

//link template structure
Typedef struct link_template_t {
The Template t;
Char * text;
Char * title;
Char * logo;
Char * logoUrl;
Char * url;
Int isRing;
Int isVibrate;
Int isClearable;
} LinkTemplate;

//push the result details
Typedef struct push_detail_t {
Char cid [33].//the corresponding CID
Char ret [51].//details content
} PushDetail;

//function: push initialization, to initialize a program runs to
//parameters:
//host a push server URL [in]
//appKey a push for application of appKey [in]
//masterSecret a push for application of masterSecret [in]
//testUTF8 all libraries in this interface must be introduced into character must be a utf-8, here used to test whether utf-8, fixed fill in "code" two words [in]
//return: Result enumeration, SUCCESS, FAILED, ERR_ENCODE (coding test failure)
DLL_EXTERN Result STDCALL pushInit (char * host, char * appKey, char * masterSecret, const char * testUTF8);

//function: initialize a push server authentication
//parameters:
//called appKey pushInit APP corresponding appKey [in]
//return: Result enumeration, SUCCESS, FAILED
AppKey DLL_EXTERN Result STDCALL pushConnect (char *);

//function: shut down a push server authentication
//parameters:
//called appKey pushInit APP corresponding appKey [in]
//return: Result enumeration, SUCCESS, FAILED
AppKey DLL_EXTERN Result STDCALL pushClose (char *);

//function: push a single message
//parameters:
//called appKey pushInit APP corresponding appKey [in]
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related