Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
SocketDemo
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
朱世闯
SocketDemo
Commits
fb632659
Commit
fb632659
authored
3 years ago
by
UIUANG\Zsc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
qqqqq
parent
8d26c554
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
11 deletions
+15
-11
SocketHandler.java
...fer/src/main/java/com/wmdigit/transfer/SocketHandler.java
+6
-3
DataPackUtils.java
...main/java/com/wmdigit/transfer/wrapper/DataPackUtils.java
+1
-0
build.gradle
app/build.gradle
+0
-1
MainActivity.java
app/src/main/java/com/wmdigit/socketdemo/MainActivity.java
+8
-7
No files found.
Transfer/src/main/java/com/wmdigit/transfer/SocketHandler.java
View file @
fb632659
...
...
@@ -33,23 +33,26 @@ public class SocketHandler implements Runnable{
int
read
;
while
(-
1
!=
(
read
=
is
.
read
(
bytes
)))
{
if
(
is
.
available
()
==
0
)
{
String
hexString
=
bytesToHexString
(
bytes
);
//
String hexString = bytesToHexString(bytes);
DataPackWrapper
parse
=
instance
.
parse
(
bytes
,
read
);
String
hexString
=
bytesToHexString
(
parse
.
getInBuffer
().
array
());
instance
.
setOut
(
parse
);
OutputStream
outputStream
=
null
;
try
{
outputStream
=
this
.
socket
.
getOutputStream
();
String
hexString1
=
bytesToHexString
(
parse
.
getOutBytes
());
Log
.
e
(
"bytes out "
,
hexString1
);
outputStream
.
write
(
parse
.
getOutBytes
());
}
catch
(
IOException
var17
)
{
var17
.
printStackTrace
();
}
outputStream
.
flush
();
//
List<DataBean> beanList = parse.getBeanList();
List
<
DataBean
>
beanList
=
parse
.
getBeanList
();
// CommandHeader inHeader = parse.getInHeader();
// Log.d("inHeader", inHeader.toString());
//
this.listener.pluList(beanList);
this
.
listener
.
pluList
(
beanList
);
}
}
}
catch
(
IOException
var18
)
{
...
...
This diff is collapsed.
Click to expand it.
Transfer/src/main/java/com/wmdigit/transfer/wrapper/DataPackUtils.java
View file @
fb632659
...
...
@@ -101,6 +101,7 @@ public class DataPackUtils {
inBuffer
.
put
(
b2
).
put
(
b
);
}
order
.
put
((
byte
)
102
).
put
(
dataPackWrapper
.
getInBuffer
().
array
());
dataPackWrapper
.
setOutBytes
(
order
.
array
());
return
;
}
...
...
This diff is collapsed.
Click to expand it.
app/build.gradle
View file @
fb632659
...
...
@@ -39,7 +39,6 @@ dependencies {
implementation
project
(
path:
':Transfer'
)
implementation
files
(
'libs\\wintecscales.jar'
)
implementation
project
(
path:
':DigiTransfer'
)
implementation
files
(
'libs/DigiTransfer_v1.0.3_sdk.jar'
)
testImplementation
'junit:junit:4.+'
androidTestImplementation
'androidx.test.ext:junit:1.1.3'
androidTestImplementation
'androidx.test.espresso:espresso-core:3.4.0'
...
...
This diff is collapsed.
Click to expand it.
app/src/main/java/com/wmdigit/socketdemo/MainActivity.java
View file @
fb632659
...
...
@@ -6,6 +6,7 @@ import android.util.Log;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.wmdigit.digitransfer.DigiScaleTransfer
;
import
com.wmdigit.transfer.ScaleTransfer
;
import
java.net.ServerSocket
;
...
...
@@ -18,14 +19,14 @@ public class MainActivity extends AppCompatActivity {
super
.
onCreate
(
savedInstanceState
);
setContentView
(
R
.
layout
.
activity_main
);
try
{
DigiScaleTransfer
.
getInstance
(
new
ScalesHandler
()).
init
();
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
Log
.
i
(
"ATG"
,
e
.
getLocalizedMessage
());
}
//
try {
//
DigiScaleTransfer.getInstance(new ScalesHandler()).init();
//
} catch (Exception e) {
//
e.printStackTrace();
//
Log.i("ATG", e.getLocalizedMessage());
//
}
// startSocket(2141);
//
ScaleTransfer.getInstance().startLoadPluData(new ScaleTransfer2(), 3001);
ScaleTransfer
.
getInstance
().
startLoadPluData
(
new
ScaleTransfer2
(),
3001
);
// ScaleTransfer.getInstance().startLoadPluData(new ScaleTransfer2(), 2033);
}
...
...
This diff is collapsed.
Click to expand it.
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