void FBService::DeviceConnected(const IDevicePtr& device, mc::IMessageRef /* authMessage */) { // Set SFB flags. ServiceDescriptorPtr descriptor = device->FindDescriptor(ClassRoot_::GetSelf()); descriptor->Properties()->PutProperty(PROP_SFB_SUPPORT, false); descriptor->Properties()->PutProperty(PROP_SFB_REQUIRED, false); descriptor->Properties()->PutProperty(PROP_SFB_FULLSCREEN, false); }
void FBService::ServiceRequested(const IDevicePtr& device) { // Update SFB flags. ServiceDescriptorPtr descriptor = device->FindDescriptor(ClassRoot_::GetSelf()); descriptor->Properties()->PutProperty(PROP_SFB_SUPPORT, true); descriptor->Properties()->PutProperty(PROP_SFB_REQUIRED, true); descriptor->Properties()->PutProperty(PROP_SFB_FULLSCREEN, true); }
mc::result FBService::HandleControlMessage(const IDevicePtr& device, mc::IProtocolRef stream, mc::IMessageRef message) { // Check whether SFB is still required by the device. const int command = message->GetProperty(SFB::ControlMessage::PROP_COMMAND).toInt(); bool sfbRequired = false; if ( SFB::ControlMessage::COMMAND_START == command ) { sfbRequired = true; } else if ( SFB::ControlMessage::COMMAND_STOP == command ) { sfbRequired = false; } // Update SFB flags. ServiceDescriptorPtr descriptor = device->FindDescriptor(ClassRoot_::GetSelf()); descriptor->Properties()->PutProperty(PROP_SFB_REQUIRED, sfbRequired); // Perform initialization, when SFB is turned on again. if ( sfbRequired ) { // Send initialization message. stream->Send(InitHandler::InitMessage()); } // Update service status. TriggerManagerStatus(); return mc::_S_OK; }
mc::result FBService::HandleDeviceRequest(const IDevicePtr& device, mc::IProtocolRef stream, mc::IMessageRef /* message */) { // Send requested device info. stream->Send( mc::Class< SFB::DeviceInfo >::Create( RequestDevice::primaryDisplayId_, HardwareProvider::Instance().GetDisplayControl()->Width(), HardwareProvider::Instance().GetDisplayControl()->Height(), std::string("Primary Display")) ); // Request full screen on the next update. ServiceDescriptorPtr descriptor = device->FindDescriptor(ClassRoot_::GetSelf()); descriptor->Properties()->PutProperty(PROP_SFB_FULLSCREEN, true); return mc::_S_OK; }
mc::result InitHandler::Handle(const IDevicePtr& device) { ServiceDescriptorPtr descriptor = device->FindDescriptor(serviceHandler_); bool notify = descriptor->Properties()->GetProperty(FBService::PROP_SFB_REQUIRED).toBool(); if ( notify ) { mc::MutexScope locker( descriptor->StreamsLock() ); if ( descriptor->StreamsCount() > 0 ) { mc::IProtocolPtr stream( descriptor->StreamAtIndex(0) ); stream->Send( InitMessage() ); } } return mc::_S_OK; }