diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/CMakeLists.txt | 1 | ||||
-rw-r--r-- | src/sm-error.c | 71 | ||||
-rw-r--r-- | src/sm-error.h | 71 |
3 files changed, 91 insertions, 52 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 96d906b..f157b7d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,6 +25,7 @@ pkg_check_modules(sm_binding_depends afb-daemon glib-2.0 gio-2.0 gio-unix-2.0 js set(binding_sm_sources soundmanager.c sm-helper.c + sm-error.c audiomanager_proxy.c dbus/audio_manager_interface.c) diff --git a/src/sm-error.c b/src/sm-error.c new file mode 100644 index 0000000..79a2009 --- /dev/null +++ b/src/sm-error.c @@ -0,0 +1,71 @@ +/* + * 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. + */ + +#include "sm-error.h" +#include "sm-def.h" + +const char* get_response_audiomanager_massage_error(int am_error_code) +{ + switch (am_error_code){ + case UNABLE_SEND: + return "Unable to send request to audiomanager"; + case NOT_INITIALIZED: + return "soundmanager is not initialized"; + case OK: + return "OK"; + case UNKNOWN: + return "unknown error"; + case OUT_RANGE: + return "value out of range"; + case NOT_USED: + return "not used"; + case DATABASE_ERR: + return "database error occured"; + case OBJECT_ALREADY_EXIST: + return "the desired object already exists"; + case NO_CHANGE: + return "there is no change"; + case ACTION_IMPOSSIBLE: + return "the desired action is not possible"; + case OBJECT_NOT_EXIST: + return "the desired object is non existent"; + case ASYNC_ACTION_ABORTED: + return "the asynchronous action was aborted"; + case CONNECTION_FORMAT_ERR: + return "connectionFormat is not selected"; + case COMMUNICATION_ERR: + return "communication error"; + case EVENT_NOT_EXIST: + return "desired event doesn't exist"; + default: + return "Audio Manager responsed unknown error number"; + } +} + +const char* get_source_state_key(int am_source_state){ + switch (am_source_state){ + case 0: + return "unknown"; + case 1: + return "on"; + case 2: + return "off"; + case 3: + return "paused"; + default: + return ""; + } +}
\ No newline at end of file diff --git a/src/sm-error.h b/src/sm-error.h index afaaed8..521fca2 100644 --- a/src/sm-error.h +++ b/src/sm-error.h @@ -1,53 +1,20 @@ -#ifndef SM_ERROR_H -#define SM_ERROR_H -#include "sm-def.h" - -char* get_response_audiomanager_massage_error(int am_error_code) -{ - switch (am_error_code){ - case OK: - return "OK"; - case UNKNOWN: - return "unknown error"; - case OUT_RANGE: - return "value out of range"; - case NOT_USED: - return "not used"; - case DATABASE_ERR: - return "database error occured"; - case OBJECT_ALREADY_EXIST: - return "the desired object already exists"; - case NO_CHANGE: - return "there is no change"; - case ACTION_IMPOSSIBLE: - return "the desired action is not possible"; - case OBJECT_NOT_EXIST: - return "the desired object is non existent"; - case ASYNC_ACTION_ABORTED: - return "the asynchronous action was aborted"; - case CONNECTION_FORMAT_ERR: - return "connectionFormat is not selected"; - case COMMUNICATION_ERR: - return "communication error"; - case EVENT_NOT_EXIST: - return "desired event doesn't exist"; - default: - return "Audio Manager responsed unknown error number"; - } -} - -char* get_source_state_key(int am_source_state){ - switch (am_source_state){ - case 0: - return "unknown"; - case 1: - return "on"; - case 2: - return "off"; - case 3: - return "paused"; - default: - return ""; - } -} +/* + * 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. + */ +#ifndef SOUNDMANAGER_ERROR_H +#define SOUNDMANAGER_ERROR_H +const char* get_response_audiomanager_massage_error(int am_error_code); +const char* get_source_state_key(int am_source_state); #endif |