Open fgeorges56 opened 1 year ago
Hi @fgeorges56 did you could be able to download the file?? I'm in same trouble.
@fgeorges56
`#include
//includes for SDK
//includes for openCV
using namespace std; using namespace cv;
int main() { std::cout << "[INFO]:::Begin camera:::[INFO]" << std::endl; ins_camera::DeviceDiscovery discovery; auto list = discovery.GetAvailableDevices();
try {
for (int i = 0; i < list.size(); ++i) {
auto desc = list[i];
cout <<"[INFO]:::Device Found:::[INFO]"<< "\t"
<<"serial:" << desc.serial_number << "\t"
<< "camera type:" << int(desc.camera_type) << "\t"
<< "lens type:" << int(desc.lens_type) << endl;
}
}
catch (exception& e) {
cout<<"[ERROR]::SDK->Device:::[ERROR]"<<endl;
if (list.size() <= 0) {
cerr << "[ERROR]:::No device found:::[ERROR]." << endl;
return -1;
}
}
std::shared_ptr<ins_camera::Camera> cam = std::make_shared<ins_camera::Camera>(list[0].info);
//ins_camera::Camera cam(list[0].info);
if (!cam->Open()) {
cerr << "[ERROR]:::Failed to open camera:::[ERROR]" << endl;
return -1;
}
// VER SE PRECISO DESTAS CHAMADAS
//std::shared_ptr<ins_camera::StreamDelegate> delegate = std::make_shared<TestStreamDelegate>();
//cam->SetStreamDelegate(delegate);
discovery.FreeDeviceDescriptors(list);
cout << "[INFO]:::Succeed to open camera:::[INFO]" << endl;
auto camera_type = cam->GetCameraType();
auto start = time(NULL);
cam->SyncLocalTimeToCamera(start);
//IMPRIMIR LISTA DE ARQUIVOS DENTRO DA CAMERA
cout<<"[INFO]:::List of files recorded:::[INFO]"<<endl;
const auto file_list = cam->GetCameraFilesList();
for (const auto& file : file_list) {
cout << "File: " << file << endl;
}
auto tam = file_list.size();
cout<<"[INFO]:::Starting recording:::[INFO]"<<endl;
if (!cam->SetVideoCaptureParams(
//parameters of cam
{ins_camera::VideoResolution::RES_3040_3040P24,1024 * 1024 * 10},
ins_camera::CameraFunctionMode::FUNCTION_MODE_NORMAL_VIDEO)) {
cout << "failed to set capture settings." << std::endl;
}
else {
auto ret = cam->StartRecording();
if (ret) {
cout << "success!" << endl;
}
else {
cout << "failed to start recording" << endl;
}
}
cout<<"[INFO]:::Press 's' to stop recording"<<endl;
char s;
cin >> s;
if (s == 's'){
auto url = cam->StopRecording();
if (url.Empty()) {
std::cerr << "stop recording failed" << std::endl;
return -1;
}
auto& origins = url.OriginUrls();
std::cout << "stop recording success" << std::endl;
for (auto& origin_url : origins) {
std::cout << "url:" << origin_url << std::endl;
}
//definição do endereco da camera
const string remote1 = origins[0];
const string remote2 = origins[1];
//definicao do local de destino
const string local_path1 = "/home/ricardo" + remote1;
const string local_path2 = "/home/ricardo" + remote2;
const auto result1 = cam->DownloadCameraFile(remote1, local_path1);
const auto result2 = cam->DownloadCameraFile(remote2, local_path2);
if (result1 & result2)
cout << "Download finised" << endl;
else
cout << "Download failed" << endl;
}
return 0;
} `
Hi @fgeorges56 did you could be able to download the file?? I'm in same trouble.
@ricardosutana yes, in the end it worked. here is the function I used. Note that I have to launch the script as root to make it work.
void download_file(std::shared_ptr<ins_camera::Camera> cam) {
std::string file_to_download;
std::string file_to_save;
std::cout << "please input full file path to download: ";
std::cin >> file_to_download;
std::cout << "please input full file path to save: ";
std::cin >> file_to_save;
const auto ret = cam->DownloadCameraFile(file_to_download, file_to_save);
if (ret) {
std::cout << "Download " << file_to_download << " succeed!" << std::endl;
} else {
std::cout << "Download " << file_to_download << " failed!" << std::endl;
}
};
sorry,I can not understand! How do you make it success?
Here is how I compile and execute it.
g++ -I ./camerasdk_linux_20220909/include -L ./camerasdk_linux_20220909/lib ./insta_recorder.cc -Wl,-rpath,lib -l CameraSDK -o insta_recorder_compiled_linux -ludev -lcurses
export LD_LIBRARY_PATH=./camerasdk_linux_20220909/lib
./insta_recorder_compiled_linux
need to use full path including file name and suffix like /1.jpg
I'm working with the OneRS. My computer has Ubuntu 22.04 Firmware version = 2.0.8.4 Settings > USB mode > Android It is connected to my computer via the original cable.
I am trying to dowload a file from the SD card.
After a while, I get a 200 HTTP status (looks good) followed by an exception (less good), and I cannot find the file locally.
How can I download files from the SD card ?