|
5精币
#ifdef DLL_EXPORTS
#define DLL_CORE_API __declspec(dllexport)
#else
#define DLL_CORE_API __declspec(dllimport)
#endif
//智能电话盒状态
enum DeviceState
{
//设备未连接
disconnected,
//设备已连接
connected,
//设备空闲
idel,
//来电
dialin,
//来电通话中
dialintalking,
//挂断
dialinend,
//呼出
dialout,
//呼出通话中
dialouttalking,
//挂断
dialoutend,
};
//通知消息类型
enum MessageType
{
//指令TraceLog
InstructionTrace,
//命令回复
CommandResponse,
//设备实时状态
RealTimeState,
//通话记录
LastCallRecord,
//错误
Error,
//警告
Warning,
//其他信息
Infomation
};
//通知回调函数指针
typedef void(*pCallBack)(MessageType msgType, const char* pMsg);
#pragma region 导出函数
//初始化打开设备
DLL_CORE_API bool Initialize();
//关闭设备
DLL_CORE_API void CloseDevice();
//设置回调通知
DLL_CORE_API void SetNotifyCallBack(pCallBack pCallBack);
//判断设备是否已经打开
DLL_CORE_API bool IsDeviceConnected();
//判断是否有尚未执行的指令
DLL_CORE_API bool IsExistUnexecutedCommand();
//获取电话盒当前状态
DLL_CORE_API DeviceState GetCurrentState();
//拨号
DLL_CORE_API bool Dial(const char * pNumber);
//应答接听
DLL_CORE_API bool Answer();
//挂断
DLL_CORE_API bool HungUp();
#pragma endregion
///////第二段
#include "stdafx.h"
#include "SmartPhoneBoxCore.h"
#include <iostream>
using namespace std;
//回调通知
void Notify(MessageType msgType, const char* pMsg)
{
cout << msgType<<"\t"<<pMsg << endl;
}
int main()
{
//初始化链接设备
bool isOk = Initialize();
cout << "初始化设备" << isOk << endl;
//判断设备是否链接
isOk = IsDeviceConnected();
cout << "设备链接状态" << isOk << endl;
//设置回调通知
SetNotifyCallBack(Notify);
char rn = getchar();
return 0;
}
谢谢了!!!
|
|