Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation
This project
Loading...
Sign in
谢明辉
/
recv_data_longhua
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 339f7375
authored
Aug 26, 2020
by
xmh
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
部分修改
1 parent
2b7277a0
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
13 additions
and
7 deletions
src/main/java/com/viontech/Application.java
src/main/java/com/viontech/controller/DataController.java
src/main/java/com/viontech/model/BehaviorModel.java
src/main/java/com/viontech/model/FlowModel.java
src/main/java/com/viontech/model/TrafficModel.java
src/main/java/com/viontech/Application.java
View file @
339f737
...
...
@@ -7,8 +7,8 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
(
exclude
=
org
.
springframework
.
boot
.
autoconfigure
.
jdbc
.
DataSourceAutoConfiguration
.
class
)
@Slf4j
public
class
Application
{
p
rivate
final
static
long
REAL_TIME
=
0x00000001
L
;
p
rivate
final
static
long
NOT_REAL_TIME
=
0x00000002
L
;
p
ublic
final
static
long
REAL_TIME
=
0x00000001
L
;
p
ublic
final
static
long
NOT_REAL_TIME
=
0x00000002
L
;
public
static
void
main
(
String
[]
args
)
{
try
{
...
...
src/main/java/com/viontech/controller/DataController.java
View file @
339f737
...
...
@@ -25,7 +25,6 @@ public class DataController {
log
.
info
(
"收到一条繁星发来的消息"
);
BaseModel
data
=
Process
.
process
(
dataStr
);
if
(
data
!=
null
)
{
data
.
encodeData
();
ChannelGroup
.
broadcast
(
data
);
}
return
"success"
;
...
...
src/main/java/com/viontech/model/BehaviorModel.java
View file @
339f737
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
=
0x00040006
L
;
this
.
flag
=
Application
.
REAL_TIME
;
ByteArrayBuilder
builder
=
new
ByteArrayBuilder
(
Math
.
toIntExact
(
this
.
length
-
16
));
builder
.
appendFourBytes
(
serialNum
);
...
...
src/main/java/com/viontech/model/FlowModel.java
View file @
339f737
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
=
0x00040005
L
;
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
);
...
...
src/main/java/com/viontech/model/TrafficModel.java
View file @
339f737
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
=
0x00020004
L
;
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
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment