/********************************************************************* * * Main Program. Open and subscribe for events for two sessions. * Then run the above test. * * *******************************************************************/ int main() { int ret = SAF_TEST_UNRESOLVED; SaHpiSessionIdT sessionId1; SaHpiSessionIdT sessionId2; if (openSession(&sessionId1) != SA_OK) { ret = SAF_TEST_UNRESOLVED; } else { if (openSession(&sessionId2) != SA_OK) { ret = SAF_TEST_UNRESOLVED; } else { if (subscribe(sessionId1) != SA_OK) { ret = SAF_TEST_UNRESOLVED; } else { if (subscribe(sessionId2) != SA_OK) { ret = SAF_TEST_UNRESOLVED; } else { ret = run_test(sessionId1, sessionId2); unsubscribe(sessionId2); } unsubscribe(sessionId1); } closeSession(sessionId2); } closeSession(sessionId1); } return ret; }
//=================== DESTROYER ============================= StatisticsCollector::~StatisticsCollector() { if(isSubscribed("arrival",listener)){ unsubscribe("arrival", listener); } if(isSubscribed("arrivalTime",listener)){ unsubscribe("arrivalTime", listener); } }
void StatisticsCollector::finish(){ this->arrivalPercentage.recordAs("arrivalPercentage"); this->arrivalTime.recordAs("arrivalTime"); if(isSubscribed("arrival",listener)){ unsubscribe("arrival", listener); } if(isSubscribed("arrivalTime",listener)){ unsubscribe("arrivalTime", listener); } }
void ConnectionBasedNodelet::connectionCallback(const ros::SingleSubscriberPublisher& pub) { if (verbose_connection_) { JSK_NODELET_INFO("New connection or disconnection is detected"); } if (!always_subscribe_) { boost::mutex::scoped_lock lock(connection_mutex_); for (size_t i = 0; i < publishers_.size(); i++) { ros::Publisher pub = publishers_[i]; if (pub.getNumSubscribers() > 0) { if (!ever_subscribed_) { ever_subscribed_ = true; } if (connection_status_ != SUBSCRIBED) { if (verbose_connection_) { JSK_NODELET_INFO("Subscribe input topics"); } subscribe(); connection_status_ = SUBSCRIBED; } return; } } if (connection_status_ == SUBSCRIBED) { if (verbose_connection_) { JSK_NODELET_INFO("Unsubscribe input topics"); } unsubscribe(); connection_status_ = NOT_SUBSCRIBED; } } }
void ConnectionBasedNodelet::cameraConnectionBaseCallback() { if (verbose_connection_) { JSK_NODELET_INFO("New image connection or disconnection is detected"); } if (!always_subscribe_) { boost::mutex::scoped_lock lock(connection_mutex_); for (size_t i = 0; i < camera_publishers_.size(); i++) { image_transport::CameraPublisher pub = camera_publishers_[i]; if (pub.getNumSubscribers() > 0) { if (!ever_subscribed_) { ever_subscribed_ = true; } if (connection_status_ != SUBSCRIBED) { if (verbose_connection_) { JSK_NODELET_INFO("Subscribe input topics"); } subscribe(); connection_status_ = SUBSCRIBED; } return; } } if (connection_status_ == SUBSCRIBED) { if (verbose_connection_) { JSK_NODELET_INFO("Unsubscribe input topics"); } unsubscribe(); connection_status_ = NOT_SUBSCRIBED; } } }
void InteractiveMarkerDisplay::updatePoses( const std::string& server_id, const std::vector<visualization_msgs::InteractiveMarkerPose>& marker_poses ) { M_StringToIMPtr& im_map = getImMap( server_id ); for ( size_t i=0; i<marker_poses.size(); i++ ) { const visualization_msgs::InteractiveMarkerPose& marker_pose = marker_poses[i]; if ( !validateFloats( marker_pose.pose ) ) { setStatusStd( StatusProperty::Error, marker_pose.name, "Pose message contains invalid floats!" ); return; } std::map< std::string, IMPtr >::iterator int_marker_entry = im_map.find( marker_pose.name ); if ( int_marker_entry != im_map.end() ) { int_marker_entry->second->processMessage( marker_pose ); } else { setStatusStd( StatusProperty::Error, marker_pose.name, "Pose received for non-existing marker '" + marker_pose.name ); unsubscribe(); return; } } }
NXTColorDisplay::~NXTColorDisplay() { unsubscribe(); clear(); delete cylinder_; delete tf_filter_; }
bool PubSubClient::unsubscribe(String topic) { if (!connected()) return false; MQTT::Unsubscribe unsub(topic); return unsubscribe(unsub); }
void unsubscribe(InputIterator const& topics_begin, InputIterator const& topics_end) { for(InputIterator it = topics_begin; it != topics_end; ++it) { unsubscribe(*it); } }
void msg_disconnectCb(const ros::SingleSubscriberPublisher&) { subscriber_count_--; if (subscriber_count_ == 0) { unsubscribe(); } }
NfcSender::~NfcSender() { nfc_unregister_snep_client(); nfc_stop_events(); unsubscribe(nfc_get_domain()); bps_shutdown(); }
static void sub_endpoint_update_handler(void *data, struct stasis_subscription *sub, struct stasis_message *message) { RAII_VAR(struct ast_json *, json, NULL, ast_json_unref); struct stasis_app *app = data; struct stasis_cache_update *update; struct ast_endpoint_snapshot *new_snapshot; struct ast_endpoint_snapshot *old_snapshot; const struct timeval *tv; ast_assert(stasis_message_type(message) == stasis_cache_update_type()); update = stasis_message_data(message); ast_assert(update->type == ast_endpoint_snapshot_type()); new_snapshot = stasis_message_data(update->new_snapshot); old_snapshot = stasis_message_data(update->old_snapshot); if (new_snapshot) { tv = stasis_message_timestamp(update->new_snapshot); json = simple_endpoint_event("EndpointStateChange", new_snapshot, tv); if (!json) { return; } app_send(app, json); } if (!new_snapshot && old_snapshot) { unsubscribe(app, "endpoint", old_snapshot->id, 1); } }
void PointCloud2Display::onDisable() { unsubscribe(); tf_filter_.clear(); PointCloudBase::onDisable(); }
void stress_subscriber::next_action_impl() { if ( !remaining_actions_ ) return; --remaining_actions_; const boost::int32_t rand = random( 1, 100 ); if ( rand < 30 ) { subscribe(); } else if ( rand < 60 ) { unsubscribe(); } else if ( rand < 90 ) { change(); } else { change_configuration(); } }
/*! \brief Function called when a contact is added */ static void mwi_contact_added(const void *object) { const struct ast_sip_contact *contact = object; struct ao2_iterator *mwi_subs; struct mwi_subscription *mwi_sub; const char *endpoint_id = ast_sorcery_object_get_id(contact->endpoint); if (ast_strlen_zero(contact->endpoint->subscription.mwi.mailboxes)) { return; } ao2_lock(unsolicited_mwi); mwi_subs = ao2_find(unsolicited_mwi, endpoint_id, OBJ_SEARCH_KEY | OBJ_MULTIPLE | OBJ_NOLOCK | OBJ_UNLINK); if (mwi_subs) { for (; (mwi_sub = ao2_iterator_next(mwi_subs)); ao2_cleanup(mwi_sub)) { unsubscribe(mwi_sub, NULL, 0); } ao2_iterator_destroy(mwi_subs); } create_mwi_subscriptions_for_endpoint(contact->endpoint, NULL, 0); ao2_unlock(unsolicited_mwi); mwi_contact_updated(object); }
void StereoImageDisplayBase::updateTopics() { unsubscribe(); reset(); subscribe(); context_->queueRender(); }
void DepthCloudDisplay::updateTopic() { unsubscribe(); reset(); subscribe(); context_->queueRender(); }
void PointCloudDisplay::onDisable() { unsubscribe(); cloud_->clear(); cloud_->setCloudVisible( false ); }
void OverlayMenuDisplay::onDisable() { if (overlay_) { overlay_->hide(); } unsubscribe(); }
void MarkerDisplay::onDisable() { unsubscribe(); tf_filter_->clear(); clearMarkers(); }
void LuaSystem::onDetach(Entity &entity) { // Iterate subscriptions LuaComponent *comp = entity.getComponent<LuaComponent>(); for(auto eventItr = comp->subscribedEvents.begin(); eventItr != comp->subscribedEvents.end(); eventItr++) { auto itr = m_subscribedScripts.find(*eventItr); if(itr == m_subscribedScripts.end()) continue; // Iterate entities associated with subscriptions for(std::size_t i = 0; i < itr->second.size(); i++) { // Unsubscribe entity if found if(itr->second[i] == &entity) { itr->second.erase(itr->second.begin() + i); // Unsubscribe from it entirely if none wants it, except the Reload event if(itr->first != "ReloadLua" && itr->second.empty()) { unsubscribe(itr->first); m_subscribedScripts.erase(itr); } break; } } } }
MacAddressHandler::~MacAddressHandler() { nfc_unregister_handover_listener(); nfc_stop_events(); unsubscribe(nfc_get_domain()); bps_shutdown(); }
void TrackDisplay::setTopic(const std::string& topic) { unsubscribe(); track_topic_ = topic; subscribe(); propertyChanged(topic_property_); }
void disconnectCb(const image_transport::SingleSubscriberPublisher&) { subscriber_count_--; if (subscriber_count_ == 0) { unsubscribe(); } }
RobotModelDisplay::~RobotModelDisplay() { unsubscribe(); delete robot_; delete urdf_; }
CameraDisplay::~CameraDisplay() { unsubscribe(); caminfo_tf_filter_->clear(); if( render_panel_ ) { if( panel_container_ ) { delete panel_container_; } else { delete render_panel_; } } delete bg_screen_rect_; delete fg_screen_rect_; bg_scene_node_->getParentSceneNode()->removeAndDestroyChild( bg_scene_node_->getName() ); fg_scene_node_->getParentSceneNode()->removeAndDestroyChild( fg_scene_node_->getName() ); delete caminfo_tf_filter_; }
static void sub_bridge_update_handler(void *data, struct stasis_subscription *sub, struct stasis_message *message) { struct ast_json *json = NULL; struct stasis_app *app = data; struct ast_bridge_snapshot_update *update; const struct timeval *tv; update = stasis_message_data(message); tv = stasis_message_timestamp(message); if (!update->new_snapshot) { json = simple_bridge_event("BridgeDestroyed", update->old_snapshot, tv); } else if (!update->old_snapshot) { json = simple_bridge_event("BridgeCreated", update->new_snapshot, tv); } else if (update->new_snapshot && update->old_snapshot && strcmp(update->new_snapshot->video_source_id, update->old_snapshot->video_source_id)) { json = simple_bridge_event("BridgeVideoSourceChanged", update->new_snapshot, tv); if (json && !ast_strlen_zero(update->old_snapshot->video_source_id)) { ast_json_object_set(json, "old_video_source_id", ast_json_string_create(update->old_snapshot->video_source_id)); } } if (json) { app_send(app, json); ast_json_unref(json); } if (!update->new_snapshot && update->old_snapshot) { unsubscribe(app, "bridge", update->old_snapshot->uniqueid, 1); } }
void on_link_close(proton::event &e) { proton::link lnk = e.link(); if (!!lnk.sender()) { unsubscribe(lnk.sender()); } }
void CameraPub::updateTopic() { unsubscribe(); reset(); subscribe(); context_->queueRender(); }
~PhaseSpaceLocalization() { unsubscribe("phase_space_snapshot") ; unadvertise("localizedpose") ; if (m_tfServer) delete m_tfServer; }