I don't think the ambient light sensor would be sensitive enough for this anyway, so the camera is the right thing to use.
Look into the AVFoundation framework; it has some classes for setting up a video feed from the camera and receiving frames. I believe there's sample code. But honestly, if you're going this route, it will be much faster to transmit QR codes, since each code contains thousands of bits. —Jens > On Sep 20, 2015, at 7:21 PM, ico <jche...@gmail.com> wrote: > > After reading all of the replies, no one mentioned how to use iPhone to > detect the light changes (bright and dark) in codes, I just have no clue > how to make it works as long as I remember developers have no right to > access the light sensor, so I guess we have to use camera to achieve this, > but I just don't know how. Can anyone point me to something to read so I > can start digging into this and make the whole thing start to work? > > Thank you all. > > On Fri, 18 Sep 2015 at 20:38 Michael David Crawford <mdcrawf...@gmail.com> > wrote: > >> Do iOS devices support Trusted Computing in hardware? If so is it >> accessible to userspace apps? >> >> If so, you could store your phones secret in a write-only register. >> For the profoundly paranoid, even the duplication of your storage >> would not yield your phone's secret, The Bad Guy would need your >> personal phone. >> >> Modern Macs - to the best of my knowledge - provide trusted computing >> chips, on can access them from userspace with a modest bit of code. >> Michael David Crawford P.E., Consulting Process Architect >> mdcrawf...@gmail.com >> http://mike.soggywizard.com/ >> >> One Must Not Trifle With Wizards For It Makes Us Soggy And Hard To >> Light. >> >> >>> On Fri, Sep 18, 2015 at 3:12 AM, Maxthon Chan <m...@maxchan.info> wrote: >>> The "over-the-shoulder" issue can be avoided using what is effectively a >> Diffie-Hellman on top of QR codes. This can be done using front-facing >> cameras on two devices placed face-to-face. >>> >>> Sent from my iPhone >>> >>>> On Sep 18, 2015, at 00:46, Pascal J. Bourguignon <p...@informatimago.com> >> wrote: >>>> >>>> >>>> >>>>> On 17/09/15 17:32, Michael David Crawford wrote: >>>>> And what the man said: I myself experience seizures in which I lose >>>>> consciousness for as long as three weeks. Before they were diagnosed >>>>> I would experience seizures while driving my car then suddenly find >>>>> myself in unfamiliar places without any clue how I got there. >>>>> >>>>> I don't know for sure but strongly suspect that modern computer user >>>>> interfaces caused my seizure disorder as well as that of my cousin. >>>>> Seizures are not otherwise found among any of our blood relatives. >>>> >>>> But then if you don't use the whole screen, but only the area that >>>> should be in front of the camera of the superposed phone, then users >>>> shouldn't be subjected to much stroboscopic light. >>>> >>>> Having the objective so close from the light source does not allow >>>> the camera to distinguish pixels; for example, a black to white >>>> transition takes about 1/10 of the height of the camera view. >>>> But this means that you might still able to transmit about ten pixels >> at once, >>>> and you can multiply that by a number of color that you can detect >> reliably >>>> being that out of focus. Basically, I would expect 8 colors to be >> clearly >>>> distinguishable. Actually, probably more colors should be >> distinguishable, >>>> if you can filter out the interferences due to the grid of the camera >> vs. >>>> the grid of the screen. So assume 4 bits for the color, and 9 areas, >>>> that's 36 bit/moment, and you should be able to do 30 moment/second, >>>> for a total of 1080 bit/second. A little less for ECC, about 1 KB/s >>>> is not too bad. It's good enough to transmit a good private key, and >> then >>>> transfer the data thru wifi. >>>> >>>> >>>> Of course, if you move the camera out to focus on the screen, then >>>> you can transmit at a higher speed things like QR codes, but they >>>> could also be seen over the shoulder by high resolution cameras. >>>> >>>> -- >>>> __Pascal J. Bourguignon__ >>>> http://www.informatimago.com/ >>>> >>>> _______________________________________________ >>>> >>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>>> >>>> Please do not post admin requests or moderator comments to the list. >>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>>> >>>> Help/Unsubscribe/Update your Subscription: >>>> https://lists.apple.com/mailman/options/cocoa-dev/max%40maxchan.info >>>> >>>> This email sent to m...@maxchan.info >>> >>> _______________________________________________ >>> >>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >>> >>> Please do not post admin requests or moderator comments to the list. >>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >>> >>> Help/Unsubscribe/Update your Subscription: >>> https://lists.apple.com/mailman/options/cocoa-dev/mdcrawford%40gmail.com >>> >>> This email sent to mdcrawf...@gmail.com >> _______________________________________________ >> >> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) >> >> Please do not post admin requests or moderator comments to the list. >> Contact the moderators at cocoa-dev-admins(at)lists.apple.com >> >> Help/Unsubscribe/Update your Subscription: >> https://lists.apple.com/mailman/options/cocoa-dev/jche128%40gmail.com >> >> This email sent to jche...@gmail.com > _______________________________________________ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please do not post admin requests or moderator comments to the list. > Contact the moderators at cocoa-dev-admins(at)lists.apple.com > > Help/Unsubscribe/Update your Subscription: > https://lists.apple.com/mailman/options/cocoa-dev/jens%40mooseyard.com > > This email sent to j...@mooseyard.com _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com