X-Git-Url: http://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=pv%2Fdevice%2Ffile.cpp;fp=pv%2Fdevice%2Ffile.cpp;h=0000000000000000000000000000000000000000;hp=368276a4ba8d8e1ce10e443ab645f9d19e3cad3c;hb=e8d009288de28cb194bc7964f96677c2baf900c9;hpb=87b79835014a386fb51b52bc993dbb693bd27197 diff --git a/pv/device/file.cpp b/pv/device/file.cpp deleted file mode 100644 index 368276a4..00000000 --- a/pv/device/file.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/* - * This file is part of the PulseView project. - * - * Copyright (C) 2014 Joel Holdsworth - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include "file.h" -#include "sessionfile.h" - -#include - -#include - -using std::make_pair; -using std::map; -using std::string; - -namespace pv { -namespace device { - -File::File(const std::string path) : - _path(path) -{ -} - -std::string File::format_device_title() const -{ - return boost::filesystem::path(_path).filename().string(); -} - -map File::get_device_info() const -{ - map result; - - result.insert(make_pair("vendor", "sigrok")); - result.insert(make_pair("model", "file")); - result.insert(make_pair("connection_id", - boost::filesystem::path(_path).filename().string())); - - return result; -} - -File* File::create(const string &name) -{ - struct sr_session *temp_session; - if (sr_session_load(name.c_str(), &temp_session) == SR_OK) { - GSList *devlist = NULL; - sr_session_dev_list(temp_session, &devlist); - sr_session_destroy(temp_session); - - if (devlist) { - sr_dev_inst *const sdi = (sr_dev_inst*)devlist->data; - g_slist_free(devlist); - if (sdi) { - sr_dev_close(sdi); - sr_dev_clear(sdi->driver); - return new SessionFile(name); - } - } - } - - return NULL; -} - -} // device -} // pv