22#include < pybind11/stl.h>
33#include < pybind11/iostream.h>
44#include < pybind11/operators.h>
5+ #include < pybind11/numpy.h>
56
67#include < Volume.h>
8+ #include < Directory.h>
9+ #include < Bitmap.h>
710
811namespace py = pybind11;
9- using namespace BPrivate ;
12+ /* using namespace BPrivate;
1013using namespace BPrivate::Storage;
1114using namespace BPrivate::Storage::Mime;
12- using namespace BPackageKit ;
15+ using namespace BPackageKit;*/
1316
14- void define_Volume (py::module_& m)
17+ PYBIND11_MODULE (Volume, m)
1518{
1619py::class_<BVolume>(m," BVolume" )
1720.def (py::init ()," " )
@@ -27,8 +30,18 @@ py::class_<BVolume>(m, "BVolume")
2730.def (" BlockSize" , &BVolume::BlockSize," " )
2831.def (" GetName" , &BVolume::GetName," " ,py::arg (" name" ))
2932.def (" SetName" , &BVolume::SetName," " ,py::arg (" name" ))
30- .def (" GetIcon" , py::overload_cast<BBitmap *, icon_size>(&BVolume::GetIcon)," " ,py::arg (" icon" ),py::arg (" which" ))
31- .def (" GetIcon" , py::overload_cast<unsigned char ,size_t *, type_code *>(&BVolume::GetIcon)," " ,py::arg (" _data" ),py::arg (" _size" ),py::arg (" _type" ))
33+ .def (" GetIcon" , py::overload_cast<BBitmap *, icon_size>(&BVolume::GetIcon, py::const_)," " ,py::arg (" icon" ),py::arg (" which" ))
34+ // .def("GetIcon", py::overload_cast<unsigned char, size_t *, type_code *>(&BVolume::GetIcon, py::const_), "", py::arg("_data"), py::arg("_size"), py::arg("_type"))
35+ .def (" GetIcon" , [](BVolume& self,size_t size, type_code type){
36+ uint8_t * data;
37+ status_t result = self.GetIcon (&data, &size, &type);
38+ py::array_t <uint8_t > array = py::array_t <uint8_t >(
39+ {static_cast <ssize_t >(size)},
40+ {sizeof (uint8_t )},
41+ data
42+ );
43+ return py::make_tuple (array, result);
44+ }," " ,py::arg (" size" ),py::arg (" type" ))
3245.def (" IsRemovable" , &BVolume::IsRemovable," " )
3346.def (" IsReadOnly" , &BVolume::IsReadOnly," " )
3447.def (" IsPersistent" , &BVolume::IsPersistent," " )