Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
Distributed Computing and Network Fusion System
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
WirelessInformationCollaborate
Distributed Computing and Network Fusion System
Commits
022c4d21
Commit
022c4d21
authored
Aug 19, 2020
by
Elf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
8-19
parent
16b2a979
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
202 additions
and
0 deletions
+202
-0
apps/cnf-path/pom.xml
apps/cnf-path/pom.xml
+57
-0
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/entity/DataPackage.java
...n/java/top/ninwoo/app/pathcompute/entity/DataPackage.java
+27
-0
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/entity/Picture.java
.../main/java/top/ninwoo/app/pathcompute/entity/Picture.java
+12
-0
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/service/Function.java
...ain/java/top/ninwoo/app/pathcompute/service/Function.java
+12
-0
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/service/Transfer.java
...ain/java/top/ninwoo/app/pathcompute/service/Transfer.java
+11
-0
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/service/impl/FunctionImpl.java
...top/ninwoo/app/pathcompute/service/impl/FunctionImpl.java
+20
-0
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/service/impl/TransferImpl.java
...top/ninwoo/app/pathcompute/service/impl/TransferImpl.java
+52
-0
apps/cnf-path/src/main/resources/application.yaml
apps/cnf-path/src/main/resources/application.yaml
+10
-0
pom.xml
pom.xml
+1
-0
No files found.
apps/cnf-path/pom.xml
0 → 100644
View file @
022c4d21
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
cnf
</artifactId>
<groupId>
top.ninwoo
</groupId>
<version>
1.0-SNAPSHOT
</version>
<relativePath>
../../pom.xml
</relativePath>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
cnf-path
</artifactId>
<dependencies>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
top.ninwoo
</groupId>
<artifactId>
cnf-client-starter
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-test
</artifactId>
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
org.influxdb
</groupId>
<artifactId>
influxdb-java
</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-maven-plugin
</artifactId>
<version>
${springboot.version}
</version>
<executions>
<execution>
<goals>
<goal>
repackage
</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/entity/DataPackage.java
0 → 100644
View file @
022c4d21
package
top.ninwoo.app.pathcompute.entity
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Stack
;
//数据包中包含的东西
//todo 未加任务表和路径表
@Data
public
class
DataPackage
implements
Serializable
{
private
int
number
;
private
List
<
Integer
>
sequence
;
private
Picture
picture
;
private
String
loc
;
private
double
eta
;
private
Long
currentime
;
private
Long
fun1time
;
private
List
<
Double
>
compCapacity
;
private
LinkedList
<
Double
>
tranDelay
;
//当前卫星节点
private
int
currentHop
;
//路由新添解析步骤
private
int
routeNumber
;
public
Stack
[]
route
;
}
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/entity/Picture.java
0 → 100644
View file @
022c4d21
package
top.ninwoo.app.pathcompute.entity
;
import
lombok.Data
;
import
java.io.Serializable
;
@Data
public
class
Picture
implements
Serializable
{
private
byte
[]
data
;
}
\ No newline at end of file
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/service/Function.java
0 → 100644
View file @
022c4d21
package
top.ninwoo.app.pathcompute.service
;
/**
* 功能函数:灰度,二值。。。
*/
public
interface
Function
{
//Sample:建议取0~9整数
int
add
(
int
a
,
int
b
);
int
multiply
(
int
a
,
int
b
);
int
square
(
int
a
);
}
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/service/Transfer.java
0 → 100644
View file @
022c4d21
package
top.ninwoo.app.pathcompute.service
;
import
top.ninwoo.app.pathcompute.entity.DataPackage
;
/**
* 转发数据包
*/
public
interface
Transfer
{
void
transferPackage
(
DataPackage
dataPackage
,
int
nextHop
,
long
startime
);
}
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/service/impl/FunctionImpl.java
0 → 100644
View file @
022c4d21
package
top.ninwoo.app.pathcompute.service.impl
;
import
top.ninwoo.app.pathcompute.service.Function
;
public
class
FunctionImpl
implements
Function
{
@Override
public
int
add
(
int
a
,
int
b
)
{
return
a
+
b
;
}
@Override
public
int
multiply
(
int
a
,
int
b
)
{
return
a
*
b
;
}
@Override
public
int
square
(
int
a
)
{
return
a
*
a
;
}
}
apps/cnf-path/src/main/java/top/ninwoo/app/pathcompute/service/impl/TransferImpl.java
0 → 100644
View file @
022c4d21
package
top.ninwoo.app.pathcompute.service.impl
;
import
org.springframework.beans.factory.annotation.Value
;
import
top.ninwoo.app.pathcompute.entity.DataPackage
;
import
top.ninwoo.app.pathcompute.service.Transfer
;
import
java.io.IOException
;
import
java.io.ObjectOutputStream
;
import
java.net.Socket
;
public
class
TransferImpl
implements
Transfer
{
@Value
(
"${slot}"
)
private
Long
slot
;
//时隙值
@Override
public
void
transferPackage
(
DataPackage
dataPackage
,
int
nextHop
,
long
startime
)
{
//获取目标节点ip
String
app_name
=
"sate"
+
nextHop
;
String
IP
=
ipService
.
getIpByAppName
(
app_name
);
//发送至目标
send
(
dataPackage
,
IP
,
2020
,
startime
);
}
private
void
send
(
DataPackage
dataPackage
,
String
ip
,
int
port
,
Long
startime
)
{
Socket
socket
=
null
;
try
{
socket
=
new
Socket
(
ip
,
port
);
ObjectOutputStream
objectOutputStream
=
new
ObjectOutputStream
(
socket
.
getOutputStream
());
objectOutputStream
.
writeObject
(
dataPackage
);
}
catch
(
IOException
e
)
{
Long
waitime
=
slot
-(
System
.
currentTimeMillis
()-
startime
)%
slot
;
try
{
Thread
.
sleep
(
waitime
+
10
);
}
catch
(
InterruptedException
ex
)
{
ex
.
printStackTrace
();
}
System
.
out
.
println
(
">>>>>>>>>>>>>>>>>>>"
);
System
.
out
.
println
(
"blocked current slot: "
+
((
System
.
currentTimeMillis
()-
startime
)/
slot
+
1
));
System
.
out
.
println
(
"try again ..."
);
send
(
dataPackage
,
ip
,
port
,
startime
);
}
finally
{
try
{
if
(
socket
!=
null
)
{
socket
.
close
();
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
}
}
}
apps/cnf-path/src/main/resources/application.yaml
0 → 100644
View file @
022c4d21
bishe
:
app
:
app-name
:
joliu
cloud-url
:
192.168.31.198:9091
# cloud-url: 192.168.31.198:9090
slot
:
20000
# 1000L*20
coe
:
0.7
cldUrl
:
192.168.31.198
cldPort
:
8900
pom.xml
View file @
022c4d21
...
@@ -20,6 +20,7 @@
...
@@ -20,6 +20,7 @@
<module>
apps/cnf-weixingsim
</module>
<module>
apps/cnf-weixingsim
</module>
<module>
apps/cnf-case-dis
</module>
<module>
apps/cnf-case-dis
</module>
<module>
apps/cnf-app-demo
</module>
<module>
apps/cnf-app-demo
</module>
<module>
apps/cnf-path
</module>
</modules>
</modules>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment