Commit df160af0 authored by nickolay.kovalev's avatar nickolay.kovalev
Browse files

bool support

parent a55da276
......@@ -454,6 +454,11 @@ void parseWriteParameters(const char *input, int32_t *nmSpace, uint32_t *nodeId,
UA_String string_val = stringify(value_string.c_str(), value_string.length());
UA_Variant_setScalarCopy(val, &string_val, type);
}
else if (type_string.compare("bool") == 0){
type = &UA_TYPES[UA_TYPES_BOOLEAN];
UA_Boolean bool_val = (type_string.compare("0") == 0) ? UA_FALSE : UA_TRUE;
UA_Variant_setScalarCopy(val, &bool_val, type);
}
else{
*nmSpace = -1;
}
......
......@@ -237,4 +237,8 @@ value_per_type(<<"float">>, Value) when is_float(Value) ->
value_per_type(<<"double">>, Value) when is_float(Value) ->
erlang:float_to_binary(Value);
value_per_type(<<"string">>, Value) when is_binary(Value) ->
Value.
\ No newline at end of file
Value;
value_per_type(<<"bool">>, Value) when Value =:= <<"0">>; Value =:= 0; Value =:= false ->
<<"0">>;
value_per_type(<<"bool">>, Value) ->
<<"1">>.
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment