/// <summary> /// Start the remote control command RF learning mode. /// </summary> /// <returns>Triggered event : <see cref="OnRawData" /></returns> public async Task EnterRFLearningModeAsync() { await SendAsync(PacketGenerator.GenerateEnterRFLearningModePacket(this)); timerReadLearningData.Stop(); timerCheckRFData.Start(); }
/// <summary> /// Obtain the device id and encryption key needed for other calls /// </summary> /// <remarks>Run this method before making any other calls</remarks> public async Task AuthorizeAsync() { if (ClientSocket == null) { await Start_ClientListenAsync(); } byte[] authorizationPacket = PacketGenerator.GenerateAuthorizationPacket(this); await SendAsync(authorizationPacket); }
private async Task SendDiscoveryPacketAsync() { var ports = Network.GetAvailablePort(1000, Networks.Count); if (ports.Count == 0 || ports.Count < Networks.Count) { HelperMy.Notification(Color.Red, "Kullanılabilir port bulunamadığı için işlem iptal edildi."); await ClientSocket.StopListeningAsync(); ClientSocket.Dispose(); ClientSocket = null; return; } for (int i = 0; i < Networks.Count; i++) { var item = Networks[i]; var data = PacketGenerator.GenerateDiscoveryPacket(item.LocalIPAddress, (short)ports[i]); await ClientSocket.SendToAsync(data, new IPEndPoint(item.BroadcastIPAddress, 80)); } }
private async Task ReadLearningDataAsync() => await SendAsync(PacketGenerator.GenerateReadLearningModePacket(this));
private async Task ExitIRLearningModeAsync() => await SendAsync(PacketGenerator.GenerateExitIRLearningModePacket(this));
private async Task CheckRFDataSecondAsync() => await SendAsync(PacketGenerator.GenerateCheckRFDataSecondPacket(this));
/// <summary> /// Get the temperature /// </summary> /// <returns>temperature in degrees Celsius. Event : OnTemperature</returns> public async Task GetTemperatureAsync() => await SendAsync(PacketGenerator.GenerateReadTemperaturePacket(this));
/// <summary> /// Execute a remote control command /// </summary> /// <param name="data">Packet obtained using <see cref="OnRawData" /></param> public async Task SendRemoteCommandAsync(byte[] data) => await SendAsync(PacketGenerator.GenerateSendDataPacket(this, data));