2 * Copyright (c) 2012 - 2014 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #include "input_mode_configure_bin_parser.h"
19 #include "simple_debug.h"
20 #include "put_record.h"
23 BinInputModeConfigParser::BinInputModeConfigParser() {
25 memset(m_input_mode_configure_table, 0x00, sizeof(SclInputModeConfigure) * MAX_SCL_INPUT_MODE);
26 parser_info_provider = NULL;
29 BinInputModeConfigParser::~BinInputModeConfigParser() {
32 BinInputModeConfigParser*
33 BinInputModeConfigParser::get_instance() {
34 static BinInputModeConfigParser instance;
39 BinInputModeConfigParser::init(const FileStorage& storage, int offset, int size, IParserInfo_Provider* provider) {
40 m_storage.set_str_provider(parser_info_provider);
41 m_storage.get_storage(storage, offset, size);
42 this->parser_info_provider = provider;
43 parsing_input_mode_configure_table();
47 BinInputModeConfigParser::get_inputmode_id(const char *name) {
48 if (name == NULL) return -1;
50 for (int i = 0; i < MAX_SCL_INPUT_MODE; ++i) {
51 if ( m_input_mode_configure_table[i].name ) {
52 if ( 0 == strcmp(m_input_mode_configure_table[i].name, name) ) {
62 BinInputModeConfigParser::get_inputmode_name(int id) {
63 if (id >= 0 && id < MAX_SCL_INPUT_MODE) {
64 return m_input_mode_configure_table[id].name;
71 BinInputModeConfigParser::get_inputmode_size() {
72 return m_inputmode_size;
76 BinInputModeConfigParser::parsing_input_mode_configure_table() {
81 m_inputmode_size = m_storage.get<sint_t>(4);
83 Input_mode_configure_width record_width;
84 set_input_mode_configure_width(*parser_info_provider, record_width);
86 PSclInputModeConfigure cur = m_input_mode_configure_table;
88 for (int i = 0; i < m_inputmode_size; ++i) {
90 m_storage.get_str(&(cur->name), record_width.name, m_string_collector);
92 m_storage.get_str(&(cur->layouts[0]), record_width.layout_portrait, m_string_collector);
94 m_storage.get_str(&(cur->layouts[1]), record_width.layout_landscape, m_string_collector);
96 cur->use_virtual_window = m_storage.get<sint_t>(record_width.use_virtual_window);
98 cur->use_dim_window = m_storage.get<sint_t>(record_width.use_dim_window);
100 cur->timeout = m_storage.get<sint_t>(record_width.timeout);
105 #ifdef __SCL_TXT_DEBUG
106 put_input_mode_configure_table(DECODE, m_input_mode_configure_table);
110 PSclInputModeConfigure
111 BinInputModeConfigParser::get_input_mode_configure_table() {
112 return m_input_mode_configure_table;