mirror of
https://github.com/intrepidcs/libicsneo.git
synced 2026-08-05 01:18:36 +02:00
Bindings: Python: Add formatDisk
This commit is contained in:
committed by
Kyle Schwarz
parent
224e840841
commit
0aa7d338fd
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "icsneo/device/device.h"
|
||||
#include "icsneo/device/extensions/deviceextension.h"
|
||||
#include "icsneo/disk/diskdetails.h"
|
||||
|
||||
#include <fstream>
|
||||
|
||||
@@ -62,6 +63,11 @@ void init_device(pybind11::module_& m) {
|
||||
.def("write_macsec_config", &Device::writeMACsecConfig, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("send_eth_phy_msg", &Device::sendEthPhyMsg, pybind11::arg("message"), pybind11::arg("timeout") = std::chrono::milliseconds(50), pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_chip_versions", &Device::getChipVersions, pybind11::arg("refreshComponents") = true, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("supports_disk_formatting", &Device::supportsDiskFormatting, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_disk_count", &Device::getDiskCount, pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("get_disk_details", &Device::getDiskDetails, pybind11::arg("timeout") = std::chrono::milliseconds(100), pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("force_disk_config_update", &Device::forceDiskConfigUpdate, pybind11::arg("config"), pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def("format_disk", [](Device& device, const DiskDetails& config) -> bool { return device.formatDisk(config); }, pybind11::arg("config"), pybind11::call_guard<pybind11::gil_scoped_release>())
|
||||
.def_readonly("settings", &Device::settings);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
#include <pybind11/pybind11.h>
|
||||
#include <pybind11/stl.h>
|
||||
|
||||
#include "icsneo/disk/diskdetails.h"
|
||||
|
||||
namespace icsneo {
|
||||
|
||||
void init_diskdetails(pybind11::module_& m) {
|
||||
pybind11::enum_<DiskLayout>(m, "DiskLayout")
|
||||
.value("Spanned", DiskLayout::Spanned)
|
||||
.value("RAID0", DiskLayout::RAID0);
|
||||
|
||||
pybind11::classh<DiskInfo>(m, "DiskInfo")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("present", &DiskInfo::present)
|
||||
.def_readwrite("initialized", &DiskInfo::initialized)
|
||||
.def_readwrite("formatted", &DiskInfo::formatted)
|
||||
.def_readwrite("sectors", &DiskInfo::sectors)
|
||||
.def_readwrite("bytes_per_sector", &DiskInfo::bytesPerSector)
|
||||
.def("size", &DiskInfo::size);
|
||||
|
||||
pybind11::classh<DiskDetails>(m, "DiskDetails")
|
||||
.def(pybind11::init())
|
||||
.def_readwrite("layout", &DiskDetails::layout)
|
||||
.def_readwrite("full_format", &DiskDetails::fullFormat)
|
||||
.def_readwrite("disks", &DiskDetails::disks);
|
||||
}
|
||||
|
||||
} // namespace icsneo
|
||||
@@ -25,6 +25,7 @@ void init_ethernetstatusmessage(pybind11::module_&);
|
||||
void init_macsecconfig(pybind11::module_&);
|
||||
void init_scriptstatusmessage(pybind11::module_&);
|
||||
void init_diskdriver(pybind11::module_&);
|
||||
void init_diskdetails(pybind11::module_&);
|
||||
void init_deviceextension(pybind11::module_&);
|
||||
void init_chipid(pybind11::module_&);
|
||||
void init_versionreport(pybind11::module_&);
|
||||
@@ -67,6 +68,7 @@ PYBIND11_MODULE(icsneopy, m) {
|
||||
init_messagefilter(m);
|
||||
init_messagecallback(m);
|
||||
init_diskdriver(m);
|
||||
init_diskdetails(m);
|
||||
init_flexray(m);
|
||||
init_ethphymessage(m);
|
||||
init_chipid(m);
|
||||
|
||||
Reference in New Issue
Block a user