Handles the basic protocol structure for Pebble communication. Essentially handles the SerialPort and translates the stream to endpoint,payload pairs and vv. Does and should not handle anything regarding the *meaning* of that data.
Ejemplo n.º 1
0
        /// <summary> Create a new Pebble
        /// </summary>
        /// <param name="port">The serial port to connect to.</param>
        /// <param name="pebbleId">The four-character Pebble ID, based on its BT address.
        /// Nothing explodes when it's incorrect, it's merely used for identification.</param>
        public Pebble(string port, string pebbleId)
        {
            ResponseTimeout = TimeSpan.FromSeconds(5);
            PebbleID        = pebbleId;

            _callbackHandlers = new Dictionary <Type, List <CallbackContainer> >();

            _PebbleProt = new PebbleProtocol(port);
            _PebbleProt.RawMessageReceived += RawMessageReceived;
        }
Ejemplo n.º 2
0
        /// <summary> Create a new Pebble
        /// </summary>
        /// <param name="port">The serial port to connect to.</param>
        /// <param name="pebbleid">The four-character Pebble ID, based on its BT address.
        /// Nothing explodes when it's incorrect, it's merely used for identification.</param>
        public Pebble(String port, String pebbleid)
        {
            Alive       = false;
            PingTimeout = 10000;
            PebbleID    = pebbleid;
            pebbleProt  = new PebbleProtocol(port);
            pebbleProt.RawMessageReceived += pebbleProt_RawMessageReceived;

            endpointEvents = new Dictionary <Endpoints, EventHandler <MessageReceivedEventArgs> >();
            RegisterEndpointCallback(Endpoints.PHONE_VERSION, PhoneVersionReceived);
            RegisterEndpointCallback(Endpoints.VERSION, VersionReceived);
            RegisterEndpointCallback(Endpoints.APP_MANAGER, AppbankStatusResponseReceived);

            pingTimer          = new System.Timers.Timer(16180);
            pingTimer.Elapsed += pingTimer_Elapsed;
            pingTimer.Start();
        }
Ejemplo n.º 3
0
        /// <summary> Create a new Pebble 
        /// </summary>
        /// <param name="port">The serial port to connect to.</param>
        /// <param name="pebbleid">The four-character Pebble ID, based on its BT address.  
        /// Nothing explodes when it's incorrect, it's merely used for identification.</param>
        public Pebble(String port, String pebbleid)
        {
            Alive = false;
            PingTimeout = 10000;
            PebbleID = pebbleid;
            pebbleProt = new PebbleProtocol(port);
            pebbleProt.RawMessageReceived += pebbleProt_RawMessageReceived;

            endpointEvents = new Dictionary<Endpoints, EventHandler<MessageReceivedEventArgs>>();
            RegisterEndpointCallback(Endpoints.PHONE_VERSION, PhoneVersionReceived);
            RegisterEndpointCallback(Endpoints.VERSION, VersionReceived);
            RegisterEndpointCallback(Endpoints.APP_MANAGER, AppbankStatusResponseReceived);

            pingTimer = new System.Timers.Timer(16180);
            pingTimer.Elapsed += pingTimer_Elapsed;
            pingTimer.Start();
        }