×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Jan 2007
    Posts
    2

    Question Camera access restrictions

    Greetings to everyone! I'm kind of novice in mobile web server development so can anyone help me?
    Is there any simple way (possibly just by editing httpd.conf) to allow not authorized users to ask me to take only low-res pictures? Or maybe to notify me what kind of photo does someone want to see?
    Because, you see, there is kind of difference between 300k and 3M photos...
    Last edited by akamenov; 2007-01-08 at 16:42.

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: Camera access restrictions

    Quote Originally Posted by akamenov
    Is there any simple way (possibly just by editing httpd.conf) to allow not authorized users to ask me to take only low-res pictures? Or maybe to notify me what kind of photo does someone want to see?
    Sorry, currently I don't think there's any way to achieve that by editing httpd.conf.
    Because, you see, there is kind of difference between 300k and 3M photos...
    I see your point.

    The whole camera demo is rather rigid at the moment as there's just the hardwired /camera and /webcam locations, the former asking for verification, the latter not.

    How would the following sound?
    Code:
    <location /anything>
    set-handler camera
    [CameraMode [auto|manual]
    [CameraFormat ...]
    [PictureSize ...]
    </location>
    That is, the URL would not be hardwired and you could either explicitly define the format (colordepth) and size or let the one asking for a picture specify them. Then you could have:
    Code:
    <location /anonymous_camera>
    set-handler camera
    CameraMode manual
    CameraFormat 128
    PictureSize 1
    <location>
    
    <location /camera>
    set-handler camera
    CameraMode manual
    Require valid-user
    <location>
    
    <location /webcam>
    set-handler camera
    CameraMode auto
    Require akamenov
    </location>
    That is, in this case /anonymous_camera does not require a known user, but the colordepth and picturesize is hardwired and cannot be specified by the user, /camera requires a known user and he/she is allowed to specify the format, and /webcam can only be used by you and in that case the picture is simply taken without any prompts on the phone display.

    Would this provide you with what you want?
    Last edited by jhnwkmn; 2007-01-09 at 08:56.

  3. #3
    Registered User
    Join Date
    Jan 2007
    Posts
    2

    Re: Camera access restrictions

    Thanks, I think it would.

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: Camera access restrictions

    Quote Originally Posted by akamenov
    Thanks, I think it would.
    I just released a new version of Raccoon where the camera module has been modified so that you can have a range of different cameras enabled, each with different properties.

    There is now a directive
    Code:
    CameraOptions Mode=[interactive|webcam] Format=<number> Size=<number>
    where the mode specifies whether you are prompted to take a picture, or whether the picture is just taken, format the color-depth and size the size of the picture. You can find out what integer values you can use by browsing to .../camera?command=options on your own phone.

    By default, httpd.conf now contains
    Code:
    <Location /camera>
    SetHandler camera
    CameraOptions Mode=interactive
    </Location>
    
    <Location /webcam>
    SetHandler camera
    CameraOptions Mode=webcam
    Require valid-user
    </Location>
    that provides the same behaviour as before. You can add Format and Size parameters to hardwire what kind of pictures are taken. You can also add more locations; the only thing that counts is that there is a SetHandler camera directive.

  5. #5
    Registered User
    Join Date
    Feb 2007
    Posts
    1

    Re: Camera access restrictions

    Hi, a new feature?

    For the Mode=interactive setting:

    Would it be possible to add a "timeout" parameter to the camera mode? The "hardcoded" timeout is to short and there is a high risk of missing the request

    Also, could the camera request trigger different alarms on the phone - sound, vibration etc?

    /Pål

  6. #6
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: Camera access restrictions

    Quote Originally Posted by tanglie
    Would it be possible to add a "timeout" parameter to the camera mode? The "hardcoded" timeout is to short and there is a high risk of missing the request

    Also, could the camera request trigger different alarms on the phone - sound, vibration etc?
    Sure, it's just a small matter of programming

    Seriously, there's a lot of things that could and should be done to the camera functionality. Customizable timeouts and alarms, user-definable timeout page, viewfinder, allowing the one asking for the picture to send a message, user-definable timeout page, and so on. Can't promise, though, if and when something of this will be available...

  7. #7
    Registered User
    Join Date
    May 2007
    Posts
    12

    Question Re: Camera access restrictions

    g'day everyone!

    it seems that we can't import camera module from python scripting web page.
    it means it won't go as below code:

    <%

    import camera
    import audio
    import graphics
    import messaging
    import calendar
    import contacts
    import e32
    import e32db
    import e32dbm
    import inbox
    import keycapture
    import socket
    import sysinfo
    import telephone
    import thread
    import topwindow
    import location
    image = camera.take_photo(size = (160,120))
    filename=u'e:\\camera.jpg'
    image.save(filename)
    %>


    So at the moment, it runs on location only (/webcam, /camera).
    How can it save picture image files in specify directory as we code the python script in web pages?


  8. #8
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: Camera access restrictions

    Quote Originally Posted by bruce2000
    it seems that we can't import camera module from python scripting web page.
    it means it won't go as below code:
    ...
    So at the moment, it runs on location only (/webcam, /camera).
    How can it save picture image files in specify directory as we code the python script in web pages?
    I'm not entirely sure I understand the problem. Store the following into the file \Data\Apache\mod_python\psp\camera.psp:
    Code:
    <html>
    <body>
    <p>
    <%
    import camera
    image=camera.take_photo()
    filename=u'c:\\data\\camera.jpg'
    image.save(filename)
    %>
    </p>
    </body>
    </html>
    and try browsing to
    Code:
    httpd://your-urlmod_python/psp/camera.psp
    Does it work, do you get a c:\data\camera.jpg file?

  9. #9
    Registered User
    Join Date
    May 2007
    Posts
    12

    Cool Re: Camera access restrictions

    Johan

    Thanks a lot! It works fine! It means camera API or module can be embedded into PSP as Python script.
    Really what is limitation of Mod_python compare with Python for S60?

  10. #10
    Nokia Developer Expert
    Join Date
    Mar 2003
    Posts
    457

    Re: Camera access restrictions

    Quote Originally Posted by bruce2000
    Really what is limitation of Mod_python compare with Python for S60?
    That's a tricky question and it's difficult to give a comprehensive answer. But there are two major differences.

    Firstly, in a normal application (including Python scripts run under the interactive interpreter) the Symbian UI framework creates an instance of the class CCoeEnv. Apache is a Symbian server, so that instance is not created. Some Symbian/S60/Python(?) components assume that the instance exists and will hence fail in unpredictable ways when used under Apache. I've experimented with creating an instance of that class under Apache and it works, but unfortunately leads to problems elsewhere.

    Secondly, in a normal application there's a running active scheduler. Under Apache there is an active scheduler, but it is not running when the request handler is called (well, it's not running any other time either). If you write a request handler in C it's straightforward to temporarily start the scheduler if you need to have some asynchronous tasks done, and stop it before returning. Under Python you cannot do that explicitly but can almost achieve the same thing by calling
    Code:
    import e32
    e32.ao_yield()
    which will cause pending UI events to be flushed.

    The important thing to realize here is that request handlers must behave in a synchronous fashion. That is, whatever they are supposed to do, they must do before returning. The typical Symbian way of doing things - issuing an asynchronous request, then return and expect to be called back - cannot be utilized except inside the request handler. That is, inside the request handler you can start the active scheduler and do things in an asynchronous way, but when the request handler returns, the active scheduler must have been stopped and all business must have be finished.

    Johan

Similar Threads

  1. Nokia N-Series Complete Model Line-Up
    By Dopod in forum General Development Questions
    Replies: 6
    Last Post: 2008-07-22, 20:16
  2. Nokia 6101 Locked 2 TMobile Midlet can't access internet...
    By Jason Glass in forum Mobile Java Networking & Messaging & Security
    Replies: 45
    Last Post: 2007-11-14, 02:19
  3. Does NOKIA 6103 Supports Camera Access/Local File Access?
    By aditya.binju in forum Mobile Java General
    Replies: 1
    Last Post: 2006-07-13, 13:03
  4. How To Access Nokia 3220 Camera?
    By xqwww in forum Mobile Java General
    Replies: 14
    Last Post: 2006-03-03, 12:06
  5. Access to camera device in 7650
    By marcin_polak in forum Symbian C++
    Replies: 2
    Last Post: 2005-02-26, 09:54

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •