/*  ------------------------  testRTCE.h  ------------------------  */
#ifndef _NF_BT_DLL_H
#define _NF_BT_DLL_H

#include <windows.h>
#include <winuser.h>

///////////////////////////////////////////
#define PHONE_BOOK_NUM_MAX	30
#define SPP_BUF_MAX	260

typedef enum {
	REQ_ERR_POWER_OFF = 1, //Bluetooth is power off
	REQ_ERR_DIAL,
} REQUEST_ERROR;

struct StrPairedDevice
{
   int          nRealIndex;
   LPTSTR		lpName;
   BYTE			bAdd[6];
   BYTE			bCod[4];
};

struct StrPhoneNumber
{
   // lpType contains the comma separated contact types (e.g. "work,voice,pref,msg")
   LPTSTR		lpType;
   // lpNumber contains the number string
   LPTSTR		lpNumber;
};

//vincent
struct StrCalllog
{
	int			nType;
	LPTSTR		lpName;
	LPTSTR		lpNum;
	LPTSTR		lpTime;
};

struct StrPhoneBook
{
	LPTSTR		lpFirstname;
	LPTSTR		lpLastname;
	//LPTSTR		lpPrivatePhone;
	//LPTSTR		lpPrivateMobile;
	//LPTSTR		lpBusinessPhone;
	//LPTSTR		lpBusinessMobile;

	LPTSTR		lpStreet1stAddress;
	//LPTSTR		lpHouseumber1stAddress;
	LPTSTR		lpCityName1stAddress;
	LPTSTR		lpFederalState1stAddress;
	LPTSTR		lpZipCode1stAddress;
	LPTSTR		lpCountry1stAddress;

	LPTSTR		lpStreet2ndAddress;
	//LPTSTR		lpHouseNumber2ndAddress;
	LPTSTR		lpCityName2ndAddress;
	LPTSTR		lpFederalState2ndAddress;
	LPTSTR		lpZipCode2ndAddress;
	LPTSTR		lpCountry2ndAdress;

	int         iNumbers;                  // how many number are delivered with this contact
	struct		StrPhoneNumber     strpnNumers[PHONE_BOOK_NUM_MAX];  // list of phone number structs for this contact

};

///////////////////////////////////////////
///			Callback function			///
///////////////////////////////////////////

typedef void (CALLBACK* NFPROC_ON_CORE_VERSION)(LPTSTR lpName);
typedef void (CALLBACK* NFPROC_ON_POWER_STATUS)(int nStatus);
typedef void (CALLBACK* NFPROC_ON_LOCAL_DEVICE_STATUS)(BYTE bStatus[10]);
typedef void (CALLBACK* NFPROC_ON_FW_VERSION)(LPTSTR lpVersion);
typedef void (CALLBACK* NFPROC_ON_LOCAL_DEVICE_NAME)(LPTSTR lpName, BYTE bAdd[6]);
typedef void (CALLBACK* NFPROC_ON_INQUIRY_ADD)(int nID, BYTE bAdd[6], BYTE bCod[4]);
typedef void (CALLBACK* NFPROC_ON_INQUIRY_NAME)(int nID, LPTSTR lpName);
typedef void (CALLBACK* NFPROC_ON_INQUIRY_END)(void);
typedef void (CALLBACK* NFPROC_ON_PAIR_STATUS)(int nStatus);
typedef void (CALLBACK* NFPROC_ON_PAIRED_DEVICE)(int nTotal, struct StrPairedDevice PDList[10]);
typedef void (CALLBACK* NFPROC_ON_CONNECTED_DEVICE)(LPTSTR lpName, BYTE bAdd[6], BYTE bCod[4]);
typedef void (CALLBACK* NFPROC_ON_DISCONNECT_DEVICE)(int nProfile);
//typedef void (CALLBACK* NFPROC_ON_PAIRED_DEVICE_NAME)(LPTSTR lpName);
typedef void (CALLBACK* NFPROC_ON_DELETE_PAIRED_DEVICE)(BOOL bStatus, int nID);
typedef void (CALLBACK* NFPROC_ON_HFP_STATUS)(int nType);
typedef void (CALLBACK* NFPROC_ON_OPP_DOWNLOAD)(int nAction);
typedef void (CALLBACK* NFPROC_ON_PHONEBOOK_TOTAL)(int nTotal);
typedef void (CALLBACK* NFPROC_ON_PHONEBOOK_DATA)(struct StrPhoneBook PBData);
typedef void (CALLBACK* NFPROC_ON_PHONEBOOK_DATAS)(int nGot, int nTotal, struct StrPhoneBook* pPBData);
typedef void (CALLBACK* NFPROC_ON_PHONEBOOK_DOWNLOADING)(LPTSTR lpName, int nType);
typedef void (CALLBACK* NFPROC_ON_PHONEBOOK_DOWNLOAD_END)(int nType);
typedef void (CALLBACK* NFPROC_ON_PHONEBOOK_SEARCHED)(LPTSTR lpName);
typedef void (CALLBACK* NFPROC_ON_CALL_HISTORY_TOTAL)(int nTotal);
typedef void (CALLBACK* NFPROC_ON_CALL_HISTORY_DATA)(int nType, LPTSTR lpCallerNumber, LPTSTR lpTime, LPTSTR lpName);

//vincent
typedef void (CALLBACK* NFPROC_ON_CALL_HISTORY_DATAS)(int nGot, struct StrCalllog* pCLData);

typedef void (CALLBACK* NFPROC_ON_PAIRING)(LPTSTR lpName, BYTE bAdd[6], BYTE bCod[4]);
typedef void (CALLBACK* NFPROC_ON_CALLER_ID)(LPTSTR lpNumber, LPTSTR lpName);
typedef void (CALLBACK* NFPROC_ON_SMS_TOTAL)(int nTotal);
typedef void (CALLBACK* NFPROC_ON_SMS_DATA_AT)(LPTSTR lpNumber, LPTSTR lpTime, LPTSTR lpContent, LPTSTR lpName);
typedef void (CALLBACK* NFPROC_ON_SMS_NEW)(void);
typedef void (CALLBACK* NFPROC_ON_VOLUME)(int nVolume);
typedef void (CALLBACK* NFPROC_ON_RING_TONE_VOLUME)(int nVolume);
typedef void (CALLBACK* NFPROC_ON_INITIAL_COMPLETE)(void);
typedef void (CALLBACK* NFPROC_ON_AG_STATE)(int nState);
typedef void (CALLBACK* NFPROC_ON_AVRCP_STATE)(int nAction, int nState);
typedef void (CALLBACK* NFPROC_ON_A2DP_STREAM_STATE)(int nState);
typedef void (CALLBACK* NFPROC_ON_DUN_STATE)(int nState);
typedef void (CALLBACK* NFPROC_ON_MIC_VOL)(int nVol, int nAction);
typedef void (CALLBACK* NFPROC_ON_SPP_DATA)(int nSize, BYTE bBuffer[SPP_BUF_MAX]);
typedef void (CALLBACK* NFPROC_ON_CURRENT_CALLS)(LPTSTR lpCurrentNum, LPTSTR lpName, int nDir, int nStatus);
typedef void (CALLBACK* NFPROC_ON_RAS_CONNECT_STATUS)(int nStatus);
typedef void (CALLBACK* NFPROC_ON_RAS_HANGUP_RESPONSE)(int nStatus);
typedef void (CALLBACK* NFPROC_ON_MIC_MUTE_STATE)(int nStatus);
typedef void (CALLBACK* NFPROC_ON_SPK_MUTE_STATE)(int nStatus);

//vincent
typedef void (CALLBACK* NFPROC_ON_SET_PIN_RESULT)(int iResult);
typedef void (CALLBACK* NFPROC_ON_RESTART_RESULT)(int iResult);

typedef void (CALLBACK* NFPROC_ON_NF_TEST_STATE)(int nState);

typedef void (CALLBACK* NFPROC_ON_VR_STATE)(int nState);
typedef void (CALLBACK* NFPROC_ON_VOICE_OUT_PATH_STATE)(int nState, int nPath);

typedef void (CALLBACK* NFPROC_ON_REQUEST_ERROR)(int nErrorCode);

struct StrFnCallback
{
	NFPROC_ON_REQUEST_ERROR				pfnOnRequestError;

	NFPROC_ON_CORE_VERSION				pfnOnCoreVersion;
	NFPROC_ON_POWER_STATUS				pfnOnPowerStatus;
	NFPROC_ON_LOCAL_DEVICE_STATUS		pfnOnLocalDeviceStatus;
	NFPROC_ON_FW_VERSION				pfnOnFWVersion;
	NFPROC_ON_LOCAL_DEVICE_NAME			pfnOnLocalDeviceName;
	NFPROC_ON_INQUIRY_ADD				pfnOnInquiryAdd;
	NFPROC_ON_INQUIRY_NAME				pfnOnInquiryName;
	NFPROC_ON_INQUIRY_END				pfnOnInquiryEnd;
	NFPROC_ON_PAIR_STATUS				pfnOnPairStatus;
	NFPROC_ON_PAIRED_DEVICE				pfnOnPairedDevice;
	NFPROC_ON_CONNECTED_DEVICE			pfnOnConnectedDevice;
	NFPROC_ON_DISCONNECT_DEVICE			pfnOnDisconnectDevice;
	//NFPROC_ON_PAIRED_DEVICE_NAME		pfnOnPairedDeviceName;
	NFPROC_ON_DELETE_PAIRED_DEVICE		pfnOnDeletePairedDevice;
	NFPROC_ON_HFP_STATUS				pfnOnHfpStatus;
	NFPROC_ON_OPP_DOWNLOAD				pfnOnOppDownload;
	NFPROC_ON_PHONEBOOK_TOTAL			pfnOnPhoneBookTotal;
	NFPROC_ON_PHONEBOOK_DATA			pfnOnPhoneBookData;
	NFPROC_ON_PHONEBOOK_DATAS			pfnOnPhoneBookDatas;
	NFPROC_ON_PHONEBOOK_DOWNLOADING		pfnOnPhoneBookDownloading;
	NFPROC_ON_PHONEBOOK_DOWNLOAD_END	pfnOnPhoneBookDownloadEnd;
	NFPROC_ON_PHONEBOOK_SEARCHED		pfnOnPhoneBookSearched;
	NFPROC_ON_CALL_HISTORY_TOTAL		pfnOnCallHistoryTotal;
	NFPROC_ON_CALL_HISTORY_DATA			pfnOnCallHistoryData;

	//vincent
	NFPROC_ON_CALL_HISTORY_DATAS		pfnOnCallHistoryDatas;

	NFPROC_ON_PAIRING					pfnOnPairing;
	NFPROC_ON_CALLER_ID					pfnOnCallerID;
	NFPROC_ON_SMS_TOTAL					pfnOnSMSTotal;
	NFPROC_ON_SMS_DATA_AT				pfnOnSMSDataAt;
	NFPROC_ON_SMS_NEW					pfnOnSMSNew;
	NFPROC_ON_VOLUME					pfnOnVolume;
	NFPROC_ON_RING_TONE_VOLUME			pfnOnRingToneVolume;
	NFPROC_ON_INITIAL_COMPLETE			pfnOnInitialComplete;
	NFPROC_ON_AG_STATE					pfnOnAGState;
	NFPROC_ON_AVRCP_STATE				pfnOnAVRCPState;
	NFPROC_ON_A2DP_STREAM_STATE			pfnOnA2DPStreamState;
	NFPROC_ON_DUN_STATE					pfnOnDUNState;
	NFPROC_ON_SPP_DATA					pfnOnSppData;
	NFPROC_ON_CURRENT_CALLS				pfnOnCurrentCalls;
	NFPROC_ON_RAS_CONNECT_STATUS		pfnOnRasConnectStatus;
	NFPROC_ON_MIC_MUTE_STATE			pfnOnMicMuteState;
	NFPROC_ON_SPK_MUTE_STATE			pfnOnSpkMuteState;

	//vincent
	NFPROC_ON_SET_PIN_RESULT            pfnOnSetPinResult;
	NFPROC_ON_RESTART_RESULT			pfnOnRestartResult;

	NFPROC_ON_RAS_HANGUP_RESPONSE		pfnOnRasHangupResponse;

	NFPROC_ON_NF_TEST_STATE				pfnOnNFTestState;

//#ifdef EXPORT_CODE_NORMAL_2

	NFPROC_ON_MIC_VOL					pfnOnMicVol;
	NFPROC_ON_VR_STATE					pfnOnVRState;
	NFPROC_ON_VOICE_OUT_PATH_STATE		pfnOnVoiceOutPathState;

//#endif
};

///////////////////////////////////////////
///			library function			///
///////////////////////////////////////////

typedef void (*NFPROC_REGISTER_CALLBACK)(struct StrFnCallback FnCallBack);
typedef void (*NFPROC_GET_CORE_VERSION)(void);
typedef void (*NFPROC_POWER_ON)(void);
typedef void (*NFPROC_POWER_OFF)(void);
typedef BOOL (*NFPROC_POWER_AUTO_ON)(int nType, BOOL bAuto);
typedef void (*NFPROC_GET_POWER_STATUS)(void);
typedef void (*NFPROC_GET_LOCAL_DEVICE_STATUS)(void);
typedef void (*NFPROC_GET_FW_VERSION)(void);
typedef void (*NFPROC_GET_LOCAL_DEVICE_NAME)(void);
typedef void (*NFPROC_SET_LOCAL_DEVICE_NAME)(LPTSTR lpName);
typedef void (*NFPROC_INQUIRY_DEVICE)(int nAction);
typedef void (*NFPROC_PAIR_REMOTE_DEVICE)(int nID);
typedef int (*NFPROC_GET_PAIRED_DEVICE_TOTAL)(void);
typedef void (*NFPROC_GET_PAIRED_DEIVE_AT)(int nID, LPTSTR lpName, LPTSTR lpAdd, BYTE *bCod);
typedef void (*NFPROC_ESTABLISH_SLC_PAIRED_DEVICE_AT)(int nID, int nProfile);
typedef void (*NFPROC_DELETE_PAIRED_DEVICE_AT)(int nID);
typedef void (*NFPROC_DISCONNECT)(int nOption);
typedef void (*NFPROC_SET_VISIBILITY)(int nStatus);
typedef void (*NFPROC_AUDIO_TRANSFER)(int nDirection);
typedef void (*NFPROC_ANSWER)(void);
typedef void (*NFPROC_REJECT)(void);
typedef void (*NFPROC_TERMINATE)(void);
typedef void (*NFPROC_DIAL)(LPTSTR lpNum);
typedef void (*NFPROC_DTMF)(int nKey);
typedef void (*NFPROC_SET_VOLUME)(int nVol);
typedef void (*NFPROC_GET_VOLUME)();
typedef void (*NFPROC_MUTE)(int nMute);
typedef void (*NFPROC_GET_PHONE_BOOK_TOTAL)(void);
typedef void (*NFPROC_GET_PHONE_BOOK_DATA_AT)(int nRow);
typedef void (*NFPROC_GET_PHONE_BOOK_DATAS)(int nStart, int nEnd);
typedef void (*NFPROC_GET_PHONE_BOOK_DOWNLOAD)(int nAction);
typedef void (*NFPROC_GET_PHONE_BOOK_SEARCH)(LPTSTR lpNum);
typedef void (*NFPROC_PHONE_BOOK_CLEAR)(int nIndex);
typedef void (*NFPROC_GET_CALL_HISTORY_TOTAL)(void);
typedef void (*NFPROC_GET_CALL_HISTORY_DATA_AT)(int nRow, int nType);

//vincent
typedef void (*NFPROC_GET_CALL_HISTORY_DATAS)(int nStart, int nEnd, int nType);

typedef void (*NFPROC_CALL_HISTORY_DOWNLOAD)(int nAction);
typedef void (*NFPROC_CALL_HISTORY_CLEAR)(int nIndex, int nType);
typedef void (*NFPROC_SET_PIN_CODE)(LPTSTR lpCode);
typedef void (*NFPROC_SET_PIN_CODE_AUTO)(BOOL bAuto);
typedef void (*NFPROC_GET_SMS_TOTAL)(void);
typedef void (*NFPROC_GET_SMS_DATA_AT)(int nRow);
typedef void (*NFPROC_SEND_SMS)(LPTSTR lpNum, LPTSTR lpContent);
typedef void (*NFPROC_SET_AUTO_RECONNECT)(int nSwitch);
typedef void (*NFPROC_SET_RING_TONE_LEVEL)(int nLevel, int nPlayRingTone);
typedef BOOL (*NFPROC_LOG_BIN)(int nAction);
typedef void (*NFPROC_AVRCP_CMD)(int nAction, int nLevel);
typedef void (*NFPROC_SPP_SEND)(int nSize, BYTE bBuffer[SPP_BUF_MAX]);
typedef void (*NFPROC_REDIAL)();
typedef void (*NFPROC_ADD_MODEM)(void);
typedef void (*NFPROC_ADD_RAS_ENTRY)(LPTSTR lpAPN, LPTSTR lpDialPhoneNumber);
typedef void (*NFPROC_GPRS_CONNECT)(void);
typedef void (*NFPROC_GPRS_HANGUP)(void);

typedef void (*NFPROC_NF_TEST)(int nStation);

typedef void (*NFPROC_MIC_VOL)(int nVol);
typedef void (*NFPROC_VR_STATE)(int nAction);
typedef void (*NFPROC_VOICE_OUT_PATH)(int nAction);
typedef void (*NFPROC_SET_SPEAKER_AMP_PWR)(int nAction);
typedef void (*NFPROC_SET_MIC_BIAS)(int nAction);
typedef void (*NFPROC_SET_EARPHONE_AMP_PWR)(int nAction);

//vincent
typedef void (*NFPROC_RESTART_CORE)();

///////////////////////////////////////////

extern "C" _declspec(dllexport) void RegisterCallBack(struct StrFnCallback FnCallBack);
extern "C" _declspec(dllexport) void GetCoreVersion(void);
extern "C" _declspec(dllexport) void PowerOn(void);
extern "C" _declspec(dllexport) void PowerOff(void);
extern "C" _declspec(dllexport) BOOL PowerAutoOn(int nType, BOOL bAuto = TRUE);
extern "C" _declspec(dllexport) void GetPowerStatus(void);
extern "C" _declspec(dllexport) void GetLocalDeviceStatus(void);
extern "C" _declspec(dllexport) void GetFWVersion(void);
extern "C" _declspec(dllexport) void GetLocalDeviceName(void);
extern "C" _declspec(dllexport) void SetLocalDeviceName(LPTSTR lpName);
extern "C" _declspec(dllexport) void InquiryDevice(int nAction);
extern "C" _declspec(dllexport) void PairRemoteDevice(int nID);
extern "C" _declspec(dllexport) int GetPairedDeviceTotal(void);
extern "C" _declspec(dllexport) void GetPairedDeviceAt(int nID, LPTSTR lpName, LPTSTR lpAdd, BYTE *bCod);
extern "C" _declspec(dllexport) void EstablishSLCPairedDeviceAt(int nID, int nProfile);
extern "C" _declspec(dllexport) void DeletePairedDeviceAt(int nID);
extern "C" _declspec(dllexport) void Disconnect(int nOption);
extern "C" _declspec(dllexport) void SetVisibility(int nStatus);
extern "C" _declspec(dllexport) void AudioTransfer(int nDirection);
extern "C" _declspec(dllexport) void Answer(void);
extern "C" _declspec(dllexport) void Reject(void);
extern "C" _declspec(dllexport) void Terminate(void);
extern "C" _declspec(dllexport) void Dial(LPTSTR lpNum);
extern "C" _declspec(dllexport) void DTMF(int nKey);
extern "C" _declspec(dllexport) void SetVolume(int nVol);
extern "C" _declspec(dllexport) void GetVolume(void);
extern "C" _declspec(dllexport) void Mute(int nMute);
extern "C" _declspec(dllexport) void GetPhoneBookTotal(void);
extern "C" _declspec(dllexport) void GetPhoneBookDataAt(int nRow);
extern "C" _declspec(dllexport) void GetPhoneBookDatas(int nStart, int nEnd);
extern "C" _declspec(dllexport) void GetPhoneBookDownLoad(int nAction);
extern "C" _declspec(dllexport) void GetPhoneBookSearch(LPTSTR lpNum);
extern "C" _declspec(dllexport) void PhoneBookClear(int nIndex);
extern "C" _declspec(dllexport) void GetCallHistoryTotal(void);
extern "C" _declspec(dllexport) void GetCallHistoryDataAt(int nRow, int nType);

//vincent
extern "C" _declspec(dllexport) void GetCallHistoryDatas(int nStart, int nEnd, int nType);

extern "C" _declspec(dllexport) void CallHistoryDownload(int nAction);
extern "C" _declspec(dllexport) void CallHistoryClear(int nIndex, int nType);
extern "C" _declspec(dllexport) void SetPinCode(LPTSTR lpCode);
extern "C" _declspec(dllexport) void SetPinCodeAuto(BOOL bAuto);
extern "C" _declspec(dllexport) void GetSMSTotal(void);
extern "C" _declspec(dllexport) void GetSMSDataAt(int nRow);
extern "C" _declspec(dllexport) void SendSMS(LPTSTR lpNum, LPTSTR lpContent);
extern "C" _declspec(dllexport) void SetAutoReconnect(int nSwitch);
extern "C" _declspec(dllexport) void SetRingToneLevel(int nLevel, int nPlayRingTone);
extern "C" _declspec(dllexport) BOOL LogBin(int nAction);
extern "C" _declspec(dllexport) void AVRCPCmd(int nAction, int nLevel);
extern "C" _declspec(dllexport) void SppSend(int nSize, BYTE bBuffer[SPP_BUF_MAX]);
extern "C" _declspec(dllexport) void ReDial();
extern "C" _declspec(dllexport) void AddModem(void);
extern "C" _declspec(dllexport) void AddRasEntry(LPTSTR lpAPN, LPTSTR lpDialPhoneNumber);
extern "C" _declspec(dllexport) void GPRSConnect(void);
extern "C" _declspec(dllexport) void GPRSHandup(void);

extern "C" _declspec(dllexport) void NFTest(int nStation);

extern "C" _declspec(dllexport) void MicVol(int nVol);
extern "C" _declspec(dllexport) void VRState(int nAction);
extern "C" _declspec(dllexport) void VoiceOutPath(int nAction);
extern "C" _declspec(dllexport) void SetSpeakerAmpPower(int nAction);
extern "C" _declspec(dllexport) void SetMicBias(int nAction);
extern "C" _declspec(dllexport) void SetEarphoneAmpPower(int nAction);

//vincent
extern "C" _declspec(dllexport) void ReStartCore();

#endif		/*  _NF_BT_DLL_H  */
