Skip to content

Commit e6bb211

Browse files
author
Sergey Brutsky
committed
Adjusted all contracts for all devices to be used same way in gw2/gw3
1 parent 0b3175d commit e6bb211

180 files changed

Lines changed: 5368 additions & 5560 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 0 additions & 9 deletions
This file was deleted.

MiHome.sln

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
2-
Microsoft Visual Studio Solution File, Format Version 12.00
1+
Microsoft Visual Studio Solution File, Format Version 12.00
32
# Visual Studio 15
43
VisualStudioVersion = 15.0.27004.2005
54
MinimumVisualStudioVersion = 10.0.40219.1

MiHomeConsole/Program.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,22 @@
11
using System;
2-
using MiHomeLib;
2+
using System.Threading.Tasks;
3+
using MiHomeLib.XiaomiGateway2;
34

45
namespace MiHomeConsole;
56
public class Program
67
{
78
public static void Main()
89
{
9-
using var gw3 = new XiaomiGateway3("<gateway ip>", "<gateway token>");
10+
using var gw2 = new XiaomiGateway2("192.168.1.13", "8ac2ffaa10eec2469b5d585f34dd1663");
1011
{
11-
gw3.OnDeviceDiscovered += gw3SubDevice =>
12+
gw2.OnDeviceDiscoveredAsync += d =>
1213
{
13-
Console.WriteLine(gw3SubDevice.ToString());
14+
Console.WriteLine(d.ToString());
15+
return Task.CompletedTask;
1416
};
1517

16-
gw3.DiscoverDevices();
18+
gw2.DiscoverDevices();
1719
}
18-
1920
Console.ReadLine();
2021
}
2122
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using System;
2+
using System.Runtime.CompilerServices;
3+
using System.Threading.Tasks;
4+
using MiHomeLib.XiaomiGateway2.Commands;
5+
6+
[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // for Moq unit tests
7+
8+
namespace MiHomeLib.Transport;
9+
10+
public interface IMessageTransport: IDisposable
11+
{
12+
int SendCommand(Command command);
13+
14+
int SendWriteCommand(string sid, string type, Command data);
15+
16+
event Action<string> OnMessageReceived;
17+
18+
string Token { get; internal set; }
19+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
using System.Timers;
22

3-
namespace MiHomeLib.Utils;
3+
namespace MiHomeLib.Contracts;
44

55
public interface ITimer
66
{

MiHomeLib/Devices/AqaraCubeSensor.cs

Lines changed: 0 additions & 109 deletions
This file was deleted.

MiHomeLib/Devices/AqaraMotionSensor.cs

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)