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
bbac8458
Commit
bbac8458
authored
Jan 29, 2018
by
Claes Sjofors
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of newton:/data1/x0-0-0/pwr
parents
61dbf96a
2adf1b8a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
27 deletions
+24
-27
src/lib/co/src/co_cdh.c
src/lib/co/src/co_cdh.c
+24
-27
No files found.
src/lib/co/src/co_cdh.c
View file @
bbac8458
...
...
@@ -490,83 +490,80 @@ cdh_AttrValueToString (
{
pwr_tStatus
sts
=
CDH__SUCCESS
;
char
timbuf
[
24
];
static
char
sval
[
512
];
sval
[
0
]
=
'\0'
;
switch
(
Type
)
{
case
pwr_eType_Boolean
:
if
(
*
(
pwr_tBoolean
*
)
Value
)
strcpy
(
sval
,
"1"
);
strcpy
(
String
,
"1"
);
else
strcpy
(
sval
,
"0"
);
strcpy
(
String
,
"0"
);
break
;
case
pwr_eType_Float32
:
s
printf
(
sval
,
"%g"
,
*
(
pwr_tFloat32
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
"%g"
,
*
(
pwr_tFloat32
*
)
Value
);
break
;
case
pwr_eType_Float64
:
s
printf
(
sval
,
"%g"
,
*
(
pwr_tFloat64
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
"%g"
,
*
(
pwr_tFloat64
*
)
Value
);
break
;
case
pwr_eType_Char
:
if
(
*
(
pwr_tChar
*
)
Value
==
0
)
*
sval
=
'\0'
;
*
String
=
'\0'
;
else
sprintf
(
sval
,
"%c"
,
*
(
pwr_tChar
*
)
Value
);
sprintf
(
String
,
"%c"
,
*
(
pwr_tChar
*
)
Value
);
break
;
case
pwr_eType_Int8
:
s
printf
(
sval
,
"%d"
,
*
(
pwr_tInt8
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
"%d"
,
*
(
pwr_tInt8
*
)
Value
);
break
;
case
pwr_eType_Int16
:
s
printf
(
sval
,
"%hd"
,
*
(
pwr_tInt16
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
"%hd"
,
*
(
pwr_tInt16
*
)
Value
);
break
;
case
pwr_eType_Int32
:
case
pwr_eType_Status
:
case
pwr_eType_NetStatus
:
case
pwr_eType_Enum
:
s
printf
(
sval
,
"%d"
,
*
(
pwr_tInt32
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
"%d"
,
*
(
pwr_tInt32
*
)
Value
);
break
;
case
pwr_eType_Int64
:
s
printf
(
sval
,
pwr_dFormatInt64
,
*
(
pwr_tInt64
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
pwr_dFormatInt64
,
*
(
pwr_tInt64
*
)
Value
);
break
;
case
pwr_eType_UInt8
:
s
printf
(
sval
,
"%u"
,
*
(
pwr_tUInt8
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
"%u"
,
*
(
pwr_tUInt8
*
)
Value
);
break
;
case
pwr_eType_UInt16
:
s
printf
(
sval
,
"%hu"
,
*
(
pwr_tUInt16
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
"%hu"
,
*
(
pwr_tUInt16
*
)
Value
);
break
;
case
pwr_eType_UInt32
:
case
pwr_eType_Mask
:
s
printf
(
sval
,
"%u"
,
*
(
pwr_tUInt32
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
"%u"
,
*
(
pwr_tUInt32
*
)
Value
);
break
;
case
pwr_eType_UInt64
:
s
printf
(
sval
,
pwr_dFormatUInt64
,
*
(
pwr_tUInt64
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
pwr_dFormatUInt64
,
*
(
pwr_tUInt64
*
)
Value
);
break
;
case
pwr_eType_Time
:
if
(
ODD
(
time_AtoAscii
(
Value
,
time_eFormat_DateAndTime
,
timbuf
,
sizeof
(
timbuf
))))
{
str
cpy
(
sval
,
timbuf
);
str
ncpy
(
String
,
timbuf
,
MaxSize
);
}
else
{
s
printf
(
sval
,
"*** Bad time value ***"
);
s
trncpy
(
String
,
"*** Bad time value ***"
,
MaxSize
);
sts
=
CDH__INVTIME
;
}
break
;
case
pwr_eType_DeltaTime
:
if
(
ODD
(
time_DtoAscii
(
Value
,
1
,
timbuf
,
sizeof
(
timbuf
))))
{
str
cpy
(
sval
,
timbuf
);
str
ncpy
(
String
,
timbuf
,
MaxSize
);
}
else
{
s
printf
(
sval
,
"*** Bad delta time value ***"
);
s
trncpy
(
String
,
"*** Bad delta time value ***"
,
MaxSize
);
sts
=
CDH__INVDELTATIME
;
}
break
;
case
pwr_eType_String
:
case
pwr_eType_Text
:
s
printf
(
sval
,
"%s"
,
(
char
*
)
Value
);
s
nprintf
(
String
,
MaxSize
,
"%s"
,
(
char
*
)
Value
);
break
;
case
pwr_eType_ProString
:
{
int
len
=
strlen
(
(
char
*
)
Valu
e
);
int
len
=
MAX
(
strlen
(
(
char
*
)
Value
),
MaxSiz
e
);
int
i
;
strcpy
(
sval
,
""
);
strcpy
(
String
,
""
);
for
(
i
=
0
;
i
<
len
;
i
++
)
strcat
(
sval
,
"*"
);
strcat
(
String
,
"*"
);
break
;
}
default:
...
...
@@ -574,7 +571,7 @@ cdh_AttrValueToString (
break
;
}
strncpy
(
String
,
sval
,
MaxSize
)
;
String
[
MaxSize
-
1
]
=
0
;
return
sts
;
}
...
...
@@ -3217,4 +3214,4 @@ pwr_tUInt32 cdh_AttrElemSize( pwr_sParInfo *info)
return
cdh_AttrSize
(
info
)
/
info
->
Elements
;
}
/*@}*/
\ 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