Commit 339f7375 by xmh

部分修改

1 parent 2b7277a0
......@@ -7,8 +7,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication(exclude = org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration.class)
@Slf4j
public class Application {
private final static long REAL_TIME = 0x00000001L;
private final static long NOT_REAL_TIME = 0x00000002L;
public final static long REAL_TIME = 0x00000001L;
public final static long NOT_REAL_TIME = 0x00000002L;
public static void main(String[] args) {
try {
......
......@@ -25,7 +25,6 @@ public class DataController {
log.info("收到一条繁星发来的消息");
BaseModel data = Process.process(dataStr);
if (data != null) {
data.encodeData();
ChannelGroup.broadcast(data);
}
return "success";
......
package com.viontech.model;
import com.fasterxml.jackson.core.util.ByteArrayBuilder;
import com.viontech.Application;
import lombok.Getter;
import lombok.Setter;
......@@ -54,8 +55,10 @@ public class BehaviorModel extends BaseModel {
@Override
public void encodeData() {
this.deviceId = 1;
this.length = 16L + 448L + picture.length;
this.protocol = 0x00040006L;
this.flag = Application.REAL_TIME;
ByteArrayBuilder builder = new ByteArrayBuilder(Math.toIntExact(this.length - 16));
builder.appendFourBytes(serialNum);
......
package com.viontech.model;
import com.fasterxml.jackson.core.util.ByteArrayBuilder;
import com.viontech.Application;
import lombok.Getter;
import lombok.Setter;
......@@ -28,13 +29,12 @@ public class FlowModel extends BaseModel {
@Override
public void encodeData() {
this.deviceId = 1;
this.length = 540L;
this.protocol = 0x00040005L;
this.flag = Application.REAL_TIME;
ByteArrayBuilder builder = new ByteArrayBuilder(Math.toIntExact(this.length - 16));
builder.appendFourBytes(toInt(deviceId));
builder.appendFourBytes(toInt(length));
builder.appendFourBytes(toInt(protocol));
builder.appendFourBytes(toInt(flag));
builder.appendFourBytes(serialNum);
builder.appendFourBytes(time);
......
package com.viontech.model;
import com.fasterxml.jackson.core.util.ByteArrayBuilder;
import com.viontech.Application;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
......@@ -94,8 +95,11 @@ public class TrafficModel extends BaseModel {
@Override
public void encodeData() {
this.deviceId = 1;
this.protocol = 0x00020004L;
this.length = 16L + 452L + picture1.length + picture2.length + 4;
this.flag = Application.REAL_TIME;
ByteArrayBuilder builder = new ByteArrayBuilder(Math.toIntExact(this.length - 16 - 4));
builder.appendFourBytes(serialNum);
builder.appendFourBytes(discernTime);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!