-
Notifications
You must be signed in to change notification settings - Fork 1
/
Program.cs
45 lines (37 loc) · 1.54 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using System.Collections;
using System.Net;
using System.Threading;
using HomeAutomation.Components.Sensors;
using HomeAutomation.Controllers;
//using HomeAutomation.Devices;
using HomeAutomation.Etc.Delegates;
using HomeAutomation.Network;
using Json.NETMF;
using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using SecretLabs.NETMF.Hardware;
namespace HomeAutomation
{
public static class Program
{
public static void Main()
{
// Usage - first, instantiate an IDevice.
// Then, instantiate an IConnection, and pass both the device and connection into
// an instantiated IConnectionManager. Then pass the IConnectionManager to an instantiated
// IController. Finally, initialize the device, passing in your controller.
// Any components should be added in your particular Device class
// Any commands added should be placed in the CommandHandler class - instructions included.
var device = new Device();
var serverConnection = new SingleDataConnection(IPAddress.Parse("192.168.168.101"),420);
var connectionManager = new TcpConnectionManager(device, serverConnection) { KeepAliveActive = true, KeepAliveTime = 30000 };
var netduino = new NetDuinoPlus2(connectionManager);
device.Init(netduino);
while (true)
{
Debug.Print("Available RAM: " + Debug.GC(true));
Thread.Sleep(30000);
}
}
}
}