Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
proview
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
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
Esteban Blanc
proview
Commits
828fbbeb
Commit
828fbbeb
authored
Jan 13, 2011
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remote_pvd_pwrcli updated to 4.4.4 version
parent
9402d6a0
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
17 deletions
+84
-17
remote/exe/remote_pvd_pwrcli/src/remote_pvd_pwrcli.cpp
remote/exe/remote_pvd_pwrcli/src/remote_pvd_pwrcli.cpp
+40
-8
remote/lib/remote/src/remote_pvd_udp.c
remote/lib/remote/src/remote_pvd_udp.c
+39
-7
remote/lib/remote/src/remote_pvd_udp.h
remote/lib/remote/src/remote_pvd_udp.h
+4
-2
src/msg/rs/src/rs_remote_msg.msg
src/msg/rs/src/rs_remote_msg.msg
+1
-0
No files found.
remote/exe/remote_pvd_pwrcli/src/remote_pvd_pwrcli.cpp
View file @
828fbbeb
...
@@ -121,10 +121,14 @@ void remote_pvd_pwrcli::objectOid( co_procom *pcom, pwr_tOix oix)
...
@@ -121,10 +121,14 @@ void remote_pvd_pwrcli::objectOid( co_procom *pcom, pwr_tOix oix)
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
if
(
pvd_cLog
)
logg
(
"Reply"
,
sts
,
""
);
if
(
pvd_cLog
)
logg
(
"Reply"
,
sts
,
""
);
if
(
EVEN
(
sts
)
||
sts
==
REM__TIMEOUT
)
{
if
(
EVEN
(
sts
))
{
pcom
->
provideStatus
(
sts
);
pcom
->
provideStatus
(
sts
);
return
;
return
;
}
}
if
(
sts
==
REM__TIMEOUT
)
{
pcom
->
provideStatus
(
REM__UDPNOCON
);
return
;
}
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
...
@@ -175,10 +179,14 @@ void remote_pvd_pwrcli::objectName( co_procom *pcom, char *name, pwr_tOix poix)
...
@@ -175,10 +179,14 @@ void remote_pvd_pwrcli::objectName( co_procom *pcom, char *name, pwr_tOix poix)
if
(
pvd_cLog
)
logg
(
"ObjName"
,
poix
,
name
);
if
(
pvd_cLog
)
logg
(
"ObjName"
,
poix
,
name
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
if
(
EVEN
(
sts
)
||
sts
==
REM__TIMEOUT
)
{
if
(
EVEN
(
sts
))
{
pcom
->
provideStatus
(
sts
);
pcom
->
provideStatus
(
sts
);
return
;
return
;
}
}
if
(
sts
==
REM__TIMEOUT
)
{
pcom
->
provideStatus
(
REM__UDPNOCON
);
return
;
}
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
...
@@ -271,10 +279,15 @@ void remote_pvd_pwrcli::writeAttribute( co_procom *pcom, pwr_tOix oix,
...
@@ -271,10 +279,15 @@ void remote_pvd_pwrcli::writeAttribute( co_procom *pcom, pwr_tOix oix,
if
(
pvd_cLog
)
logg
(
"Write"
,
aref
.
Objid
.
oix
,
aname
);
if
(
pvd_cLog
)
logg
(
"Write"
,
aref
.
Objid
.
oix
,
aname
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
if
(
EVEN
(
sts
)
||
sts
==
REM__TIMEOUT
)
{
if
(
EVEN
(
sts
))
{
pcom
->
provideStatus
(
sts
);
pcom
->
provideStatus
(
sts
);
return
;
return
;
}
}
if
(
sts
==
REM__TIMEOUT
)
{
pcom
->
provideStatus
(
REM__UDPNOCON
);
return
;
}
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
...
@@ -329,10 +342,14 @@ void remote_pvd_pwrcli::readAttribute( co_procom *pcom, pwr_tOix oix,
...
@@ -329,10 +342,14 @@ void remote_pvd_pwrcli::readAttribute( co_procom *pcom, pwr_tOix oix,
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
if
(
pvd_cLog
)
logg
(
"Reply"
,
sts
,
""
);
if
(
pvd_cLog
)
logg
(
"Reply"
,
sts
,
""
);
if
(
EVEN
(
sts
)
||
sts
==
REM__TIMEOUT
)
{
if
(
EVEN
(
sts
))
{
pcom
->
provideStatus
(
sts
);
pcom
->
provideStatus
(
sts
);
return
;
return
;
}
}
if
(
sts
==
REM__TIMEOUT
)
{
pcom
->
provideStatus
(
REM__UDPNOCON
);
return
;
}
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
...
@@ -496,10 +513,14 @@ void remote_pvd_pwrcli::subAssociateBuffer( co_procom *pcom, void **buff, int oi
...
@@ -496,10 +513,14 @@ void remote_pvd_pwrcli::subAssociateBuffer( co_procom *pcom, void **buff, int oi
if
(
pvd_cLog
)
logg
(
"AssoBuff"
,
msg
.
Oid
.
oix
,
aname
);
if
(
pvd_cLog
)
logg
(
"AssoBuff"
,
msg
.
Oid
.
oix
,
aname
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
if
(
EVEN
(
sts
)
||
sts
==
REM__TIMEOUT
)
{
if
(
EVEN
(
sts
))
{
pcom
->
provideStatus
(
sts
);
pcom
->
provideStatus
(
sts
);
return
;
return
;
}
}
if
(
sts
==
REM__TIMEOUT
)
{
pcom
->
provideStatus
(
REM__UDPNOCON
);
return
;
}
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
...
@@ -546,10 +567,14 @@ void remote_pvd_pwrcli::subDisassociateBuffer( co_procom *pcom, pwr_tSubid subid
...
@@ -546,10 +567,14 @@ void remote_pvd_pwrcli::subDisassociateBuffer( co_procom *pcom, pwr_tSubid subid
if
(
pvd_cLog
)
logg
(
"DisoBuff"
,
subid
.
rix
,
"(rix)"
);
if
(
pvd_cLog
)
logg
(
"DisoBuff"
,
subid
.
rix
,
"(rix)"
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
sts
=
udp_Request
(
(
char
*
)
&
msg
,
sizeof
(
msg
),
(
char
**
)
&
rmsg
);
if
(
EVEN
(
sts
)
||
sts
==
REM__TIMEOUT
)
{
if
(
EVEN
(
sts
))
{
pcom
->
provideStatus
(
sts
);
pcom
->
provideStatus
(
sts
);
return
;
return
;
}
}
if
(
sts
==
REM__TIMEOUT
)
{
pcom
->
provideStatus
(
REM__UDPNOCON
);
return
;
}
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
...
@@ -579,12 +604,19 @@ void remote_pvd_pwrcli::subRequest( co_procom *pcom)
...
@@ -579,12 +604,19 @@ void remote_pvd_pwrcli::subRequest( co_procom *pcom)
msg
.
Type
=
rpvd_eMsg_SubRequest
;
msg
.
Type
=
rpvd_eMsg_SubRequest
;
msg
.
Id
=
rpvd_id
++
;
msg
.
Id
=
rpvd_id
++
;
for
(;;)
{
for
(;;)
{
sts
=
udp_CheckLink
();
if
(
EVEN
(
sts
))
return
;
sts
=
udp_Send
(
(
char
*
)
&
msg
,
sizeof
(
msg
));
sts
=
udp_Send
(
(
char
*
)
&
msg
,
sizeof
(
msg
));
if
(
EVEN
(
sts
))
return
;
if
(
EVEN
(
sts
))
return
;
sts
=
udp_Receive
(
(
char
**
)
&
rmsg
,
5000
);
sts
=
udp_Receive
(
(
char
**
)
&
rmsg
,
1000
);
if
(
EVEN
(
sts
)
||
sts
==
REM__TIMEOUT
)
if
(
EVEN
(
sts
))
return
;
if
(
sts
==
REM__TIMEOUT
)
{
udp_LinkFailure
();
return
;
return
;
}
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
while
(
rmsg
->
Id
!=
msg
.
Id
)
{
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
dispatch
(
pcom
,
(
rpvd_sMsg
*
)
rmsg
);
...
...
remote/lib/remote/src/remote_pvd_udp.c
View file @
828fbbeb
...
@@ -29,6 +29,7 @@
...
@@ -29,6 +29,7 @@
#include <arpa/inet.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <netdb.h>
#include "co_time.h"
#include "rs_remote_msg.h"
#include "rs_remote_msg.h"
#include "remote_pvd_udp.h"
#include "remote_pvd_udp.h"
...
@@ -167,25 +168,56 @@ static int CreateSocket( udp_tCtx ctx)
...
@@ -167,25 +168,56 @@ static int CreateSocket( udp_tCtx ctx)
return
1
;
return
1
;
}
}
static
pwr_tTime
last_try
=
{
0
,
0
};
pwr_tStatus
udp_CheckLink
()
{
if
(
!
udp_ctx
->
LinkUp
&&
last_try
.
tv_sec
!=
0
)
{
/* Don't try again within 20 seconds */
pwr_tTime
current
;
pwr_tDeltaTime
diff
;
time_GetTime
(
&
current
);
time_Adiff
(
&
diff
,
&
current
,
&
last_try
);
if
(
time_DToFloat
(
0
,
&
diff
)
<
30
)
{
// printf( "Reqest Dismissed\n");
return
REM__UDPNOCON
;
}
}
return
REM__SUCCESS
;
}
void
udp_LinkFailure
()
{
time_GetTime
(
&
last_try
);
// printf( "Request timeout !!!!!!!!!!\n");
}
pwr_tStatus
udp_Request
(
char
*
sendbuf
,
int
sendbuf_size
,
pwr_tStatus
udp_Request
(
char
*
sendbuf
,
int
sendbuf_size
,
char
**
rcvbuf
)
char
**
rcvbuf
)
{
{
int
i
;
int
i
;
pwr_tStatus
sts
;
pwr_tStatus
sts
;
int
tmo
=
4
00
;
int
tmo
=
2
00
;
if
(
udp_ctx
->
Disable
)
return
REM__DISABLED
;
if
(
udp_ctx
->
Disable
)
return
REM__DISABLED
;
sts
=
udp_CheckLink
();
if
(
EVEN
(
sts
))
return
sts
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
for
(
i
=
0
;
i
<
4
;
i
++
)
{
sts
=
udp_Send
(
sendbuf
,
sendbuf_size
);
sts
=
udp_Send
(
sendbuf
,
sendbuf_size
);
if
(
EVEN
(
sts
))
return
sts
;
if
(
EVEN
(
sts
))
return
sts
;
sts
=
udp_Receive
(
rcvbuf
,
tmo
);
sts
=
udp_Receive
(
rcvbuf
,
tmo
);
if
(
sts
!=
REM__TIMEOUT
)
if
(
sts
!=
REM__TIMEOUT
)
{
udp_ctx
->
LinkUp
=
1
;
return
sts
;
return
sts
;
}
tmo
=
tmo
*
2
;
tmo
=
tmo
*
2
;
}
}
udp_LinkFailure
();
if
(
udp_ctx
->
LinkUp
)
{
if
(
udp_ctx
->
LinkUp
)
{
printf
(
"UDP link Down to node %s
\n
"
,
udp_ctx
->
RemoteHostName
);
printf
(
"UDP link Down to node %s
\n
"
,
udp_ctx
->
RemoteHostName
);
udp_ctx
->
LinkUp
=
0
;
udp_ctx
->
LinkUp
=
0
;
...
@@ -202,7 +234,7 @@ pwr_tStatus udp_Send( char *buf, int buf_size)
...
@@ -202,7 +234,7 @@ pwr_tStatus udp_Send( char *buf, int buf_size)
char
data
[
UDP_MAX_SIZE
];
char
data
[
UDP_MAX_SIZE
];
}
message
;
}
message
;
if
(
ctx
->
Disable
)
return
REM__DISABLED
;
if
(
ctx
->
Disable
)
return
REM__DISABLED
;
message
.
header
.
protocol_id
[
0
]
=
STX
;
message
.
header
.
protocol_id
[
0
]
=
STX
;
...
...
remote/lib/remote/src/remote_pvd_udp.h
View file @
828fbbeb
...
@@ -98,7 +98,7 @@ typedef struct {
...
@@ -98,7 +98,7 @@ typedef struct {
pwr_tOName
Attribute
;
pwr_tOName
Attribute
;
int
Size
;
int
Size
;
pwr_tTypeId
Tid
;
pwr_tTypeId
Tid
;
char
Value
[
1
0
00
];
char
Value
[
1
2
00
];
}
rpvd_sMsgAttribute
;
}
rpvd_sMsgAttribute
;
typedef
struct
{
typedef
struct
{
...
@@ -109,7 +109,7 @@ typedef struct {
...
@@ -109,7 +109,7 @@ typedef struct {
pwr_tOName
Attribute
;
pwr_tOName
Attribute
;
int
Size
;
int
Size
;
pwr_tTypeId
Tid
;
pwr_tTypeId
Tid
;
char
Value
[
1
0
00
];
char
Value
[
1
2
00
];
}
rpvd_sMsgWriteAttribute
;
}
rpvd_sMsgWriteAttribute
;
typedef
struct
{
typedef
struct
{
...
@@ -164,6 +164,8 @@ pwr_tStatus udp_Request( char *sendbuf, int sendbuf_size,
...
@@ -164,6 +164,8 @@ pwr_tStatus udp_Request( char *sendbuf, int sendbuf_size,
pwr_tStatus
udp_Init
(
char
*
remote_address
,
char
*
remote_host_name
,
int
port
);
pwr_tStatus
udp_Init
(
char
*
remote_address
,
char
*
remote_host_name
,
int
port
);
void
udp_LinkFailure
();
pwr_tStatus
udp_CheckLink
();
#if defined __cplusplus
#if defined __cplusplus
}
}
...
...
src/msg/rs/src/rs_remote_msg.msg
View file @
828fbbeb
...
@@ -64,3 +64,4 @@ udpunknown <UDP message from unknown ip-address '%s' received> /info
...
@@ -64,3 +64,4 @@ udpunknown <UDP message from unknown ip-address '%s' received> /info
udpweirdheader <UDP message with illegal header received> /info
udpweirdheader <UDP message with illegal header received> /info
disorder <Message disorder> /error
disorder <Message disorder> /error
disabled <Transport disabled> /error
disabled <Transport disabled> /error
udpnocon <No UDP connection> /error
\ No newline at end of file
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