本文整理汇总了C++中rho::apigenerator::CMethodResult::hasCallback方法的典型用法代码示例。如果您正苦于以下问题:C++ CMethodResult::hasCallback方法的具体用法?C++ CMethodResult::hasCallback怎么用?C++ CMethodResult::hasCallback使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rho::apigenerator::CMethodResult
的用法示例。
在下文中一共展示了CMethodResult::hasCallback方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setKeyCallback
void CKeyModule::setKeyCallback(bool bDispatch, int iKeyValue, rho::apiGenerator::CMethodResult pCallback)
{
CKeyMapEntry *pentry;
if (iKeyValue == ALL_KEYS)
{
if (pCallback.hasCallback())
{
pInstanceData->psAllKeysNavigate = pCallback;
pInstanceData->bAllKeysDispatch = bDispatch;
}
else
{
// Blank out the existing callback
pInstanceData->psAllKeysNavigate = pCallback;
}
}
else
{
pentry = pInstanceData->pKeyMap->Find(iKeyValue);
if (pentry)
{
// If the user has not specified a callback then delete the mapping
if (!pCallback.hasCallback())
pInstanceData->pKeyMap->DeleteEntry(iKeyValue);
else
{
pentry->SetNavigate(pCallback);
pentry->bDispatch = bDispatch;
}
}
else
{
// No Current mapping, add the mapping
pentry = new CKeyMapEntry(iKeyValue, pCallback , bDispatch);
pInstanceData->pKeyMap->AddEntry(pentry);
}
}
if (!pInstanceData->psAllKeysNavigate.hasCallback() &&
!pInstanceData->pKeyMap->HasContents() &&
pInstanceData->nHomeKey == 0)
ClearRegistrationsFromOOPEngine();
else
RegisterFromOOPEngine();
}
示例2: enumerateSupportedControlLanguages
void CPrinterZebraImpl::enumerateSupportedControlLanguages(rho::apiGenerator::CMethodResult& oResult)
{
LOG(TRACE) + "[zebra] enumerateSupportedControlLanguages send";
EnumerateSupportedControlLanguagesTask *task = new EnumerateSupportedControlLanguagesTask(m_ID, oResult);
if (oResult.hasCallback())
{
ThreadMessageQueue::getInstance()->addQueueCommand(task);
}
else
{
ThreadMessageQueue::getInstance()->processCommand(task);
oResult.set(task->getResult().getStringArray());
delete task;
}
}
示例3: connect
void CPrinterZebraImpl::connect(rho::apiGenerator::CMethodResult& oResult)
{
LOG(TRACE) + "[zebra] connect send";
ConnectPrinterTask *task = new ConnectPrinterTask(m_ID, oResult);
if (oResult.hasCallback())
{
ThreadMessageQueue::getInstance()->addQueueCommand(task);
}
else
{
ThreadMessageQueue::getInstance()->processCommand(task);
rho::String str = task->getResult().getString();
oResult.set(str);
delete task;
}
}
示例4: readLogFile
virtual void readLogFile(int limit, rho::apiGenerator::CMethodResult& oResult)
{
bool bOldSaveToFile = LOGCONF().isLogToFile();
LOGCONF().setLogToFile(false);
rho::common::CRhoFile oFile;
if ( oFile.open( LOGCONF().getLogFilePath().c_str(), rho::common::CRhoFile::OpenReadOnly) )
{
int nFileSize = oFile.size();
int nPos = LOGCONF().getLogTextPos();
int nMaxSize = nFileSize > nPos ? nFileSize : nPos;
if ( limit <= 0 || limit > nMaxSize)
limit = nMaxSize;
oResult.setCollectionMode(true);
oResult.set("");
oResult.setCollectionMode(false);
oResult.getString().resize(limit);
char* szStr = (char*)oResult.getString().c_str();
if ( limit <= nPos )
{
oFile.setPosTo(nPos-limit);
oFile.readData(szStr,0,limit);
}else
{
oFile.setPosTo(nFileSize-(limit-nPos));
int nRead = oFile.readData(szStr,0,limit);
oFile.setPosTo(0);
oFile.readData(szStr,nRead,limit-nRead);
}
}
LOGCONF().setLogToFile(bOldSaveToFile);
if ( oResult.hasCallback() )
oResult.callCallback();
}
示例5: stop
void CSensorImpl::stop(rho::apiGenerator::CMethodResult& oResult)
{
LOG(TRACE) + "Received request to stop sensor: " + m_sensorId;
if (NULL == m_rawSensor)
{
oResult.setError("No sensor found. Cannot get stop.");
}
else
{
this->m_rawSensor->Stop();
if ((NULL != m_callbackMethodResult) && (m_callbackMethodResult->hasCallback()))
{
m_callbackMethodResult = NULL;
}
rho::common::CMutexLock lock(m_cs);
m_cache.clear();
}
}
示例6: connectWithOptions
void CPrinterZebraImpl::connectWithOptions( const rho::Hashtable<rho::String, rho::String>& options, rho::apiGenerator::CMethodResult& oResult)
{
LOG(TRACE) + "[zebra] connectWithOptions send";
rho::apiGenerator::CMethodResult propResult;
rho::Hashtable<rho::String, rho::String> fullOptions = options;
ConnectWithParametersPrinterTask *task = new ConnectWithParametersPrinterTask(m_ID, fullOptions, oResult);
if (oResult.hasCallback())
{
ThreadMessageQueue::getInstance()->addQueueCommand(task);
}
else
{
ThreadMessageQueue::getInstance()->processCommand(task);
rho::String str = task->getResult().getString();
oResult.set(str);
delete task;
}
}
示例7: start
void CSensorImpl::start(rho::apiGenerator::CMethodResult& oResult)
{
LOG(TRACE) + "Received request to start sensor: " + m_sensorId;
if (NULL == m_rawSensor)
{
oResult.setError("No sensor found. Cannot get start.");
}
else
{
//const char * status = m_rawSensor->getStatus();
this->m_rawSensor->Start();
rho::common::CMutexLock lock(m_cs);
if (oResult.hasCallback())
{
m_callbackMethodResult = &oResult;
}
else
{
m_callbackMethodResult = NULL;
}
}
}
示例8: setTriggerCallback
void CKeyModule::setTriggerCallback(rho::apiGenerator::CMethodResult pCallback)
{
rho::apiGenerator::CMethodResult blank;
if (pCallback.hasCallback())
{
// User has provided a callback to listen for trigger presses
if (!StartTriggerWatch())
{
LOG(WARNING) + "Unable to listen for the device trigger";
pInstanceData->psTriggerNavigate = blank;
}
else
{
pInstanceData->psTriggerNavigate = pCallback;
}
}
else
{
// User has asked to stop listening for Trigger callbacks
StopTriggerWatch();
pInstanceData->psTriggerNavigate = blank;
}
}
示例9: createTabbarEx
void CMainWindow::createTabbarEx(const rho::Vector<rho::String>& tabbarElements, const rho::Hashtable<rho::String, rho::String>& tabBarProperties, rho::apiGenerator::CMethodResult& oResult)
{
if (!rho_rhodesapp_check_mode())
return;
std::auto_ptr<QColor> background_color (NULL);
for ( Hashtable<rho::String, rho::String>::const_iterator it = tabBarProperties.begin(); it != tabBarProperties.end(); ++it )
{
const char *name = (it->first).c_str();
const char *value = (it->second).c_str();
if (strcasecmp(name, "backgroundColor") == 0)
background_color.reset(new QColor(getColorFromString(value)));
}
((QtMainWindow*)qtMainWindow)->tabbarInitialize();
for (int i = 0; i < (int)tabbarElements.size(); ++i)
{
const char *label = NULL;
const char *action = NULL;
const char *icon = NULL;
const char *reload = NULL;
const char *colored_icon = NULL;
std::auto_ptr<QColor> selected_color (NULL);
const char *disabled = NULL;
std::auto_ptr<QColor> web_bkg_color (NULL);
const char* use_current_view_for_tab = NULL;
CJSONEntry oEntry(tabbarElements[i].c_str());
if ( oEntry.hasName("label") )
label = oEntry.getString("label");
if ( oEntry.hasName("action") )
action = oEntry.getString("action");
if ( oEntry.hasName("icon") )
icon = oEntry.getString("icon");
if ( oEntry.hasName("coloredIcon") )
colored_icon = oEntry.getString("coloredIcon");
if ( oEntry.hasName("reload") )
reload = oEntry.getString("reload");
if ( oEntry.hasName("selectedColor") )
selected_color.reset(new QColor(getColorFromString(oEntry.getString("selectedColor"))));
if ( oEntry.hasName("disabled") )
disabled = oEntry.getString("disabled");
if ( oEntry.hasName("useCurrentViewForTab") )
{
use_current_view_for_tab = oEntry.getString("useCurrentViewForTab");
if (strcasecmp(use_current_view_for_tab, "true") == 0) {
action = "none";
}
}
if (oEntry.hasName("backgroundColor"))
web_bkg_color.reset(new QColor(getColorFromString(oEntry.getString("backgroundColor"))));
if (label == NULL)
label = "";
if ( label == NULL || action == NULL) {
RAWLOG_ERROR("Illegal argument for create_nativebar");
return;
}
QtMainWindow::QTabBarRuntimeParams tbrp;
tbrp["label"] = QString(label);
tbrp["action"] = QString(action);
tbrp["reload"] = charToBool(reload);
tbrp["use_current_view_for_tab"] = charToBool(use_current_view_for_tab);
tbrp["background_color"] = background_color.get() != NULL ? background_color->name() : QString("");
tbrp["selected_color"] = selected_color.get() != NULL ? selected_color->name() : QString("");
String strIconPath = icon ? CFilePath::join( RHODESAPP().getAppRootPath(), icon) : String();
((QtMainWindow*)qtMainWindow)->tabbarAddTab(QString(label), icon ? strIconPath.c_str() : NULL, charToBool(disabled), web_bkg_color.get(), tbrp);
}
if (oResult.hasCallback())
((QtMainWindow*)qtMainWindow)->tabbarSetSwitchCallback(oResult);
((QtMainWindow*)qtMainWindow)->tabbarShow();
m_started = true;
}
示例10: CreateTabbarEx
void CNativeTabbar::CreateTabbarEx(const rho::Vector<rho::String>& tabbarElements, const rho::Hashtable<rho::String, rho::String>& tabBarProperties, rho::apiGenerator::CMethodResult& oResult)
{
if (!rho_rhodesapp_check_mode() )
return;
RemoveTabbar();
COLORREF rgbBackColor;
bool bHiddenTabs = false, bCreateOnInit = false;
for ( Hashtable<rho::String, rho::String>::const_iterator it = tabBarProperties.begin(); it != tabBarProperties.end(); ++it )
{
const char *name = (it->first).c_str();
const char *value = (it->second).c_str();
if (strcasecmp(name, "backgroundColor") == 0)
rgbBackColor = getColorFromString(value);
if (strcasecmp(name, "hiddenTabs") == 0)
bHiddenTabs = strcasecmp(value, "true") == 0;
if (strcasecmp(name, "createOnInit") == 0)
bCreateOnInit = strcasecmp(value, "true") == 0;
}
if ( !bHiddenTabs )
{
LOG(WARNING) + "Illegal argument for create_nativebar: hiddenTabs should be true for Windows Mobile and Windows CE.";
bHiddenTabs = true;
}
int nStartTab = -1;
for (int i = 0; i < (int)tabbarElements.size(); ++i)
{
const char *label = NULL;
const char *action = NULL;
const char *icon = NULL;
const char *reload = NULL;
const char *colored_icon = NULL;
COLORREF selected_color;
const char *disabled = NULL;
COLORREF web_bkg_color;
const char* use_current_view_for_tab = NULL;
bool bUseCurrentViewForTab = false, bReloadPage = false, bPerishable = false, bCreateOnInitTab = false;
CJSONEntry oEntry(tabbarElements[i].c_str());
if ( oEntry.hasName("label") )
label = oEntry.getString("label");
if ( oEntry.hasName("action") )
action = oEntry.getString("action");
if ( oEntry.hasName("icon") )
icon = oEntry.getString("icon");
if ( oEntry.hasName("coloredIcon") )
colored_icon = oEntry.getString("coloredIcon");
if ( oEntry.hasName("reload") )
{
reload = oEntry.getString("reload");
if (strcasecmp(reload, "true") == 0)
bReloadPage = true;
}
if ( oEntry.hasName("perishable") )
{
const char* perishable = oEntry.getString("perishable");
if (strcasecmp(perishable, "true") == 0)
bPerishable = true;
}
if ( oEntry.hasName("createOnInit") )
{
const char* createOnInit = oEntry.getString("createOnInit");
if (strcasecmp(createOnInit, "true") == 0)
bCreateOnInitTab = true;
}
if ( oEntry.hasName("selectedColor") )
selected_color = getColorFromString(oEntry.getString("selectedColor"));
if ( oEntry.hasName("disabled") )
disabled = oEntry.getString("disabled");
if ( oEntry.hasName("useCurrentViewForTab") )
{
use_current_view_for_tab = oEntry.getString("useCurrentViewForTab");
if (strcasecmp(use_current_view_for_tab, "true") == 0)
bUseCurrentViewForTab = true;
}
if (oEntry.hasName("backgroundColor"))
web_bkg_color = getColorFromString(oEntry.getString("backgroundColor"));
if (label == NULL)
label = "";
if (action == NULL)
action = "";
m_arTabs.addElement(CTabBarItem(action, label, bUseCurrentViewForTab, bReloadPage, bPerishable, bCreateOnInitTab));
if (m_strStartTabName.length()>0 && m_strStartTabName == label)
nStartTab = i;
}
if ( oResult.hasCallback() )
m_oCallback = oResult;
//.........这里部分代码省略.........