4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
26 using std::istringstream;
28 cconfig::cconfig(void)
33 cconfig::~cconfig(void)
38 bool cconfig::get_device_id(void)
40 const string INFO_INI_PATH = "/etc/info.ini";
41 const string START_DELIMETER = "Model=";
42 const string END_DELIMETER = ";";
45 std::size_t start_pos, end_pos;
48 in_file.open(INFO_INI_PATH);
50 if (!in_file.is_open())
53 while (!in_file.eof()) {
54 getline(in_file, line);
55 start_pos = line.find(START_DELIMETER);
57 if (start_pos != std::string::npos) {
58 start_pos = start_pos + START_DELIMETER.size();
59 end_pos = line.find(END_DELIMETER, start_pos);
61 if (end_pos != std::string::npos) {
62 m_device_id = line.substr(start_pos, end_pos - start_pos);