PlayBook ndk - camera_take_photo his return with error 17 - file exists

Fellow developer,

I use C++ NDK for blackberry playbook (tests with the playbook material) and a problem came in my way. I can take pictures with the camera_take_photo function. I'm trying to capture faster so I'm setting wait to false. In this case camera_take_photo will not block running my application.

The problem is that if the last call to image_callback of camera_take_photofunction is not yet complete and that I call camera_take_photo once again I'll error as a result. Error code is: 17 who is not related to camera_error_t. I had checked in errno.h and is:

My question is that this kind of file? I know camera_take_photo is not save any file (only when I implement registration photo).

Error 17 in errno.h:

#define EEXIST          17  /* File exists  */

My implementation:

void CameraModule::takePhoto() {  camera_error_t result1 = camera_take_photo(this->m_CameraHandle, NULL, NULL, NULL, CameraModule::photoImageCallback, NULL, false);}

void CameraModule::photoImageCallback(camera_handle_t cameraHandle1, camera_buffer_t * cameraBuffer1, void * params) {  // JPeG is ready and I can save it  // But this is an empty function for testing  sleep (3000); // do nothing for 3 seconds}

Call us at:

// Test 1:takePhoto(); // OK
takePhoto(); // Error 17 from camera_take_photo, but I'm not writing any file
// Test 2:
takePhoto(); // OK
sleep(5000); // Wait some seconds
takePhoto(); // OK

Flowchart to represent the error:

Reference to the use of camera_take_photo :

camera_error_t
camera_take_photo(camera_handle_t handle,
                  void (*shutter_callback)(camera_handle_t, void*),
                  void (*raw_callback)(camera_handle_t, camera_buffer_t*,
                                       void*),
                  void (*postview_callback)(camera_handle_t,
                                            camera_buffer_t*, void*),
                  void (*image_callback)(camera_handle_t, camera_buffer_t*,
                                         void*),
                  void *arg,
                  bool wait);

Your help is appreciated in advance.

Thank you.

The solution, I would say something like the following... excuse the pseudocode.

void* burst_thread() {
    while(!stop_bursting) {
        camera_take_photo(....., still_callback, ..., true);
    }
    stop_saving = true;
    pthread_cond_signal(&queueCond);  // wake queue thread so it can exit
}

void still_callback(...) {
    to_save = new(...);
    memcpy(to_save, buffer, size);
    pthread_mutex_lock(&queueMutex);
    add_to_save_queue(to_save);
    pthread_cond_signal(&queueCond);   // wake queue thread
    pthread_mutex_unlock(&queueMutex);
}

void* save_thread(...) {    pthread_mutex_lock(&queueMutex);
    while(!stop_saving) {        if (queue_is_empty()) {
            pthread_wait(&queueCond, &queueMutex);        }
        if (!queue_is_empty()) {
            x = dequeue_buffer();
            pthread_mutex_unlock(&queueMutex);  // unlock while busy
            save_buffer(x);            delete x;            pthread_mutex_lock(&queueMutex);        }
    }    pthread_mutex_unlock(&queueMutex);    // cleanup queue    while(!queue_is_empty()) {        clean up dangling buffers?  or save them to disk. whatever.  just make sure not to leak memory.     }
}

void start_bursting() {
    stop_bursting = stop_saving = false;
    pthread_create(save_thread);
    pthread_create(burst_thread);
}

void stop_bursting() {
    stop_bursting = true;
    pthread_join(burst_thread_tid);
    pthread_join(save_thread_tid);
}

There is a little extra synchronization required in the processing thread: see if (is_queue_empty()).  This is because the thread passes time saving files and cannot be blocked on condvar cheque when the signals of the other thread.  If (check is_queue_empty()) is here to detect these missed signals.

When someone hits the "start by holding button images", you start the shooting wire and thread photo-economie.  When a user releases the button, or click on a stop button, you report the nets to stop and wait for them to end.

Note that the termination of the thread of savings made by shooting wire.  This allows to avoid prematurely stop the saving thread when the callback is always enqueueing a buffer.

See you soon,.

Sean

Tags: BlackBerry Developers

Similar Questions

  • Windows Vista Ultimate SP2 will not install update KB2378111 or install downloaded programs and returned with error code 80070570

    Hello... my computer will not install update KB2378111 with a code error 80070570.  In addition, I can not install all programs downloaded from the internet, specifically my anti-virus software.  I'm running without any software antivirus at this time.  I ran the most recent Microsoft malicious software removal tool and it showed that there is no problem.

    I'm running without any antivirus at this time software

    See...

    Cleaning a compromised system
         http://TechNet.Microsoft.com/en-us/library/cc700813.aspx

    Personal data backup (which none should be considered 100% reliable at this point) then format the HARD disk and do a clean install of Windows. Please note that a repair installation (upgrade AKA on-site) will NOT fix it!

    HOW to do a clean install of Vista: see the "to install Windows by performing a clean install" (or "reinstall Windows Vista") http://windows.microsoft.com/en-us/windows-vista/Installing-and-reinstalling-Windows-Vista article

    NOTE: If your computer came with a set of disks, there is a hidden partition restore (not to be confused with the restoration of the system) you would use to do the clean install (AKA a "destructive recovery").

    After the new installation, you will have the equivalent of a "new computer" in order to take care of EVERYTHING on the next page before connecting the machine to the internet or one local network (i.e. other computers) AND BEFORE to plug in a flash, SD card, or any other external drive to the computer otherwise:

    4 steps to help protect your new computer before going online
         http://www.Microsoft.com/security/pypc.aspx

    Tip: After completing the computer fully patched, download/install KB971029 manually before connecting any player external to the computer: http://support.microsoft.com/kb/971029

    VERY IMPORTANT! -Online any Norton or McAfee free trial which is preinstalled on the computer when you bought will be reinstalled (but invalid) when Windows is reinstalled. You MUST uninstall the trial for free AND download/run the removal tool appropriate prior to installing the updates, Windows Service Packs or IE upgrades AND BEFORE installing your new anti-virus application.

    Norton Removal Tool
         FTP://ftp.Symantec.com/public/english_us_canada/removal_tools/Norton_Removal_Tool.exe

    McAfee Consumer product removal tool
         http://download.McAfee.com/Products/Licensed/cust_support_patches/MCPR.exe

    See also:

    Risks & benefits of P2P file sharing
    http://www.Microsoft.com/protect/data/downloadfileshare/filesharing.aspx
    http://blogs.technet.com/MMPC/archive/2008/10/06/the-cost-of-free-software.aspx
    http://www.us-cert.gov/CAs/tips/ST05-007.html

    Measures to help prevent spyware
    http://www.Microsoft.com/security/spyware/prevent.aspx

    Measures to help prevent computer worms
    http://www.Microsoft.com/security/worms/prevent.aspx

    Avoid fake security software!
    http://www.Microsoft.com/security/antivirus/rogue.aspx

    If you need additional assistance with the clean install, please start a new thread in this forum: http://social.answers.microsoft.com/Forums/en-US/vistarepair/threads

    If these procedures look too complex - and there is no shame in admitting this isn't your cup of tea - take the machine to a local, good reputation and stand-alone computer (that is, not BigBoxStoreUSA or Geek Squad) repair facility.

    Good luck!

    ~ Robear Dyer (PA Bear) ~ MS MVP (that is to say, mail, security, Windows & Update Services) since 2002 ~ WARNING: MS MVPs represent or work for Microsoft

  • Update of Lightroom to version 5.7.1 returns with error

    When I followed the link to LIghtroom to update to version 5.7.1

    http://download.Adobe.com/pub/Adobe/Lightroom/Mac/5.x/Lightroom_5_LS11_mac_5_7_1.dmg

    I get following message:

    This Web page is not available

    ERR_NAME_NOT_RESOLVED

    Any ideas?

    Marcin salvation,

    Please look in the https://discussions.apple.com/message/27683395?tstart=0 discussion

    Let me know if that helps

    Assani

    You're the man Akash! It worked like a treat, thank you for all your time and your help, I would probably need more weeks to fix it myself. I owe you a cold beer if you ever near Cork in Ireland I would post this response in the main thread, this could help someone down the line.

  • Edge animate CC (since the update) won't work; Returns with error


    Hello

    I installed the update from EA CC (3.0) and whenever I launched EA, I see just a big white screen blank, except for the top menu.

    File > New will give me a blank document and complete the interface, but the document itself is chained and white.
    Open any pre-existing file will give me the same result. Do something more (for example, the timeline scrub) gives the above alert.

    I am running Windows 7, SP1. I count on Edge host for one of my blogs (Snurffles) and was anxious to use it for professional work this week - and would rather operate later than backtrack in 1.5.

    Uninstalling and reinstalling the software did not work. Any suggestions? I installed Muse CC last week. All other installed programs of CC work.

    Thank you!

    Hi tahneeg & others,

    Looks like the loopback address lookup fails if one reason any. Can add you the following line to the file hosts on your system and let me know if that solves the problem.

    127.0.0.1 localhost

    You can find the hosts file:

    Guests of /etc/modules.conf OS X:

    Win: %systemroot%\system32\drivers\etc\hosts

    Note: Make sure that provide you write access to this file and you do not change the file extension when recording.

    Steps to follow:

    -Edit the hosts file and add the line shown above in bold

    -Re-launch the app driven by edge.

    -Reynaud

  • LoadPanel fails with error-94 file not found code unless I am in debug mode

    I've written a dll that has a number of panels in a .uir file.

    When I have it, debug using "debug SeqEdit.exe", everything works fine.

    But, if I just use "run SeqEdit.exe" (without debugging and using the same sequence file, I get the error message:)

    "Error in the call to LoadPanel.

    Handle of parent of Panel: 0,

    The IUR filename: HiPot.uir.

    Resource Panel ID: 4.

    Error code:-94

    File not found. "

    The IUR file is always in the same place, the only difference is that I do not use the debug option.

    It's probably something simple I've forgotten?

    You should not use LoadPanelEx in this case?

  • OPatch failed with error code = 1

    You try to run error message like Opatch

    D:\OPatch > opatch - help

    The Oracle home D:\ isn't YES home based. Please give good Oracle Home.

    OPatch returns with error code = 1

    OPatch failed with error code = 1

    Any body had this problem?

    Thanks in advance

    John,

    I YES folder

    in D:\Oracle\Middleware\oracle_common\oui\jlib?

  • I have problem with a .iso file that when I want to use I face the error "the file name is too long.

    Original title: name of a file

    Hello

    I have problem with a file .iso that when I want to use I'm dealing with error "the file name is too long" and I can't use this file anywhere for example: vmvare ' untraiso and even if I cannot write to cd or make a boot USB.

    I don't know how fix it.how I rename the file iso, shorter that I can use?

    Please help me.

    Thank you.

    Right-click on the ISO > rename > give a short name

  • Windows movie maker error - the file is not indexed and cannot be imported

    I have converted a quicktime in WMW clip, but when I try and import the video in windows movie maker, that it comes up with error the file is not indexed and cannot be imported? What does that mean?

    Try another converter.

    There are to many converters available on the net...
    the following links are some examples.

    Proceed at your own risk *.

    (FWIW... it's always a good idea to create a system)
    Restore point before installing software or updates)

    (1) format Factory (freeware)
    http://www.videohelp.com/tools/Format_Factory
    (the 'direct link' is faster)
    (the file you want to download is: > FFSetup270.zip<>
    (FWIW... installation..., you can uncheck
    ('all' boxes on the last screen)
    (Windows XP / Vista / 7)

    First, you will need to decompress the file or just open the
    Drag FFSetup270.exe out of the folder
    and drop it on your desktop. To install left click.

    (2) Freemake Free Video Converter (freeware)
    http://www.Freemake.com/free_video_converter/
    (Windows XP / Vista / 7)

    (3) Koyotesoft Free Video Converter
    http://www.koyotesoft.com/indexEn.html
    (2000/XP/2003/Vista/Seven)

    (4) Sothink Free Video Converter
    http://www.Sothinkmedia.com/video-converter/
    (Windows XP / Vista / 7)

    (5) SUPER © Simplified Universal Player Encoder & Renderer
    http://www.videohelp.com/tools/Super
    (the download mirror site is faster) (Windows XP / Vista / 7)

    (6) Xilisoft Video Converter
    http://www.Xilisoft.com/video-converter.html
    (not freeware but receives good reviews)
    (Windows XP (SP2 or later) / Vista / 7)

  • why I cant player to access itv now when I could always? He returns with "an error occurred during the processing of your request."

    why I cant player to access itv now when I could always? He returns with "an error occurred during the processing of your request."

    Hi James,

    Let us know a few details about the issue.

    1. which operating system you have installed on the computer?

    2. what web browser do you use to open itv player?

    3. are you able to play other videos online on other sites?

    If you use Internet Explorer, then you follow these methods.

    Method 1:

    You can run the fix for video problems in Internet Explorer.

    Playing video files crashes or blocking Internet Explorer - Windows

    http://support.Microsoft.com/mats/video_freezes_or_crashes/

    Method 2:

    You can also follow the steps in the following article and check.

    The video problems when you use Internet Explorer

    http://support.Microsoft.com/kb/2532294

    Note: The Reset Internet Explorer Settings feature might reset security settings or privacy settings that you have added to the list of Trusted Sites. Reset the Internet Explorer settings can also reset parental control settings and Add-ons. We recommend that you note these sites before using Internet Explorer settings reset feature and re - activate the Add-ons.

    Feel free to get back to us for other queries.

  • I tried to update to IE9 and he returned as failed with error 800F080D. Why is - this happenning

    I tried to update to IE9 and he returned as failed with error 800F080D. Why is - this happenning

    Hi Tena Guevara,

    1. did you try to install the stand-alone package of IE 9?

    I suggest you to check if you have all the prerequisites installed for internet explore 9 http://support.microsoft.com/kb/2399238

    Alternatively, you can try to install the stand-alone package of IE 9 and check: http://windows.microsoft.com/en-US/internet-explorer/downloads/ie-9/worldwide-languages

    Refer also to the links below and check if you have done all the requirements before installing internet explore 9-
    Solve the problems when you can't install Internet Explorer 9

    http://support.Microsoft.com/kb/2409098

    How to install or uninstall Internet Explorer 9?

    http://Windows.Microsoft.com/en-us/Windows7/how-do-i-install-or-uninstall-Internet-Explorer-9

    Hope this information is useful.

  • WINDOWS WITH OUTLOOK 13 8.1. MAIL server error RETURNED WITH MESSAGE 550.

    I USE WINDOWS 8.1 WITH OUTLOOK 13. MAIL server error RETURNED WITH MESSAGE 550. Please login to use this mail server. How can I do this?

    So that we can look into this further, please provide the affected email account and complements of NDR (or error), you received so that we can determine the cause of this problem. To do this, please follow the steps below:

    1 right click on the message to bounce on your Inbox.

    2 choose the option show message source on the menu drop-down. You will see a window containing the headers of e-mail messages and content.

    After doing so, to validate the source of the message with all components of the notification of non-delivery such as:

    > Final destination

    > Action

    > Status

    > Diagnostic code

  • I do P2V of a Linux Machine, his failure with the error "FAILED: an error occurred during conversion:"root is not found""If anyone can suggest how to solve this. "

    I do P2V of a Linux Machine, his failure with the error "FAILED: an error occurred during conversion:"root is not found""If anyone can suggest how to solve this...» He does not drive partition root to copy don't know why his account right there.

    I solved the problem myself... This is because the Version of Vcenter Converter. I'm using Vcenter Converter 5 to P2V a server Linux RHEL5.2, its not supported by Vcenter Converter 5. That of why I've done P2V using Vcenter Converter5.2 and accomplished.

  • plugin VMware update manager returns with "the remote server returned an error: (404) not found."

    Hello

    We have recently updated our virtual Center Server to version 4 and now when I try to download and install from the page manager plugin vmware update manager plugin is back with "the remote server returned an error: (404) not found"

    Has anyone had this problem before and eventually worked out how to fix this?

    Gregg Robertson, VCP, MCSE, MCSA, MCTS, MCITP

    You are welcome!!

  • RW-50011: error:-apps oracle_home test connection returned an error: 4

    Hello

    Before getting into the details, let explain me my environment.

    Virtual Box on top of Mac OS X

    Oracle Linux 6.5 on top of Virtual Box

    2-node - the node of the database and the Application node

    I use Oracle E-Business Suite Installation and Notes of version 12 (12.1.1) for Linux x 86-64 upgrade (Doc ID 761566.1()

    I have install Oracle EBS r12.1.1 again and again just to get better and better and improve the documentation as I go along. I was able to install the database without error layer at all. And for the most part, everything is going very well on the layer application until I get to the end and I noticed on the adautocfg.sh application layer ends with success, and then I see rw-50011: error:-apps oracle_home test connection returned an error: 4. at first, I thought it was permission then I added the root and my user appebs for all groups that did and I also made each Directory was 777 permissions. As I drove deep into the logs, I noticed that the riwTDBup.sh of ended not because it could not open the database. I noticed that riwTDBup.sh called sets in environment in $INST_HOME/ora/10.1.2/ and then tries to start a receiver located at $INST_HOME/ora/10.1.2/network/admin - this is where I see that no listener has been created. A tnsnames.ora is there but no listener. So I went to $ADMIN_SCRIPTS and I try to manually start the receiver and although his place as well and it is said that there is no listener for APPS_VIS. How is it, my interlocutor is not be created and can someone tell me what am I did not right, why it is constantly at the end of the installation. What newspapers do you need to see to help me with this question?


    Thanks in advance

    Hey Hussein snoussi-Oracle,.

    I'm mad at myself. After having sitting just think and get back to the basics... Why my application server cannot connect to my database, especially after the fact that I did this install successfully before? After decision on the fact that both servers could talk to each other, a light bulb off, I knew it was something blocking the connection and then I thought about it. LOL, that was the firewalls. I deleted the application server and restart installation with two disabled firewalls and it worked even fix the error of libgcc_s.so, installing crossed without errors at all, everything was fine with my host and domain name. LOL, I can finally say that I can install Oracle EBS R12.1 without errors.

    Even if it took my whole weekend, I wouldn't change a thing. I learned so much troubleshooting idea, funny how you can look in hindsight and appreciate the growing pains. Thanks Hussein for all the help! Next upgrade of database and applications, then learn how to install Rac and how to install EBS on rac and Oracle EBS on PAP management, if you have any suggestions on where to go to learn these things it would be awesome!

  • HP Envy 15-K204NA: upgrade to Windows 10 has failed with error 80070714. Help, please!

    Hello.

    I hope there, can someone help me!

    I tried several times to improve my HP Envy 15-K204NA for 64-bit Windows of 8.1 to 10 Windows Home, but she continues to fail with the error code 80070714.

    I use Protection Premium Bullguard and Acronis True Image installed.

    I disabled the SQL services as suggested by other posts on the internet, but nothing seems to work.

    When I run the upgrade from a DVD burned ISO, it gets 37% and fails.

    Hope you can help. (fingers crossed!)

    Chris

    The Setup error log file shows:

    2015-08-05 16:48:34, error CallPidGenX: PidGenX function failed on this product key. (hr = 0x8a010001)
    2015-08-05 16:48:37, error CallPidGenX: PidGenX function failed on this product key. (hr = 0x8a010001)
    2015-08-05 16:48:49, error CONX failed to initialize the data of net class 80070005

    2015-08-05 16:48:50, CONX error could not get data from the printer class 80070057

    2015-08-05 16:49:21, CONX error could not open the INF [tib_mounter.x64.inf] with 0 x 80070002

    2015-08-05 16:49:21, CONX error cannot initialize the driver package [tib_mounter.x64.inf]

    2015-08-05 16:49:21, CONX error could not open the INF [oem46.inf] with 0 x 80070002

    2015-08-05 16:49:21, CONX error cannot initialize the driver package [oem46.inf]

    2015-08-05 16:49:23, CONX error could not open the INF [tib_mounter.x64.inf] with 0 x 80070002

    2015-08-05 16:49:23, CONX error cannot initialize the driver package [tib_mounter.x64.inf]

    2015-08-05 16:49:23, CONX error could not open the INF [oem46.inf] with 0 x 80070002

    2015-08-05 16:49:23, CONX error cannot initialize the driver package [oem46.inf]

    2015-08-05 17:06:14, error MS RegLoadKeyW failed to mount C:\$WINDOWS.~BT\Sources\SafeOS\SafeOS.Mount\WINDOWS\system32\config\SYSTEM to SP_HIVE_LOAD_ALIAS_SYSTEM [gle = 0x801f0005]
    2015-08-05 17:06:14, SP SPMountOfflineHive error: cannot mount the hive offline: C:\$WINDOWS.~BT\Sources\SafeOS\SafeOS.Mount\WINDOWS\system32\config\SYSTEM. Error: 0x801F0005 [gle = 0x801f0005]
    2015-08-05 17:06:14, SP CEnableTelemetryForImage error:oExecute: cannot load the hive of the system for the C:\$WINDOWS.~BT\Sources\SafeOS\SafeOS.Mount\WINDOWS OS offline. Error: 0x801F0005 [gle = 0x801f0005]
    2015-08-05 17:06:14, error [SetupHost.exe] ReAgentXMLParser:arseConfigFile (xml file: C:\$WINDOWS.~BT\Sources\SafeOS\ReAgent.xml) return 0 x 2
    2015-08-05 17:06:19, error MS by using the current time as a Timestamp of recovery.
    2015-08-05 17:06:22, error MS cannot open session DISM WinPE. Error: 0 x 80070714 [gle = 0x0000007a]
    2015-08-05 17:06:22, MS operation failed error: drivers of Migration process. Error: 0 x 80070714 [gle = 0x000000b7]
    2015-08-05 17:06:22, MOUPG MoSetupPlatform error: ExecuteCurrentOperations reported failure!
    2015-08-05 17:06:22, MOUPG MoSetupPlatform error: using the action error code: [0 x 80070714]
    2015-08-05 17:06:22, CDlpActionDriverMigrate::ExecuteRoutine (544) MOUPG error: result = 0 x 80070714
    2015-08-05 17:06:24, error MOUPG CDlpActionImpl < < < < class IMoSetupDlpAction > CUnknownImpl > CDlpObjectInternalImpl > CDlpErrorImpl > class class class: Execute (441): result = 0 x 80070714
    2015-08-05 17:06:24, CDlpTask::ExecuteAction (3243) MOUPG error: result = 0 x 80070714
    2015-08-05 17:06:24, CDlpTask::ExecuteActions (3397) MOUPG error: result = 0 x 80070714
    2015-08-05 17:06:24, CDlpTask::Execute (1631) MOUPG error: result = 0 x 80070714
    2015-08-05 17:06:24, CSetupManager::ExecuteTask (1953) MOUPG error: result = 0 x 80070714
    2015-08-05 17:06:24, CSetupManager::ExecuteTask (1916) MOUPG error: result = 0 x 80070714
    2015-08-05 17:06:24, CSetupManager::ExecuteInstallMode (736) error MOUPG: result = 0 x 80070714
    2015-08-05 17:06:24, CSetupManager::ExecuteDownlevelMode (376) MOUPG error: result = 0 x 80070714
    2015-08-05 17:07:09, error MOUPG CSetupManager::Execute (222): result = 0 x 80070714
    2015-08-05 17:07:09, error MOUPG CSetupHost::Execute (370): result = 0 x 80070714
    2015-08-05 17:07:12, CDlpManager::AsyncSerializeDisable (471) MOUPG error: result = 0 x 80070216

    I have now abandoned and rebuilt my laptop using the recovery partition.  The upgrade to Windows 10 came immediately, and it installed fine.

    Hooray

Maybe you are looking for