| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- #include "termalprintimpl.h"
- #include "log4vendor.h"
- ThermalPrintClassImpl* g_pThermalPrint = NULL;
- void __attribute__((destructor)) uninit()
- {
- if (g_pThermalPrint)
- {
- delete g_pThermalPrint;
- g_pThermalPrint = NULL;
- }
- }
- void __attribute__((constructor)) init()
- {
- }
- DEVICEBASE_API ErrorCodeEnum CreateDevComponent(DeviceBaseClass *&baseObj)
- {
- ErrorCodeEnum eRt = Error_Succeed;
- if(NULL == g_pThermalPrint)
- {
- g_pThermalPrint = new ThermalPrintClassImpl();
- baseObj = (DeviceBaseClass *)g_pThermalPrint;
- cmb::log_init_config config;
- config.log_level=CMB_LOG_LEVEL_ALL;
- config.dev_name = "WatchDog";
- #if defined(_MSC_VER)
- config.log_dir = ("C:\\rvc\\dbg\\");
- #else
- config.log_dir = ("/opt/rvc/dbg/");
- #endif //_MSC_VER
- std::string str;
- cmb::log4vendor::init(config, str);
- printf("init after: %s\n", str.c_str());
- }
- else
- {
- eRt = Error_AlreadyExist;
- }
- return eRt;
- }
- DEVICEBASE_API ErrorCodeEnum ReleaseDevComponent(DeviceBaseClass *&pBaseObj)
- {
- ErrorCodeEnum eRt = Error_Succeed;
- if(pBaseObj == (DeviceBaseClass*)g_pThermalPrint)
- {
- delete g_pThermalPrint;
- g_pThermalPrint = NULL;
- return Error_Succeed;
- }
- return Error_Param;
- }
|