Ejemplo n.º 1
0
		/// <summary>
		/// Initializes a new instance of a SensorCloud Device for a specific account.
		/// </summary>
		/// <param name="deviceId">id for the Device's SensorCloud account</param>
		/// <param name="key">key required to access the Device</param>
		/// <param name="authServer">The authentication server to use.
		/// <remarks>default: https://sensorcloud.microstrain.com</remarks>
		/// </param>
		public Device(String deviceId, String key, String authServer = "https://sensorcloud.microstrain.com", IRequests requests = null)
		{
			//if a request was passed in use it.  If one wasn't passed in then we create a default RequestsFatory
			_requests = requests != null? requests : new SensorCloudRequests(deviceId, key, authServer);
			
			this._deviceId = deviceId;
		}
 public ManagerSettings(Data data, TcpClient client, ILogger <Worker> logger, IRequests requests)
 {
     _client   = client;
     _data     = data;
     _logger   = logger;
     _requests = requests;
 }
Ejemplo n.º 3
0
        // Create's a sensor.  Olny a device should create a sensor.  That is why this is internal
        internal Sensor(string name, IRequests requests)
        {
            _name     = name;
            _requests = requests;

            _infoLoaded = false;
        }
Ejemplo n.º 4
0
 public QqMusicMusicSearcher(IRequests requests)
 {
     _requests       = requests;
     OnBeforeSearch += () => { this.Status = "running"; };
     OnAfterSearch  += () => { this.Status = "stop"; };
     OnSearchError  += (e) => { this.Status = "stop"; };
 }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of a SensorCloud Device for a specific account.
        /// </summary>
        /// <param name="deviceId">id for the Device's SensorCloud account</param>
        /// <param name="key">key required to access the Device</param>
        /// <param name="authServer">The authentication server to use.
        /// <remarks>default: https://sensorcloud.microstrain.com</remarks>
        /// </param>
        public Device(String deviceId, String key, String authServer = "https://sensorcloud.microstrain.com", IRequests requests = null)
        {
            //if a request was passed in use it.  If one wasn't passed in then we create a default RequestsFatory
            _requests = requests != null? requests : new SensorCloudRequests(deviceId, key, authServer);

            this._deviceId = deviceId;
        }
 public EnterGroupChat(Data data, TcpClient client, ILogger <Worker> logger, IRequests requests)
 {
     _client   = client;
     _data     = data;
     _logger   = logger;
     _requests = requests;
 }
Ejemplo n.º 7
0
 public QqDownloader(IRequests requests)
 {
     _requests         = requests;
     OnBeforeDownload += (e) => { this.Status = "running"; };
     OnAfterDownload  += (e) => { this.Status = "stop"; };
     OnDownloadError  += (e, songInfo) => { this.Status = "stop"; };
 }
        public static bool SendMessageByType(IRequests requests, TcpClient client, string message)
        {
            var messageType = CheckMessageType.GetMessageType(message);

            if (messageType == MessageType.STRING)
            {
                requests.SendStringMessage(client, MessageType.STRING.ToString());
                requests.SendStringMessage(client, message);
                return(true);
            }
            else if (messageType == MessageType.PIC)
            {
                string urlPic = CheckMessageType.GetPictureUrl(message);

                if (File.Exists(urlPic))
                {
                    requests.SendStringMessage(client, MessageType.PIC.ToString());
                    requests.SendPictureMessage(client, urlPic);
                    return(true);
                }
                else
                {
                    requests.SendStringMessage(client, "0");
                    return(false);
                }
            }
            else
            {
                requests.SendStringMessage(client, "0");
                return(false);
            }
        }
Ejemplo n.º 9
0
 public ManageClientOptions(Data data, TcpClient client, IClientOptionsFactory clientOptionsFactory, ILogger <Worker> logger, IRequests requests)
 {
     _client = client;
     _data   = data;
     _clientOptionsFactory = clientOptionsFactory;
     _logger   = logger;
     _requests = requests;
 }
        public static void SendAllClientGroups(TcpClient client, IRequests requests, Data data, Guid clientGuid)
        {
            List <string> grouspName = data.AllGroupsChat.GetGroupsChat()
                                       .Where(g => g.Participants.Contains(clientGuid))
                                       .Select(g => g.Name).ToList();

            SendAllGroupChat(client, requests, grouspName);
        }
Ejemplo n.º 11
0
        protected void InitializeRequestsInterface ()
        {
            requests = conn.Requests;
            requests.NewChannels += OnNewChannels;
            requests.ChannelClosed += OnChannelClosed;     // TODO do I really need this?
            //self_handle = cm.SelfHandle;

        }
Ejemplo n.º 12
0
 protected AuthBase(ILocalStorageService localStorage, IOptions optionValue,
                    IRequests requests, NavigationManager navigationManager)
 {
     LocalStorage      = localStorage;
     OptionValue       = optionValue;
     Requests          = requests;
     NavigationManager = navigationManager;
     Parameters        = HttpUtility.ParseQueryString(string.Empty);
 }
Ejemplo n.º 13
0
        public MainForm(IRequests requests)
        {
            _request    = requests;
            _dotCreator = new DotCreator(_request);

            InitializeComponent(_request);
            CenterToScreen();
            SetStyle(ControlStyles.ResizeRedraw, true);
            BeforeStartHit();
        }
        public static void GetMessage(IRequests requests, ISystem system, TcpClient client)
        {
            MessageRequest messageRequest = (MessageRequest)requests.GetModelMessage(client);

            while (messageRequest.Key != MessageKey.Exit)
            {
                MessageRequestFactory.GetMessageOptionByKey(messageRequest.Key).HandleMessage(system, messageRequest.Value);
                messageRequest = (MessageRequest)requests.GetModelMessage(client);
            }
        }
        public static GroupChat WaitToGetGroupFromClient(TcpClient client, IRequests requests)
        {
            GroupChat groupChat = (GroupChat)requests.GetModelMessage(client);

            while (groupChat == null)
            {
                groupChat = (GroupChat)requests.GetModelMessage(client);
            }

            return(groupChat);
        }
Ejemplo n.º 16
0
        public DotCreator(IRequests requests)
        {
            var kernel = new StandardKernel();

            kernel.Load(Assembly.GetExecutingAssembly());
            var threadManager = kernel.Get <IThreadManager>();

            _threadManager = threadManager;
            _requests      = requests;
            _random        = new Random();
        }
Ejemplo n.º 17
0
        internal TimeSeriesStream(string sensorName, string channelName, IRequests requests, ulong start, ulong end, SampleRate samplerate)
        {
            Debug.Assert(end >= start);

            _sensorName  = sensorName;
            _channelName = channelName;
            _requests    = requests;
            _sampleRate  = samplerate;

            _startTimestampNanoseconds = start;
            _endTimestampNanoseconds   = end;
        }
Ejemplo n.º 18
0
 public Command(IGetConfirmationLinkStrategy confirmationLink,
                IRequests requestsRepository,
                IEmail emailService,
                ILog log,
                RegistrationData registrationData)
 {
     this.confirmationLink   = confirmationLink;
     this.requestsRepository = requestsRepository;
     this.emailService       = emailService;
     this.log = log;
     this.registrationData = registrationData;
 }
Ejemplo n.º 19
0
 public Command(IRequests requestRepository,
                IUsers userRepository,
                INotification notificationService,
                ILog log,
                Guid requestId)
 {
     this.requestRepository = requestRepository;
     this.userRepository    = userRepository;
     this.log                 = log;
     this.requestId           = requestId;
     this.notificationService = notificationService;
 }
Ejemplo n.º 20
0
 public Menu(TcpClient client, IRequests requests)
 {
     _consoleSystem    = new ConsoleSystem();
     _validation       = new Validation();
     _globalChatOption = new GlobalChatOption(client, requests, _consoleSystem);
     _privateChat      = new PrivateChat(client, requests, _consoleSystem);
     _createGroupChat  = new CreateGroupChat(client, requests, _consoleSystem);
     _enterGroupChat   = new EnterGroupChat(client, requests, _consoleSystem);
     _managerSettings  = new ManagerSettings(client, requests, _consoleSystem);
     _leaveGroupChat   = new LeaveGroupChat(client, requests, _consoleSystem);
     _menuBuilderInt   = new MenuBuilder <int>(_consoleSystem, _validation);
     _menuBuilderInt   = new MenuBuilder <int>(_consoleSystem, _validation);
 }
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            if (requests != null)
            {
                requests.NewChannels -= OnNewChannels;
                requests              = null;
            }
        }
		/// <summary>
		/// 
		/// </summary>
		/// <param name="deviceId"></param>
		/// <param name="deviceKey"></param>
		/// <param name="authServer"></param>
		/// <param name="requests"></param>
		public SensorCloudRequests(string deviceId, string deviceKey, string authServer, IRequests requests = null)
		{
			//if a request was passed in use it.  If one wasn't passed in then we create a default RequestsFatory
			_requests = requests != null? requests : new Requests();

			_deviceId = deviceId;
			_deviceKey = deviceKey;
			_authServer = authServer;

			AuthToken = "";
			ApiServer = "";

			Authenticate();
		}
Ejemplo n.º 23
0
 public Factory(IUsers users,
                IRequests requests,
                IEmail email,
                IGetConfirmationLinkStrategy confirmationLink,
                INotification notificationService,
                ILog log)
 {
     this.users               = users;
     this.requests            = requests;
     this.email               = email;
     this.confirmationLink    = confirmationLink;
     this.notificationService = notificationService;
     this.log = log;
 }
Ejemplo n.º 24
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="deviceId"></param>
        /// <param name="deviceKey"></param>
        /// <param name="authServer"></param>
        /// <param name="requests"></param>
        public SensorCloudRequests(string deviceId, string deviceKey, string authServer, IRequests requests = null)
        {
            //if a request was passed in use it.  If one wasn't passed in then we create a default RequestsFatory
            _requests = requests != null? requests : new Requests();

            _deviceId   = deviceId;
            _deviceKey  = deviceKey;
            _authServer = authServer;

            AuthToken = "";
            ApiServer = "";

            Authenticate();
        }
Ejemplo n.º 25
0
        public DrawingAreaControl(IRequests requests)
        {
            InitializeComponent();
            _requests = requests;
            _windowX  = drawingArea.Width;
            _windowY  = drawingArea.Height;
            _bitmap   = new Bitmap(_windowX, _windowY);

            var kernel = new StandardKernel();

            kernel.Load(Assembly.GetExecutingAssembly());
            var threadManager = kernel.Get <IThreadManager>();

            _threadManager = threadManager;
        }
Ejemplo n.º 26
0
 public Forecaster(IProcessModel processModel,
                   IDirectoryManager directoryManager,
                   IFileManager fileManager,
                   IPythonExec pythonExec,
                   IUtility utility,
                   IRequests requests,
                   ILoggerFactory logger)
 {
     _processModel     = processModel;
     _fileManager      = fileManager;
     _directoryManager = directoryManager;
     _pythonExec       = pythonExec;
     _utility          = utility;
     _requestHelper    = requests;
     _logger           = logger.CreateLogger("Forecasts");
 }
Ejemplo n.º 27
0
 public ForecasterSheduled(ITelegram messenger,
                           IProcessModel processModel,
                           IDirectoryManager directoryManager,
                           IFileManager fileManager,
                           IPythonExec pythonExec,
                           IUtility utility,
                           IRequests requests)
 {
     _messenger        = messenger;
     _processModel     = processModel;
     _fileManager      = fileManager;
     _directoryManager = directoryManager;
     _pythonExec       = pythonExec;
     _utility          = utility;
     _requestHelper    = requests;
 }
Ejemplo n.º 28
0
        protected virtual void Initialize()
        {
            requests     = DBusUtility.GetProxy <IRequests> (bus, bus_name, object_path);
            capabilities = DBusUtility.GetProxy <IContactCapabilities> (bus, bus_name, object_path);


            conn.StatusChanged     += OnStatusChanged;
            conn.SelfHandleChanged += OnSelfHandleChanged;

            LoadCapabilities();

            dispatch_manager = new DispatchManager(this);


            CreateRoster();
        }
Ejemplo n.º 29
0
        protected virtual void Dispose (bool disposing)
        {
            if (!disposing) {
                return;
            }

            if (requests != null) {
                try {
                    requests.NewChannels -= OnNewChannels;
                    requests.ChannelClosed -= OnChannelClosed;
                }
                catch (Exception) {}
                requests = null;
            }

            Close ();
        }
Ejemplo n.º 30
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing)
            {
                return;
            }

            if (dispatch_manager != null)
            {
                dispatch_manager.Dispose();
            }

            if (ChannelHandler == null)
            {
                ChannelHandler.Destroy();
            }

            if (roster != null)
            {
                roster.Dispose();
                roster = null;
            }

            if (conn != null)
            {
                try {
                    conn.SelfHandleChanged -= OnSelfHandleChanged;
                    conn.StatusChanged     -= OnStatusChanged;
                }
                catch (Exception) {}
                conn = null;
            }

            capabilities     = null;
            dispatch_manager = null;
            requests         = null;
        }
Ejemplo n.º 31
0
        protected virtual void Dispose(bool disposing)
        {
            if (!disposing) {
                return;
            }

            if (requests != null) {
                requests.NewChannels -= OnNewChannels;
                requests = null;
            }
        }
Ejemplo n.º 32
0
 internal TimeSeriesStream(string sensorName, string channelName, IRequests requests, SampleRate sampleRate)
     : this(sensorName, channelName, requests, 0, ulong.MaxValue, sampleRate)
 {
 }
Ejemplo n.º 33
0
 internal TimeSeriesStream(string sensorName, string channelName, IRequests requests, DateTime start, DateTime end, SampleRate samplerate)
     : this(sensorName, channelName, requests, convertToEpoch(start), convertToEpoch(end))
 {
 }
Ejemplo n.º 34
0
		// channel constructor.  This is internal because only a sensor should create a channel.
		internal Channel(string SensorName, string name, IRequests requests)
		{
			_sensorName = SensorName;
			_name = name;
			_requests = requests;
		}
Ejemplo n.º 35
0
        public void Initialize()
        {
            BusG.Init ();
            Application.Init ();        // init GTK app for use of Glib mainloop

            IMissionControl mc = bus.GetObject<IMissionControl> (Constants.MISSIONCONTROL_IFACE,
                new ObjectPath (Constants.MISSIONCONTROL_PATH));
            if (mc == null ) {
                Console.WriteLine (MSG_PREFIX + "Unable to find MissonControl interface.");
                return;
            }

            string bus_name = null;
            ObjectPath op = null;
            string[] online = mc.GetOnlineConnections();

            McStatus status = McStatus.Disconnected;

            if (online.Length == 0) {
                Console.WriteLine (MSG_PREFIX + "There are 0 online connections.");

            }
            else {
                status = mc.GetConnectionStatus (account);

            }

            if (status == McStatus.Connected) {
                mc.GetConnection (account, out bus_name, out op);
                iconn = bus.GetObject<IConnection> (Constants.CONNMANAGER_GABBLE_IFACE, op); // get connection
                if (iconn == null) {
                    running = false;
                }
                else {
                    Console.WriteLine (MSG_PREFIX + "Got connection using account {0}, bus {1}, path {2}"
                                       , account, bus_name, op);
                    //iconn.NewChannel += OnNewChannel;     // deprecated as of 0.17.23
                    irequests = bus.GetObject<IRequests> (bus_name, op);
                    irequests.NewChannels += OnNewChannels;
                    irequests.ChannelClosed += OnChannelClosed;     // don't really need this
                    self_handle = iconn.SelfHandle;
                    Console.WriteLine (MSG_PREFIX + "Your handle is {0}", self_handle);

                    SetTubeCapability (bus_name, op);         // tell Telepathy about our special tube

                    string service = DTUBE_HANDLER_IFACE + "." + DTUBETEST_IFACE;
                    string service_path = DTUBE_HANDLER_PATH + DTUBETEST_PATH;
                    if (tube_partner == null)
                        ClaimTubeName (service, service_path);

                    ProcessContacts (bus_name, op);

                    if (tube_partner_handle > 0) {
                        SetupTube ();
                    }
                    else if (tube_partner != null) {
                        Console.WriteLine (MSG_PREFIX + "Our tube partner is missing. Quitting.");
                        running = false;
                    }

                }
            }
            else {
                Console.WriteLine (MSG_PREFIX + account + " not connected.");
                Console.WriteLine (MSG_PREFIX + "will wait for a connection to test MC");
                Console.WriteLine (MSG_PREFIX + "Press CTRL+C to quit.");
                mc.AccountStatusChanged += OnAccountStatusChanged;
                //running = false;
            }
            /*
            while (running) {
                bus.Iterate ();
                if (dbus_conn != null)
                    dbus_conn.Iterate ();       // loop private connection for tube
            }
            */

            if (running) {
                Application.Run ();             // run Glib mainloop
            }

            if (tube_initiator > 0) {
                Cleanup ();
            }

            Console.WriteLine (MSG_PREFIX + "Test complete.");
        }
Ejemplo n.º 36
0
 protected void InitializeRequestsInterface()
 {
     requests = conn.Requests;
     requests.NewChannels += OnNewChannels;
 }
Ejemplo n.º 37
0
		// Create's a sensor.  Olny a device should create a sensor.  That is why this is internal
		internal Sensor(string name, IRequests requests)
		{
			_name = name;
			_requests = requests;

			_infoLoaded = false;
		}