本文整理汇总了C++中Invocation::invoke方法的典型用法代码示例。如果您正苦于以下问题:C++ Invocation::invoke方法的具体用法?C++ Invocation::invoke怎么用?C++ Invocation::invoke使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Invocation
的用法示例。
在下文中一共展示了Invocation::invoke方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sendActionsForControlEvents
void Control::sendActionsForControlEvents(EventType controlEvents)
{
// For each control events
for (int i = 0; i < kControlEventTotalNumber; i++)
{
// If the given controlEvents bitmask contains the curent event
if (((int)controlEvents & (1 << i)))
{
// Call invocations
// <Invocation*>
Array* invocationList = this->dispatchListforControlEvent((Control::EventType)(1<<i));
Object* pObj = NULL;
CCARRAY_FOREACH(invocationList, pObj)
{
Invocation* invocation = static_cast<Invocation*>(pObj);
invocation->invoke(this);
}
//Call ScriptFunc
if (kScriptTypeLua == _scriptType)
{
cocos2d::BasicScriptData data(this,(void*)&controlEvents);
cocos2d::ScriptEvent event(cocos2d::kControlEvent,(void*)&data);
cocos2d::ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
}
}
示例2: execute
void ActionInvokePhone::execute(ExecutionState* state)
{
DataModelLogger* RUNLOG = state->getLogger();
// Retrieve desired action
std::string action = getParameter("ACTION", state);
// Determine parameters
std::string targetId = "";
std::string invokeAction = "";
std::string mimeType = "";
std::string uri = "";
QByteArray data = "";
if (action == "") {
RUNLOG->error("Select an action to perform");
return;
} else if (action == "OPEN_CALL_LOGS") {
invokeAction = "bb.action.OPEN";
mimeType = "application/vnd.blackberry.calllog.id";
} else if (action == "CALL_NUMBER") {
invokeAction = "bb.action.DIAL";
mimeType = "application/vnd.blackberry.phone.startcall";
QVariantMap map;
map.insert("number", QString::fromStdString(getParameter("NUMBER", state)));
data = bb::PpsObject::encode(map, NULL);
} else if (action == "CALL_EMERGENCY") {
invokeAction = "bb.action.EMERGENCY_CALL";
mimeType = "application/vnd.blackberry.phone.startcall";
} else {
LOG->error(SSTR("Error invoking, unknown desired action: " << action));
}
Invocation* invocation = new Invocation();
bb::system::InvokeTargetReply* reply = invocation->invoke(targetId, invokeAction, mimeType,
uri, data);
if (!reply->isFinished()) {
RUNLOG->error("Timed out invoking target");
return;
} else if (reply->error() != bb::system::InvokeReplyError::None) {
RUNLOG->error(
"Target invoke failed: " + Invocation::errorMessageToString(reply->error()));
return;
}
}
示例3: execute
void ActionInvokeBbm::execute(ExecutionState* state)
{
DataModelLogger* RUNLOG = state->getLogger();
// Retrieve desired action
std::string action = getParameter("ACTION", state);
// Determine parameters
std::string targetId = "";
std::string invokeAction = "";
std::string mimeType = "";
std::string uri = "";
std::string data = "";
if (action == "") {
RUNLOG->error("Select an action to perform");
return;
} else if (action == "SHARE_TEXT_TO_PIN") {
targetId = "sys.bbm.sharehandler";
invokeAction = "bb.action.SHARE";
mimeType = "text/plain";
data = getParameter("TEXT", state);
} else if (action == "SHARE_FILE_TO_PIN") {
targetId = "sys.bbm.sharehandler";
invokeAction = "bb.action.SHARE";
uri = getParameter("FILE", state);
} else if (action == "SHARE_TEXT_TO_GROUP") {
targetId = "sys.bbgroups.sharehandler";
invokeAction = "bb.action.SHARE";
mimeType = "text/plain";
data = getParameter("TEXT", state);
} else if (action == "SHARE_FILE_TO_GROUP") {
targetId = "sys.bbgroups.sharehandler";
invokeAction = "bb.action.SHARE";
uri = getParameter("FILE", state);
} else if (action == "SHARE_TEXT_TO_CHANNEL") {
targetId = "sys.channels.sharehandler";
invokeAction = "bb.action.SHARE";
mimeType = "text/plain";
data = getParameter("TEXT", state);
} else if (action == "SHARE_FILE_TO_CHANNEL") {
targetId = "sys.channels.sharehandler";
invokeAction = "bb.action.SHARE";
uri = getParameter("FILE", state);
} else if (action == "OPEN_BBM") {
targetId = "sys.bbm";
invokeAction = "bb.action.OPEN";
} else if (action == "SET_DISPLAY_PIC") {
targetId = "sys.bbm.imagehandler";
invokeAction = "bb.action.SET";
uri = getParameter("PICTURE_FILE", state);
} else if (action == "OPEN_OR_INVITE") {
targetId = "sys.bbm.sharehandler";
invokeAction = "bb.action.BBMCHAT";
uri = SSTR("pin:" << getParameter("PIN", state));
} else if (action == "AUDIO_CALL") {
targetId = "sys.service.videochat";
invokeAction = "bb.action.OPEN";
data = SSTR("dest=" << getParameter("PIN", state) << "&video=0");
} else if (action == "VIDEO_CALL") {
targetId = "sys.service.videochat";
invokeAction = "bb.action.OPEN";
data = SSTR("dest=" << getParameter("PIN", state) << "&video=1");
} else if (action == "OPEN_CHANNEL") {
targetId = "sys.bbm.channels.card.previewer";
invokeAction = "bb.action.OPENBBMCHANNEL";
uri = SSTR("bbmc:" << getParameter("PIN", state));
} else {
LOG->error(SSTR("Error invoking, unknown desired action: " << action));
}
Invocation* invocation = new Invocation();
bb::system::InvokeTargetReply* reply = invocation->invoke(targetId, invokeAction, mimeType,
uri, data);
if (!reply->isFinished()) {
RUNLOG->error("Timed out invoking target");
return;
} else if (reply->error() != bb::system::InvokeReplyError::None) {
RUNLOG->error(
"Target invoke failed: " + Invocation::errorMessageToString(reply->error()));
return;
}
}