本文整理汇总了C++中Notification::clearData方法的典型用法代码示例。如果您正苦于以下问题:C++ Notification::clearData方法的具体用法?C++ Notification::clearData怎么用?C++ Notification::clearData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Notification
的用法示例。
在下文中一共展示了Notification::clearData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: toDo
Notification ActionUpdateClient::toDo() {
pid_t child_pid;
child_pid = fork();
if (child_pid < 0) {
cout << getpid() << " > Fork failed!!" << endl;
abort();
}
if (child_pid == 0) {
cout << getpid() << " > Me voy a actualizar!!" << endl;
/*
* Esperamos 5 segundos simulando un trabajo
*/
sleep(10);
cout << getpid() << " > Termino la actualizacion, creo una conneccion y envio el resultado" << endl;
ConnectionSSL connection;
connection.setClient(this->connection->getClient());
connection.createEncryptedSocket();
Notification persistent_sender;
persistent_sender.setAction(ACTION_PERSISTENT_SENDER);
persistent_sender.addDataItem(JSONNode("Token", ACCESS_TOKEN));
OutcomingActionExecutor outcoming_executor(&connection);
outcoming_executor.writeAndWaitResponse(persistent_sender);
/*
* Envio los resultados obtenidos
*/
Notification response;
response.setAction(ACTION_NOTIFICATION_RESPONSE);
response.setParentId(this->notification.getId());
response.clearData();
response.addDataItem(JSONNode("UpdateStatus", "OK"));
outcoming_executor.writeAndWaitResponse(response);
/*
* Cierro la coneccion
*/
connection.informClosingToServer();
connection.manageCloseConnection(0);
}
Notification response;
response.setAction(ACTION_NOTIFICATION_RESPONSE);
response.setParentId(this->notification.getId());
response.clearData();
response.addDataItem(JSONNode("UpdateStatus", "INICIADO"));
return response;
}