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
20cd46d1
Commit
20cd46d1
authored
Jul 08, 2004
by
claes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Function GetMsg added
parent
b1ae8c60
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
95 additions
and
1 deletion
+95
-1
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.c
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.c
+79
-1
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.h
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.h
+16
-0
No files found.
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.c
View file @
20cd46d1
...
@@ -8,6 +8,7 @@
...
@@ -8,6 +8,7 @@
#include "co_dcli.h"
#include "co_dcli.h"
#include "co_time.h"
#include "co_time.h"
#include "co_api.h"
#include "co_api.h"
#include "co_msg.h"
#include "co_cdh_msg.h"
#include "co_cdh_msg.h"
#include "rt_gdh_msg.h"
#include "rt_gdh_msg.h"
...
@@ -1297,7 +1298,9 @@ static void gdh_TranslateSuffixToClassData (
...
@@ -1297,7 +1298,9 @@ static void gdh_TranslateSuffixToClassData (
// {"STRING" ,pwr_eType_String, sizeof(void *)},
// {"STRING" ,pwr_eType_String, sizeof(void *)},
{
"TIME"
,
pwr_eType_Time
,
sizeof
(
pwr_tTime
)},
{
"TIME"
,
pwr_eType_Time
,
sizeof
(
pwr_tTime
)},
{
"DELTATIME"
,
pwr_eType_DeltaTime
,
sizeof
(
pwr_tDeltaTime
)},
{
"DELTATIME"
,
pwr_eType_DeltaTime
,
sizeof
(
pwr_tDeltaTime
)},
{
"ATTRREF"
,
pwr_eType_AttrRef
,
sizeof
(
pwr_sAttrRef
)}
{
"ATTRREF"
,
pwr_eType_AttrRef
,
sizeof
(
pwr_sAttrRef
)},
{
"STATUS"
,
pwr_eType_Status
,
sizeof
(
pwr_tStatus
)},
{
"NETSTATUS"
,
pwr_eType_NetStatus
,
sizeof
(
pwr_tNetStatus
)}
};
};
static
const
int
XlationTblLen
=
sizeof
(
XlationTbl
)
/
sizeof
(
XlationTbl
[
0
]);
static
const
int
XlationTblLen
=
sizeof
(
XlationTbl
)
/
sizeof
(
XlationTbl
[
0
]);
...
@@ -1437,6 +1440,10 @@ static int gdh_StringToAttr( char *str_value, char *buffer_p, int buffer_size,
...
@@ -1437,6 +1440,10 @@ static int gdh_StringToAttr( char *str_value, char *buffer_p, int buffer_size,
return
GDH__BADARG
;
return
GDH__BADARG
;
break
;
break
;
case
pwr_eType_UInt32
:
case
pwr_eType_UInt32
:
case
pwr_eType_Enum
:
case
pwr_eType_Mask
:
case
pwr_eType_Status
:
case
pwr_eType_NetStatus
:
if
(
sscanf
(
str_value
,
"%u"
,
(
pwr_tUInt32
*
)
buffer_p
)
!=
1
)
if
(
sscanf
(
str_value
,
"%u"
,
(
pwr_tUInt32
*
)
buffer_p
)
!=
1
)
return
GDH__BADARG
;
return
GDH__BADARG
;
break
;
break
;
...
@@ -1621,6 +1628,10 @@ static void gdh_AttrToString( int type_id, void *value_ptr,
...
@@ -1621,6 +1628,10 @@ static void gdh_AttrToString( int type_id, void *value_ptr,
break
;
break
;
}
}
case
pwr_eType_UInt32
:
case
pwr_eType_UInt32
:
case
pwr_eType_Enum
:
case
pwr_eType_Mask
:
case
pwr_eType_Status
:
case
pwr_eType_NetStatus
:
{
{
if
(
!
format
)
if
(
!
format
)
*
len
=
sprintf
(
str
,
"%d"
,
*
(
unsigned
int
*
)
value_ptr
);
*
len
=
sprintf
(
str
,
"%d"
,
*
(
unsigned
int
*
)
value_ptr
);
...
@@ -2097,3 +2108,70 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_crrSignal
...
@@ -2097,3 +2108,70 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_crrSignal
return
return_obj
;
return
return_obj
;
}
}
JNIEXPORT
jobject
JNICALL
Java_jpwr_rt_Gdh_getMsg
(
JNIEnv
*
env
,
jclass
obj
,
jint
sts
)
{
int
status
;
jobject
return_obj
;
jint
jsts
;
jstring
jbuf
=
NULL
;
char
buf
[
200
];
jclass
cdhrString_id
;
static
jmethodID
cdhrString_cid
=
NULL
;
cdhrString_id
=
(
*
env
)
->
FindClass
(
env
,
"jpwr/rt/CdhrString"
);
if
(
cdhrString_cid
==
NULL
)
{
cdhrString_cid
=
(
*
env
)
->
GetMethodID
(
env
,
cdhrString_id
,
"<init>"
,
"(Ljava/lang/String;I)V"
);
//printf("cdhrString_cid initierad\n");
}
status
=
(
pwr_tStatus
)
sts
;
msg_GetMsg
(
status
,
buf
,
sizeof
(
buf
));
jbuf
=
(
*
env
)
->
NewStringUTF
(
env
,
buf
);
jsts
=
(
jint
)
GDH__SUCCESS
;
return_obj
=
(
*
env
)
->
NewObject
(
env
,
cdhrString_id
,
cdhrString_cid
,
jbuf
,
jsts
);
return
return_obj
;
}
JNIEXPORT
jobject
JNICALL
Java_jpwr_rt_Gdh_getMsgText
(
JNIEnv
*
env
,
jclass
obj
,
jint
sts
)
{
int
status
;
jobject
return_obj
;
jint
jsts
;
jstring
jbuf
=
NULL
;
char
buf
[
200
];
jclass
cdhrString_id
;
static
jmethodID
cdhrString_cid
=
NULL
;
cdhrString_id
=
(
*
env
)
->
FindClass
(
env
,
"jpwr/rt/CdhrString"
);
if
(
cdhrString_cid
==
NULL
)
{
cdhrString_cid
=
(
*
env
)
->
GetMethodID
(
env
,
cdhrString_id
,
"<init>"
,
"(Ljava/lang/String;I)V"
);
//printf("cdhrString_cid initierad\n");
}
status
=
(
pwr_tStatus
)
sts
;
msg_GetText
(
status
,
buf
,
sizeof
(
buf
));
jbuf
=
(
*
env
)
->
NewStringUTF
(
env
,
buf
);
jsts
=
(
jint
)
GDH__SUCCESS
;
return_obj
=
(
*
env
)
->
NewObject
(
env
,
cdhrString_id
,
cdhrString_cid
,
jbuf
,
jsts
);
return
return_obj
;
}
java/exe/jpwr_rt_gdh/src/jpwr_rt_gdh.h
View file @
20cd46d1
...
@@ -308,6 +308,22 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_crrSignal
...
@@ -308,6 +308,22 @@ JNIEXPORT jobject JNICALL Java_jpwr_rt_Gdh_crrSignal
JNIEXPORT
jobject
JNICALL
Java_jpwr_rt_Gdh_crrObject
JNIEXPORT
jobject
JNICALL
Java_jpwr_rt_Gdh_crrObject
(
JNIEnv
*
,
jobject
,
jstring
);
(
JNIEnv
*
,
jobject
,
jstring
);
/*
* Class: jpwr_rt_Gdh
* Method: getMsg
* Signature: (I)Ljpwr/rt/CdhrString;
*/
JNIEXPORT
jobject
JNICALL
Java_jpwr_rt_Gdh_getMsg
(
JNIEnv
*
,
jobject
,
jint
);
/*
* Class: jpwr_rt_Gdh
* Method: getMsgText
* Signature: (I)Ljpwr/rt/CdhrString;
*/
JNIEXPORT
jobject
JNICALL
Java_jpwr_rt_Gdh_getMsgText
(
JNIEnv
*
,
jobject
,
jint
);
#ifdef __cplusplus
#ifdef __cplusplus
}
}
#endif
#endif
...
...
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