C# Класс flint.PebbleProtocol

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.
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
Close ( ) : void
Connect ( ) : void

Connect to the Pebble.

PebbleProtocol ( string port ) : System

Create a new Pebble connection

SendMessage ( ushort endpoint, byte payload ) : void

Send a message to the connected Pebble. The payload should at most be 2048 bytes large.

Приватные методы

Метод Описание
readAndProcess ( ) : bool

Read from the serial line if a useful chunk is present.

In this case a "useful chunk" means that either the payload size and endpoint of a new message or the complete payload of a message are present.

serialPortDataReceived ( object sender, System.IO.Ports.SerialDataReceivedEventArgs e ) : void
serialPortErrorReceived ( object sender, System.IO.Ports.SerialErrorReceivedEventArgs e ) : void

Serial error handler. Passes stuff on to the next subscriber.

For the possible errors, System.IO.Ports.SerialError. I figure most if not all will be taken care of by the BT layer.

Описание методов

Close() публичный Метод

public Close ( ) : void
Результат void

Connect() публичный Метод

Connect to the Pebble.
Passed on when no connection can be made.
public Connect ( ) : void
Результат void

PebbleProtocol() публичный Метод

Create a new Pebble connection
public PebbleProtocol ( string port ) : System
port string
Результат System

SendMessage() публичный Метод

Send a message to the connected Pebble. The payload should at most be 2048 bytes large.
Thrown when the payload is too large.
public SendMessage ( ushort endpoint, byte payload ) : void
endpoint ushort
payload byte
Результат void