Skip to content

Commit

Permalink
PR1132: Получение данных с сенсоров
Browse files Browse the repository at this point in the history
Версия 1.2
  • Loading branch information
MrNeuronix committed Nov 20, 2014
1 parent 7b1e064 commit c132f14
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ mvn package
pr.turnOn(channel);
pr.turnOff(channel);

List<Sensors> sensors = pr.getSensors();

// Температура с первого сенсора в списке
short temp = sensors.get(0).getTemperature();

pc.open();

pc.turnOn(channel);
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/ru/iris/noolite4j/gateway/HTTPCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public List<Sensor> getSensors()

Node nNode = nList.item(temp);

byte value = Byte.valueOf(nNode.getNodeValue());
short value = Short.valueOf(nNode.getNodeValue());

/**
* Найдем канал и связанный с ним сенсор
Expand Down Expand Up @@ -162,7 +162,7 @@ public List<Sensor> getSensors()
}
else if(type.equals("snsh"))
{
sensor.setHumidity(value);
sensor.setHumidity((byte)value);
}
else if(type.equals("snt"))
{
Expand Down
6 changes: 3 additions & 3 deletions src/main/java/ru/iris/noolite4j/gateway/Sensor.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class Sensor {


private byte channel;
private byte temperature;
private short temperature;
private byte humidity;
private SensorState state;

Expand All @@ -32,11 +32,11 @@ public void setChannel(byte channel) {
this.channel = channel;
}

public byte getTemperature() {
public short getTemperature() {
return temperature;
}

public void setTemperature(byte temperature) {
public void setTemperature(short temperature) {
this.temperature = temperature;
}

Expand Down

0 comments on commit c132f14

Please sign in to comment.