diff options
author | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2017-07-31 17:30:17 +0900 |
---|---|---|
committer | zheng_wenlong <wenlong_zheng@nexty-ele.com> | 2017-08-10 10:19:16 +0900 |
commit | 183e61cb341a9bb394b1e933edb66284211ef7e6 (patch) | |
tree | b2ebaab0cece1f5f57bceb82555986b7bf541595 /src/prop_info.c | |
parent | f9bdd961edde55b918129064578b0405d28281d0 (diff) |
Add agl-service-steering-wheel
Add new binding service for steering wheel.
Right now it's for logitech g29 and build on reneses m3ulcb.
Had test on Daring Dab 3.99.2, 3.99.3, 4.0.0.
After this commit, we want to add some code for dashboard to use this binding.
[Modify 20170803]
Deleted trailing whitespace in README.md
Fixed typo enogh to enough
Modfied .noconcurrency 0 to 1 for atomic
Checked event valid by afb_event_is_valid
Droped event when not enough memory by afb_event_drop
[Modify 20170804]
Modify json path into afb_daemon_rootdir_open_locale
Delete error.h for same ERRMSG define in af-steering-wheel-binding.h
Delete install code in recipes because aglwgt do autoinstall
Add verbs information
[Modify 20170808]
Add target 'package' in CMakeLists.txt to make package
[Modify 20170810]
Add new folder named 'package' for jenkins job
Change-Id: I975b1ce3afbeea0145ea723586b4b46288c987ab
Signed-off-by: zheng_wenlong <wenlong_zheng@nexty-ele.com>
Diffstat (limited to 'src/prop_info.c')
-rw-r--r-- | src/prop_info.c | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/prop_info.c b/src/prop_info.c new file mode 100644 index 0000000..95d4f58 --- /dev/null +++ b/src/prop_info.c @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2017 TOYOTA MOTOR CORPORATION + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define _GNU_SOURCE +#include <stdio.h> +#include <string.h> +#include <stdint.h> + +#include "prop_info.h" +#include "af-steering-wheel-binding.h" + +#define ENABLE1_TYPENAME "ENABLE-1" /* spec. type1.json original type name */ + +static const char *vartype_strings[] = { +/* 0 */ "void", +/* 1 */ "int8_t", +/* 2 */ "int16_t", +/* 3 */ "int", +/* 4 */ "int32_t", +/* 5 */ "int64_t", +/* 6 */ "uint8_t", +/* 7 */ "uint16_t", +/* 8 */ "uint", +/* 9 */ "uint32_t", +/* 10 */"uint64_t", +/* 11 */ "string", +/* 12 */ "bool", +/* 13 */ "LIST", +/* 14 */ ENABLE1_TYPENAME +}; + +int string2vartype(const char *varname) +{ + unsigned int i; + if (varname == NULL) + { + return -1; + } + + for(i=0; i < (sizeof(vartype_strings)/sizeof(char *)); i++) + { + if (strcmp(varname, vartype_strings[i]) == 0) + return (int)i; + } + + return -1; +}; + +int propertyValue_int(struct prop_info_t *property_info) +{ + int x = -1; + switch(property_info->var_type) { + case INT8_T: + x = (int)property_info->curValue.int8_val; + break; + case INT16_T: + x = (int)property_info->curValue.int16_val; + break; + case VOID_T:/* FALLTHROGH */ + case INT_T: /* FALLTHROGH */ + case INT32_T:/* FALLTHROGH */ + x = (int)property_info->curValue.int32_val; + break; + case UINT8_T: + x = (int)property_info->curValue.uint8_val; + break; + case UINT16_T: + x = (int)property_info->curValue.uint16_val; + break; + case UINT_T: + case UINT32_T: + x = (int)property_info->curValue.uint32_val; + break; + case BOOL_T: + x = (int)property_info->curValue.bool_val; + break; + case ENABLE1_T: + x = (int)property_info->curValue.int32_val; + break; + + default: + case STRING_T: + case ARRAY_T: + case UINT64_T: + case INT64_T: + ERRMSG("Getting property Value:NOT SUPPORT vartype contents:%s %d", property_info->name, property_info->var_type); + break; + } + return x; +} |