Skip to content

Commit 2266e2a

Browse files
committed
Some codes for multichannel gateway.
1 parent 605dae3 commit 2266e2a

File tree

105 files changed

+419
-212
lines changed

Some content is hidden

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

105 files changed

+419
-212
lines changed

client/actuator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.thefirstlineofcode.sand</groupId>
1010
<artifactId>sand-client</artifactId>
11-
<version>1.0.0-BETA2</version>
11+
<version>1.0.0-BETA3</version>
1212
<relativePath>../pom.xml</relativePath>
1313
</parent>
1414

client/concentrator/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.thefirstlineofcode.sand</groupId>
1010
<artifactId>sand-client</artifactId>
11-
<version>1.0.0-BETA2</version>
11+
<version>1.0.0-BETA3</version>
1212
<relativePath>../pom.xml</relativePath>
1313
</parent>
1414

client/edge/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.thefirstlineofcode.sand</groupId>
1010
<artifactId>sand-client</artifactId>
11-
<version>1.0.0-BETA2</version>
11+
<version>1.0.0-BETA3</version>
1212
<relativePath>../pom.xml</relativePath>
1313
</parent>
1414

client/friends/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.thefirstlineofcode.sand</groupId>
1010
<artifactId>sand-client</artifactId>
11-
<version>1.0.0-BETA2</version>
11+
<version>1.0.0-BETA3</version>
1212
<relativePath>../pom.xml</relativePath>
1313
</parent>
1414

client/ibtr/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.thefirstlineofcode.sand</groupId>
1010
<artifactId>sand-client</artifactId>
11-
<version>1.0.0-BETA2</version>
11+
<version>1.0.0-BETA3</version>
1212
<relativePath>../pom.xml</relativePath>
1313
</parent>
1414

client/location/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.thefirstlineofcode.sand</groupId>
1010
<artifactId>sand-client</artifactId>
11-
<version>1.0.0-BETA2</version>
11+
<version>1.0.0-BETA3</version>
1212
<relativePath>../pom.xml</relativePath>
1313
</parent>
1414

client/lora-dac/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<parent>
99
<groupId>com.thefirstlineofcode.sand</groupId>
1010
<artifactId>sand-client</artifactId>
11-
<version>1.0.0-BETA2</version>
11+
<version>1.0.0-BETA3</version>
1212
<relativePath>../pom.xml</relativePath>
1313
</parent>
1414

client/lora-dac/src/main/java/com/thefirstlineofcode/sand/client/lora/dac/ILoraDacClient.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ public interface ILoraDacClient extends IAddressConfigurator<ICommunicator<LoraA
1212
public static final LoraAddress DEFAULT_DAC_CLIENT_ADDRESS = new LoraAddress(new byte[] {(byte)0xef, (byte)0xee, DEFAULT_DAC_SERVICE_CHANNEL});
1313

1414
public interface Listener {
15-
void allocated(LoraAddress gatewayUplinkAddress, LoraAddress gatewayDownlinkAddress,
16-
LoraAddress allocatedAddress);
15+
void allocated(LoraAddress[] uplinkAddresses, LoraAddress allocatedAddress);
1716
void configured();
1817
void notConfigured();
1918
void occurred(CommunicationException e);

client/lora-dac/src/main/java/com/thefirstlineofcode/sand/client/lora/dac/ILoraDacService.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,13 @@
88

99
public interface ILoraDacService<OA extends IAddress> extends IAddressConfigurator<ICommunicator<OA, LoraAddress, byte[]>,
1010
LoraAddress, byte[]> {
11-
public static final byte DEFAULT_THING_COMMUNICATION_CHANNEL = 0x17;
12-
1311
public interface Listener {
1412
void addressConfigured(String thingId, String registrationCode, LoraAddress address);
1513
}
1614

15+
void setUplinkChannelBegin(int uplinkChannelBegin);
16+
void setUplinkChannelEnd(int uplinkChannelEnd);
17+
void setUplinkAddress(byte uplinkAddressHighByte, byte uplinkAddressLowByte);
1718
void setConcentrator(IConcentrator concentrator);
1819
void start();
1920
boolean isStarted();
@@ -24,10 +25,6 @@ public interface Listener {
2425
boolean removeListener(Listener listener);
2526
void setDacServiceAddress(LoraAddress dacServiceAddress);
2627
LoraAddress getDacServiceAddress();
27-
void setGatewayUplinkAddress(LoraAddress gatewayUplinkAddress);
28-
LoraAddress getGatewayUplinkAddress();
29-
void setGatewayDownlinkAddress(LoraAddress gatewayDownlinkAddress);
30-
LoraAddress getGatewayDownlinkAddress();
3128
void setThingCommunicationChannel(byte thingCommunicationChannel);
3229
byte getThingCommunicationChannel();
3330
}

client/lora-dac/src/main/java/com/thefirstlineofcode/sand/client/lora/dac/LoraDacClient.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,11 @@ public void received(LoraAddress from, byte[] data) {
111111
if (Allocation.PROTOCOL.equals(protocol) && state == State.INTRODUCTING) {
112112
try {
113113
Allocation allocation = (Allocation)obxFactory.toObject(data);
114+
LoraAddress[] uplinkAddresses = getUplinkAddresses(allocation.getUplinkChannelBegin(),
115+
allocation.getUplinkChannelEnd(), allocation.getUplinkAddressHighByte(),
116+
allocation.getUplinkAddressLowByte());
114117
if (listener != null) {
115-
listener.allocated(new LoraAddress(allocation.getGatewayUplinkAddress()),
116-
new LoraAddress(allocation.getGatewayDownlinkAddress()),
118+
listener.allocated(uplinkAddresses,
117119
new LoraAddress(allocation.getAllocatedAddress()));
118120
}
119121
} catch (BxmppConversionException e) {
@@ -161,6 +163,19 @@ public void isConfigured(String thingId) {
161163
}
162164
}
163165

166+
private LoraAddress[] getUplinkAddresses(int gatewayUplinkChannelBegin, int gatewayUplinkChannelEnd,
167+
byte gatewayUplinkAddressHighByte, byte gatewayUplinkAddressLowByte) {
168+
int uplinkAddressesSize = gatewayUplinkChannelEnd - gatewayUplinkChannelBegin + 1;
169+
LoraAddress[] addresses = new LoraAddress[uplinkAddressesSize];
170+
171+
for (int i = 0; i < uplinkAddressesSize; i++) {
172+
addresses[i] = new LoraAddress(gatewayUplinkAddressHighByte,
173+
gatewayUplinkAddressLowByte, (byte)(gatewayUplinkChannelBegin + i));
174+
}
175+
176+
return addresses;
177+
}
178+
164179
private class IsConfiguredListener implements ICommunicationListener<LoraAddress, LoraAddress, byte[]> {
165180

166181
@Override

0 commit comments

Comments
 (0)