-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathAdapterProxy.cs
104 lines (98 loc) · 3.23 KB
/
AdapterProxy.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// ------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
// ------------------------------------------------------------------------------
using HomeCenter.Adapters.PC.Messages;
using HomeCenter.Adapters.PC.Model;
using HomeCenter.CodeGeneration;
using HomeCenter.Model.Adapters;
using HomeCenter.Model.Capabilities;
using HomeCenter.Model.Messages;
using HomeCenter.Model.Messages.Commands;
using HomeCenter.Model.Messages.Commands.Device;
using HomeCenter.Model.Messages.Commands.Service;
using HomeCenter.Model.Messages.Queries.Device;
using Proto;
using System;
using System.Threading.Tasks;
using HomeCenter.Model.Core;
using Microsoft.Extensions.Logging;
namespace HomeCenter.Adapters.PC
{
[ProxyClass]
public class PcAdapterProxy : PcAdapter
{
protected async override Task ReceiveAsyncInternal(Proto.IContext context)
{
if (await HandleSystemMessages(context))
return;
var msg = FormatMessage(context.Message);
if (msg is HomeCenter.Model.Messages.ActorMessage ic)
{
ic.Context = context;
}
if (msg is RefreshCommand command_0)
{
await Handle(command_0).ConfigureAwait(false);
return;
}
else if (msg is TurnOnCommand command_1)
{
await Handle(command_1).ConfigureAwait(false);
return;
}
else if (msg is TurnOffCommand command_2)
{
await Handle(command_2).ConfigureAwait(false);
return;
}
else if (msg is VolumeUpCommand command_3)
{
await Handle(command_3).ConfigureAwait(false);
return;
}
else if (msg is VolumeDownCommand command_4)
{
await Handle(command_4).ConfigureAwait(false);
return;
}
else if (msg is VolumeSetCommand command_5)
{
await Handle(command_5).ConfigureAwait(false);
return;
}
else if (msg is MuteCommand command_6)
{
await Handle(command_6).ConfigureAwait(false);
return;
}
else if (msg is UnmuteCommand command_7)
{
await Handle(command_7).ConfigureAwait(false);
return;
}
else if (msg is InputSetCommand command_8)
{
await Handle(command_8).ConfigureAwait(false);
return;
}
if (msg is DiscoverQuery query_0)
{
var result = Discover(query_0);
context.Respond(result);
return;
}
;
await UnhandledMessage(msg);
}
public PcAdapterProxy(IMessageBroker messageBroker, ILogger<PcAdapterProxy> logger)
{
Logger = logger;
MessageBroker = messageBroker;
}
}
}