Bytes -> Binary
This commit is contained in:
parent
c2aff1ee9a
commit
49f5011823
@ -238,7 +238,7 @@ namespace Passer.Control.Core {
|
|||||||
|
|
||||||
protected virtual void Process(CustomMsg msg) {
|
protected virtual void Process(CustomMsg msg) {
|
||||||
Thing thing = Thing.Get(msg.networkId, msg.thingId);
|
Thing thing = Thing.Get(msg.networkId, msg.thingId);
|
||||||
thing?.ProcessBytes(msg.bytes);
|
thing?.ProcessBinary(msg.bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Process(TextMsg temsgxt) { }
|
protected virtual void Process(TextMsg temsgxt) { }
|
||||||
|
@ -6,7 +6,7 @@ namespace Passer.Control.Core {
|
|||||||
public TemperatureSensor(byte networkId, byte thingId) : base(null, networkId, thingId, (byte)Type.TemperatureSensor) {
|
public TemperatureSensor(byte networkId, byte thingId) : base(null, networkId, thingId, (byte)Type.TemperatureSensor) {
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void ProcessBytes(byte[] bytes) {
|
public override void ProcessBinary(byte[] bytes) {
|
||||||
byte ix = 0;
|
byte ix = 0;
|
||||||
float temp = LowLevelMessages.ReceiveFloat16(bytes, ref ix);
|
float temp = LowLevelMessages.ReceiveFloat16(bytes, ref ix);
|
||||||
Console.WriteLine($"temperature {this.name} = {temp} C");
|
Console.WriteLine($"temperature {this.name} = {temp} C");
|
||||||
|
4
Thing.cs
4
Thing.cs
@ -160,9 +160,9 @@ namespace Passer.Control.Core {
|
|||||||
// should recurse over children...
|
// should recurse over children...
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual byte[] GenerateBytes() { return new byte[0]; }
|
public virtual byte[] GenerateBinary() { return new byte[0]; }
|
||||||
|
|
||||||
public virtual void ProcessBytes(byte[] bytes) {
|
public virtual void ProcessBinary(byte[] bytes) {
|
||||||
//if (sensor != null)
|
//if (sensor != null)
|
||||||
// sensor.ProcessBytes(bytes);
|
// sensor.ProcessBytes(bytes);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user