C# 클래스 HarmonyHub.HarmonyClient

Client to interrogate and control Logitech Harmony Hub.
파일 보기 프로젝트 열기: hdurdle/harmony 1 사용 예제들

공개 메소드들

메소드 설명
Create ( string host, string token, int port = 5222 ) : HarmonyClient

Create a HarmonyClient with pre-authenticated token

Create ( string host, string username, string password, int port = 5222 ) : Task

Create a harmony client via myharmony.com authenification

Dispose ( ) : void

Cleanup and close

GetConfigAsync ( ) : Task

Request the configuration from the hub

GetCurrentActivityAsync ( ) : Task

Send message to HarmonyHub to request current activity Result is parsed by OnIq based on ClientCommandType

SendCommandAsync ( string deviceId, string command, bool press = true, int timestamp = null ) : System.Threading.Task

Send message to HarmonyHub to request to press a button Result is parsed by OnIq based on ClientCommandType

SendKeyPressAsync ( string deviceId, string command, int timespan = 100 ) : System.Threading.Task

Send a message that a button was pressed Result is parsed by OnIq based on ClientCommandType

StartActivityAsync ( string activityId ) : System.Threading.Task

Send message to HarmonyHub to start a given activity Result is parsed by OnIq based on ClientCommandType

SwapAuthToken ( string userAuthToken ) : Task

Send message to HarmonyHub with UserAuthToken, wait for SessionToken

TurnOffAsync ( ) : System.Threading.Task

Send message to HarmonyHub to request to turn off all devices

비공개 메소드들

메소드 설명
ErrorHandler ( object sender, Exception ex ) : void

Help with login errors

FireAndForgetAsync ( Document document, int waitTimeout = 50 ) : System.Threading.Task

Send a document, ignore the response (but wait shortly for a possible error)

GenerateIq ( Document document ) : agsXMPP.protocol.client.IQ

Generate an IQ for the supplied Document

GetData ( agsXMPP.protocol.client.IQ iq ) : string

Get the data from the IQ response object

HarmonyClient ( string host, string token, int port = 5222 ) : System

Constructor with standard settings for a new HarmonyClient

OnIqResponseHandler ( object sender, agsXMPP.protocol.client.IQ iq ) : void

Lookup the TaskCompletionSource for the IQ message and try to set the result.

OnLoginHandler ( object sender ) : void

Handle login by completing the _loginTaskCompletionSource

OnMessage ( object sender, agsXMPP.protocol.client.Message message ) : void

Handle incomming messages

RequestResponseAsync ( Document document, int timeout = 2000 ) : Task

Send a document, await the response and return it

SaslStartHandler ( object sender, SaslEventArgs saslEventArgs ) : void

Configure Sasl not to use auto and PLAIN for authentication

메소드 상세

Create() 공개 정적인 메소드

Create a HarmonyClient with pre-authenticated token
public static Create ( string host, string token, int port = 5222 ) : HarmonyClient
host string IP or hostname
token string token which is created via an authentication via myharmony.com
port int Port to connect to, 5222 is the default
리턴 HarmonyClient

Create() 공개 정적인 메소드

Create a harmony client via myharmony.com authenification
public static Create ( string host, string username, string password, int port = 5222 ) : Task
host string IP or hostname
username string myharmony.com username (email)
password string myharmony.com password
port int Port to connect to, default 5222
리턴 Task

Dispose() 공개 메소드

Cleanup and close
public Dispose ( ) : void
리턴 void

GetConfigAsync() 공개 메소드

Request the configuration from the hub
public GetConfigAsync ( ) : Task
리턴 Task

GetCurrentActivityAsync() 공개 메소드

Send message to HarmonyHub to request current activity Result is parsed by OnIq based on ClientCommandType
public GetCurrentActivityAsync ( ) : Task
리턴 Task

SendCommandAsync() 공개 메소드

Send message to HarmonyHub to request to press a button Result is parsed by OnIq based on ClientCommandType
public SendCommandAsync ( string deviceId, string command, bool press = true, int timestamp = null ) : System.Threading.Task
deviceId string string with the ID of the device
command string string with the command for the device
press bool true for press, false for release
timestamp int Timestamp for the command, e.g. send a press with 0 and a release with 100
리턴 System.Threading.Task

SendKeyPressAsync() 공개 메소드

Send a message that a button was pressed Result is parsed by OnIq based on ClientCommandType
public SendKeyPressAsync ( string deviceId, string command, int timespan = 100 ) : System.Threading.Task
deviceId string string with the ID of the device
command string string with the command for the device
timespan int The time between the press and release, default 100ms
리턴 System.Threading.Task

StartActivityAsync() 공개 메소드

Send message to HarmonyHub to start a given activity Result is parsed by OnIq based on ClientCommandType
public StartActivityAsync ( string activityId ) : System.Threading.Task
activityId string string
리턴 System.Threading.Task

SwapAuthToken() 공개 메소드

Send message to HarmonyHub with UserAuthToken, wait for SessionToken
public SwapAuthToken ( string userAuthToken ) : Task
userAuthToken string
리턴 Task

TurnOffAsync() 공개 메소드

Send message to HarmonyHub to request to turn off all devices
public TurnOffAsync ( ) : System.Threading.Task
리턴 System.Threading.Task