You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
121 lines
2.7 KiB
C++
121 lines
2.7 KiB
C++
#include "manage.h"
|
|
#include "corework.h"
|
|
#include "log.h"
|
|
|
|
extern bool g_bInit;
|
|
|
|
EXPORT_C int WINAPI core_init()
|
|
{
|
|
RETURN_CHK_NOPRT(!g_bInit, 0);
|
|
|
|
g_bInit = true;
|
|
return ins->Init();
|
|
}
|
|
|
|
EXPORT_C int WINAPI core_deinit()
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, 0);
|
|
|
|
g_bInit = false;
|
|
CManage::ReleaseInstance();
|
|
return 0;
|
|
}
|
|
|
|
EXPORT_C int WINAPI core_version()
|
|
{
|
|
return VERSION;
|
|
}
|
|
|
|
EXPORT_C int WINAPI core_set_cfg(CoreConfig* cfg)
|
|
{
|
|
RETURN_CHK_NOPRT(cfg, ERR_INPUT_PARAM);
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->SetConfig(cfg);
|
|
}
|
|
|
|
EXPORT_C int WINAPI core_get_cfg(CoreConfig* cfg)
|
|
{
|
|
RETURN_CHK_NOPRT(cfg, ERR_INPUT_PARAM);
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
|
|
ins->GetConfig(cfg);
|
|
return 0;
|
|
}
|
|
|
|
EXPORT_C const char* WINAPI get_test_model()
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, "invalid");
|
|
return ins->GetTestModel();
|
|
}
|
|
|
|
EXPORT_C int WINAPI get_product_info(const char* sn, TProduct* pdata)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->GetProduct(sn, pdata);
|
|
}
|
|
|
|
EXPORT_C int WINAPI get_product_by_pos(EMapPos pos, int index, TProduct* pdata/* = 0*/)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->GetProductByPos(pos, index, pdata);
|
|
}
|
|
|
|
EXPORT_C int WINAPI get_product_list(EMapPos pos, TProduct* pdata/* = 0*/, int nsize/* = 0*/)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->GetProductList(pos, pdata, nsize);
|
|
}
|
|
|
|
EXPORT_C int WINAPI get_all_product_info(TProduct* pdata/* = 0*/, int nsize/* = 0*/)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, 0);
|
|
return ins->GetAllProduct(pdata, nsize);
|
|
}
|
|
|
|
EXPORT_C int WINAPI test_enable(int index, int benable/* = 1*/)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->TestEnable(index, benable);
|
|
}
|
|
|
|
EXPORT_C int WINAPI get_test_data(int index, TestMachine* pdata)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->GetMachine(index, pdata);
|
|
}
|
|
|
|
EXPORT_C int WINAPI test_debug(int index, const char* sn)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->TestDebug(index, sn);
|
|
}
|
|
|
|
EXPORT_C int WINAPI test_home(int index)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->TestHome(index);
|
|
}
|
|
|
|
EXPORT_C int WINAPI test_reset(int index)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->TestReset(index);
|
|
}
|
|
|
|
EXPORT_C int WINAPI vlog(const char* pszt, const char* pszmsg)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
return ins->BreakdownLog(pszt, pszmsg);
|
|
}
|
|
|
|
EXPORT_C int WINAPI wlog(const char* keyword, int errcode, const char*errmsg, const char*msg)
|
|
{
|
|
RETURN_CHK_NOPRT(g_bInit, ERR_NO_INIT);
|
|
|
|
return ins->EventTracker(keyword, errcode, errmsg, msg);
|
|
}
|
|
|
|
EXPORT_C int WINAPI regist_callback(callback fun)
|
|
{
|
|
return ins->regist_callback(fun);
|
|
} |