void dl1416_device::device_reset() { int i; UINT16 pattern; /* disable all lines */ m_chip_enable = FALSE; m_write_enable = FALSE; m_cursor_enable = FALSE; /* randomize digit and cursor memory */ for (i = 0; i < 4; i++) { m_digit_ram[i] = machine().rand()&0x3F; // TODO: only enable the following line if the device actually has a cursor (DL1416T and DL1416B), if DL1414 then cursor is always 0! //m_cursor_state[i] = ((device->machine().rand()&0xFF) >= 0x80) ? CURSOR_ON : CURSOR_OFF; m_cursor_state[i] = CURSOR_OFF; pattern = dl1416t_segments[m_digit_ram[i]]; /* If cursor for this digit position is enabled and segment is not */ /* undefined, replace digit with cursor */ if ((m_cursor_state[i] == CURSOR_ON) && (pattern != SEG_UNDEF)) pattern = SEG_CURSOR; /* Undefined characters are replaced by blanks */ if (pattern == SEG_UNDEF) pattern = SEG_BLANK; /* Call update function */ if (!m_update.isnull()) m_update((offs_t)i, pattern); } }
void ServerImpl::update() { boost::unique_lock<boost::mutex> lock(m_runControl); if (m_everStarted) { throw std::logic_error("Can't call update() if you've ever started " "the server in its own thread!"); } m_update(); }
void Camera::setOrigin(const Vector3& newOrigin) { _origin = newOrigin; _prevOrigin = _origin; updateModelview(); m_update(); GlobalCamera().movedNotify(); }
void Camera::setAngles(const Vector3& newAngles) { _angles = newAngles; _prevAngles = _angles; updateModelview(); m_update(); GlobalCamera().movedNotify(); }
ScanObject::ScanObject( const std::string &path, unsigned int res_x, unsigned int res_y, unsigned int res_z, mcAlgorithmFlag algorithm, const glm::vec3 &position, const glm::quat &orientation) : MeshObject(position, orientation), m_scan(path), // Read the scan from image files m_resX(res_x), m_resY(res_y), m_resZ(res_z) { // Update the isosurface mesh m_update(); }
void Camera::keyMove() { m_mouseMove.flush(); //rMessage() << "keymove... "; float time_seconds = m_keycontrol_timer.elapsed_msec() / static_cast<float>(msec_per_sec); m_keycontrol_timer.start(); if (time_seconds > 0.05f) { time_seconds = 0.05f; // 20fps } keyControl(time_seconds * 5.0f); m_update(); GlobalCamera().movedNotify(); }
bool ServerImpl::m_loop() { bool shouldContinue; { /// @todo More elegant way of running queued things than grabbing a /// mutex each time through? boost::unique_lock<boost::mutex> lock(m_mainThreadMutex); m_update(); shouldContinue = m_run.shouldContinue(); } if (m_currentSleepTime > 0) { osvr::util::time::microsleep(m_currentSleepTime); } return shouldContinue; }
void IsosurfaceObject::setMax(const Vec3 &max) { m_max = max; m_update(); }
void IsosurfaceObject::setMin(const Vec3 &min) { m_min = min; m_update(); }
void IsosurfaceObject::setScalarField(std::shared_ptr<ScalarField> sf) { m_sf = sf; m_update(); }
void IsosurfaceObject::setAlgorithm(mcAlgorithmFlag algorithm) { m_algorithm = algorithm; m_update(); }
PureClientContext::PureClientContext(const char appId[], const char host[], common::ClientContextDeleter del) : ::OSVR_ClientContextObject(appId, del), m_host(host), m_ifaceMgr(m_pathTreeOwner, m_factory, *static_cast<common::ClientContext *>(this)) { if (!m_network.isUp()) { throw std::runtime_error("Network error: " + m_network.getError()); } /// Create all the remote handler factories. populateRemoteHandlerFactory(m_factory, m_vrpnConns); std::string sysDeviceName = std::string(common::SystemComponent::deviceName()) + "@" + host; m_mainConn = m_vrpnConns.getConnection( common::SystemComponent::deviceName(), host); /// Create the system client device. m_systemDevice = common::createClientDevice(sysDeviceName, m_mainConn); m_systemComponent = m_systemDevice->addComponent(common::SystemComponent::create()); using DedupJsonFunction = common::DeduplicatingFunctionWrapper<Json::Value const &>; m_systemComponent->registerReplaceTreeHandler( DedupJsonFunction([&](Json::Value nodes) { logger()->debug("Got updated path tree, processing"); // Replace localhost before we even convert the json to a tree. // replace the @localhost with the correct host name // in case we are a remote client, otherwise the connection // would fail replaceLocalhostServers(nodes, m_host); // Tree observers will handle destruction/creation of remote // handlers. m_pathTreeOwner.replaceTree(nodes); })); typedef std::chrono::system_clock clock; auto begin = clock::now(); // Spin the update to get a connection auto connEnd = begin + STARTUP_CONNECT_TIMEOUT; while (clock::now() < connEnd && !m_gotConnection) { m_update(); std::this_thread::sleep_for(STARTUP_LOOP_SLEEP); } if (!m_gotConnection) { logger()->notice() << "Could not connect to OSVR server in the timeout period " "allotted of " << std::chrono::duration_cast<std::chrono::milliseconds>( STARTUP_CONNECT_TIMEOUT) .count() << "ms"; return; // Bail early if we don't even have a connection } // Spin the update to get a path tree auto treeEnd = begin + STARTUP_TREE_TIMEOUT; while (clock::now() < treeEnd && !m_pathTreeOwner) { m_update(); std::this_thread::sleep_for(STARTUP_LOOP_SLEEP); } auto timeToStartup = (clock::now() - begin); // this message is just "info" if we're all good, but "notice" if we // aren't fully set up yet. logger()->log(m_pathTreeOwner ? util::log::LogLevel::info : util::log::LogLevel::notice) << "Connection process took " << std::chrono::duration_cast<std::chrono::milliseconds>( timeToStartup) .count() << "ms: " << (m_gotConnection ? "have connection to server, " : "don't have connection to server, ") << (m_pathTreeOwner ? "have path tree" : "don't have path tree"); }
void DeviceComponent::update() { m_update(); }
void Camera::mouseMove(int x, int y) { //rMessage() << "mousemove... "; freeMove(-x, -y); m_update(); GlobalCamera().movedNotify(); }
void device_cococart_interface::cart_base_changed(void) { if (!m_update.isnull()) m_update(get_cart_base()); }
void JointClientContext::m_sendRoute(std::string const &route) { m_systemComponent->sendClientRouteUpdate(route); m_update(); }
PureClientContext::PureClientContext(const char appId[], const char host[], common::ClientContextDeleter del) : ::OSVR_ClientContextObject(appId, del), m_host(host) { if (!m_network.isUp()) { throw std::runtime_error("Network error: " + m_network.getError()); } /// Create all the remote handler factories. populateRemoteHandlerFactory(m_factory, m_vrpnConns); std::string sysDeviceName = std::string(common::SystemComponent::deviceName()) + "@" + host; m_mainConn = m_vrpnConns.getConnection( common::SystemComponent::deviceName(), host); /// Create the system client device. m_systemDevice = common::createClientDevice(sysDeviceName, m_mainConn); m_systemComponent = m_systemDevice->addComponent(common::SystemComponent::create()); #define OSVR_USE_DEDUP #ifdef OSVR_USE_DEDUP typedef common::DeduplicatingFunctionWrapper<Json::Value const &> DedupJsonFunction; m_systemComponent->registerReplaceTreeHandler(DedupJsonFunction( [&](Json::Value const &nodes) { m_handleReplaceTree(nodes); })); #else // Just for testing purposes, figuring out why we end up looping too // much. m_systemComponent->registerReplaceTreeHandler( [&](Json::Value const &nodes, util::time::TimeValue const &) { m_handleReplaceTree(nodes); }); #endif typedef std::chrono::system_clock clock; auto begin = clock::now(); // Spin the update to get a connection auto connEnd = begin + STARTUP_CONNECT_TIMEOUT; while (clock::now() < connEnd && !m_gotConnection) { m_update(); std::this_thread::sleep_for(STARTUP_LOOP_SLEEP); } if (!m_gotConnection) { OSVR_DEV_VERBOSE( "Could not connect to OSVR server in the timeout period " "allotted of " << std::chrono::duration_cast<std::chrono::milliseconds>( STARTUP_CONNECT_TIMEOUT) .count() << "ms"); return; // Bail early if we don't even have a connection } // Spin the update to get a path tree auto treeEnd = begin + STARTUP_TREE_TIMEOUT; while (clock::now() < treeEnd && !m_gotTree) { m_update(); std::this_thread::sleep_for(STARTUP_LOOP_SLEEP); } auto timeToStartup = (clock::now() - begin); OSVR_DEV_VERBOSE( "Connection process took " << std::chrono::duration_cast<std::chrono::milliseconds>( timeToStartup) .count() << "ms: " << (m_gotConnection ? "have connection to server, " : "don't have connection to server, ") << (m_gotTree ? "have path tree" : "don't have path tree")); }