public bool Import(int maxTimeOut = int.MaxValue) { rosSocket.CallService("/rosapi/get_param", typeof(ParamValueString), receiveRobotName, new ParamName("/robot/name")); ServiceReceiver robotDescriptionReceiver = new ServiceReceiver(rosSocket, "/rosapi/get_param", new ParamName("/robot_description"), Path.DirectorySeparatorChar + "robot_description.urdf", typeof(ParamValueString)); robotDescriptionReceiver.ReceiveEventHandler += receiveRobotDescription; return(WaitHandle.WaitAll(Status.Values.ToArray(), maxTimeOut)); }
public override void OnCreate() { base.OnCreate(); Receiver = new ServiceReceiver(this); var filter = new IntentFilter(ActionKeyStart); RegisterReceiver(Receiver, filter); IsRegisteredSensor = false; BcoreManager = new BcoreManager(this); }
private void receiveRobotDescription(ServiceReceiver serviceReciever, object serviceResponse) { string robotDescription = formatTextFileContents(((ParamValueString)serviceResponse).value); Thread importResourceFilesThread = new Thread(() => importResourceFiles(robotDescription)); importResourceFilesThread.Start(); Thread writeTextFileThread = new Thread(() => writeTextFile((string)serviceReciever.HandlerParameter, robotDescription)); writeTextFileThread.Start(); Status["robotDescriptionReceived"].Set(); }
private void receiveResourceFile(ServiceReceiver serviceReceiver, object serviceResponse) { byte[] fileContents = ((ParamValueByte)serviceResponse).value; Uri resourceFileUri = new Uri(((ParamName)serviceReceiver.ServiceParameter).name); if (isColladaFile(resourceFileUri)) { Thread importResourceFilesThread = new Thread(() => importDaeTextureFiles(resourceFileUri, System.Text.Encoding.UTF8.GetString(fileContents))); importResourceFilesThread.Start(); } Thread writeTextFileThread = new Thread(() => writeBinaryResponseToFile((string)serviceReceiver.HandlerParameter, fileContents)); writeTextFileThread.Start(); updateFileRequestStatus(resourceFileUri); }
private void OnDispose() { ServiceConnectionDispose(); _serviceReceiver?.Dispose(); _serviceReceiver = null; if (_serviceQueue != null) { foreach (var item in _serviceQueue) { item?.Dispose(); } _serviceQueue.Clear(); _serviceQueue = null; } try { if (!string.IsNullOrEmpty(_compressFileName)) { using (var zipFile = new Java.IO.File(_compressFileName)) { using (var parent = zipFile.ParentFile) { if (parent?.Exists() == true) { var files = parent.ListFiles(); foreach (var file in files) { file.Delete(); } } } } } } catch (Exception ex) { Log.Debug(ex); } finally { _compressFileName = null; } }
protected override void OnDestroy() { try { UnsubscribeEvents(); if (_cancellationTokenSource != null) { _cancellationTokenSource.Cancel(); _cancellationTokenSource.Dispose(); _cancellationTokenSource = null; } _selectedWidgetId = null; _widgetId = null; _serviceConnection?.Dispose(); _serviceConnection = null; _serviceReceiver?.Dispose(); _serviceReceiver = null; if (_menuFragment != null) { _menuFragment.OptionMenuClickHandler = null; } _menuFragment?.Dispose(); _menuFragment = null; _contentFragment?.Dispose(); _contentFragment = null; TooltipWindowDispose(); } catch (Exception ex) { Log.Debug(ex); } AppSettings.GcCollect(); //HARDCODE: base.OnDestroy(); AppSettings.GcCollect(true, Log); //HARDCODE: }
public ModelSourceReceiver(Source aSource) { iSource = aSource; try { iServiceReceiver = new ServiceReceiver(iSource.Device, iSource.House.EventServer); } catch (ServiceException) { throw new ModelSourceException(301, "Service failure"); } iActionPlay = iServiceReceiver.CreateAsyncActionPlay(); iActionStop = iServiceReceiver.CreateAsyncActionStop(); iActionSetChannel = iServiceReceiver.CreateAsyncActionSetSender(); iActionPlayNowSetChannel = iServiceReceiver.CreateAsyncActionSetSender(); iActionPlayNowSetChannel.EventResponse += EventSetChannelResponse; }
protected override void OnDestroy() { try { UnsubscribeEvents(); _serviceConnection?.Dispose(); _serviceConnection = null; _serviceReceiver?.Dispose(); _serviceReceiver = null; _addressAdapter?.Dispose(); _addressAdapter = null; } catch (Exception ex) { Log.Debug(ex); } //AppSettings.GcCollect(log: _log); //HARDCODE: base.OnDestroy(); }
private void CreateServiceReceiver() { _serviceReceiver = new ServiceReceiver(); }
private void receiveTextureFiles(ServiceReceiver serviceReceiver, object serviceResponse) { writeBinaryResponseToFile((string)serviceReceiver.HandlerParameter, ((ParamValueByte)serviceResponse).value); updateFileRequestStatus(new Uri(((ParamName)serviceReceiver.ServiceParameter).name)); }