how to transmit ibeacon and scan ibeacon at the same time using altbeacon library? - ibeacon

I want to enable an mobile phone to transmit ibeacon and scan ibeancon at the same time using altbeacon API. What is the suitable value for AdvertiseMode, ForegroundBetweenScanPeriod and ForegroundScanPeriod. Besides these three parameters, is there any other issue I need to take into account?
Thanks in advance!

The default values for these parameters will work fine (foreground scan period of 1100ms, between scan period of 0, and AdvertiseMode LOW_LATENCY.)
It is important to note that an Android device that transmits will not be able to scab its own transmissions. You must have a second device to do this.

Related

Getting the max possible display rate of connected monitors

I am trying to get programmatically the maximum display rate that Windows allows (i.e, Display settings > Advanced display settings > Refresh rate > max value). Chances are, there's no such query and I instead need to obtain all the possible options. How do I do that ?
I've already obtained the monitor names and current refresh rates using the CCD API, by obtaining DISPLAYCONFIG_PATH_INFOs and by using DisplayConfigGetDeviceInfo. But I can't seem to find a way to obtain the refresh rate options associated to a monitor. A CCD API based solution would be perfect, but an alternative is fine - it just means I'll have to reconcile the information obtained via the CCD API with that obtained from that other API, somehow.
Also, I'm trying to do this in the context of a plain Windows executable, that doesn't use a specific graphics backend library (ex DX12) or game-making framework.
Thanks !
Using the CCD API, you can use DisplayConfigGetDeviceInfo to get the GDI device name using DISPLAYCONFIG_DEVICE_INFO_TYPE::DISPLAYCONFIG_DEVICE_INFO_GET_SOURCE_NAME , usually something like \\.\DISPLAY1, \\.\DISPLAY2, etc.
Once you have that device name, you can use the EnumDisplaySettingsW function to enumerate all DEVMODE for this device, this will give you all possible combination of modes (resolution, frequency, etc.) that the device supports (that can easily return hundreds of modes).
Once you have that you just need to group them by DEVMODE's dmDisplayFrequency field (and sort it).

NFC smartcard that is impossible to clone

First, I want to apologize. I am complete noob in this area and many of my thoughts are probably misleading.
I need to verify that a user of my app is on a specific place in order to be authirized to perform an action. I want to use NFC for this purpose. The user have to put his smartphone by a NFC tag in order to be authorized to perform the action. Easy but I need it to be reasonably hackerproof. It means that the NFC tag must be impossible to clone without physical damage to the plastics around the NFC chip. It also means that the NFC chip must not contain only static data. The NFC chip must contain an app, that can receive some data (cryptographic challenge) and signs them using secure built-in private key (which must be unreadable through NFC interface). When the user wants to perform the action, he will ask server for the challenge, then he lets the chip to sign it, and then he sends the signed challenge back to the server which will verify the signature using known public key. This should be achievable using NFC JavaCard. But do these NFC JavaCards actually exist? I wasn't able to find a company which would be able to produce such NFC tags for me. When I try to explain my requirements to a NFC tags producer he looks like he has never heard of NFC JavaCards. I have tried about 10 producers without luck.
Can a commonly available chip meet my requirements? I mean a chip from the Mifare familly. I suspect that Mifare DESfire might be able to meet my requirements, but I am not sure.
Feel free to respond with an advertisement, because relevant advertisement is exactly what I look for :)
I try to collect some useful facts:
NFC is a very broad term, just finding that on both sides does not ensure interoperability.
Any ISO 14443 (one of the NFC flavours) compliant smart card with crypto functionality should be usable. Note, that a card with native OS may be a viable alternative to a JavaCard, since the functionality to sign a random number is pretty standard.
Any smart phone sporting a NFC chip can address such a card in principle. Unfortunately this is strongly dependent on the OS of the smart phone, for Android the relevant class to use is IsoDep, which gives you the APDU interface. After triggering the "card enters field" event, then the app receives a handle, via which further communication can take place.
Real smart cards can't be cloned, since you are not able to dump them; especially keys can't be read.
Now some things to consider:
Your approach looks unusual, which might become a problem. (To have a portable card somehow fixed to a wall, just to get the location; so you know where somebody is, but not who? While I don't consider cloning to be an issue, you somehow must ensure destruction in case of a theft attempt, which may collide with the distance topic below.)
I don't see, where the server comes into play. If not involved in the authorized action, provision of a random number is not sufficient reason.
Asymmetric key operations have a comparatively high power consumption, and this power has to be supplied via the electric field. This severely limits the distance between card and phone and may even require direct touch. While a power supply of its own would solve the issue in principle, it is not what ISO-14443 was designed for.
Yes JavaCards do exist.
https://github.com/OpenJavaCard/openjavacard-ndef is a project makes these JavaCards to output standard NDEF messages (thought note issue 4 in that there example uses the wrong APDU but that is easily changed)
This project also give a number of cards it is fully working and tested for
ACS ACOSJ - fully working
NXP JCOP J3D040/J3D081/J2E145 etc - fully working
Both ACS and Cardlogic do cards (just google the model numbers)
e.g.
https://www.acs.com.hk/en/products/405/acosj-java-card-combi/
https://www.smartcardfocus.com/shop/ilp/id~707/j3a081-80k/p/index.shtml
The answer a was looking for is not a chip which runs a custom code. Although this might be possible it is definitely not the best way to achieve the target.
I was looking for a solution that enables strong authentication using NFC data. There might be multiple chips that offers this, but probably the most available chip is NTAG 424 DNA TT. It works like this:
The chip has a memory, which is not readable through NFC. Private key is stored there.
The chip has a read counter. It increments everytime the data are read through NFC.
The chip can generate an AES-128 signature of string UID (chip serial number) + counter using the private key in the inaccessible part of the memory.
The chip can dynamicaly inject the data above into a URL that is stored in the readable memory.
So the solution will be like (I am waiting for delivery of NFC tags right now, so I don't know for sure yet):
Read the tag UID (serial number) and the actual counter value (should be 0 on an unused tag)
Generate the key-pair
Load private key to the chip
Load some data (URL, eg: https://my.app/) to the chip
Store UID, public-key, last-counter on the server
Configure the chip to inject UID, counter, signature to the URL stored on the chip
When a client reads the data, they should contain required variables, eg: https://my.app/?counter=1&uid=ff:ff:ff:ff&signature=xyz. Then on the server:
Fetch stored info (public-key, last-counter) using uid as a primary key
verifies the signature
verifies the counter that must be > last-counter
stores counter as the last-counter
successfully authorized
Is anyone able to hack this without reading the hidden memory of the chip which would require physical tampering with the chip?

Uniquely identify Android Wear device

What would be the best way to uniquely identify a specific Wear-device? I'd like to store a preference per device on the phone and thus need an identifier that is static. I would expect that the NodeId is assigned dynamically (and changes after each reconnect, or after each reboot, for example).
I am working with a couple of Sony SmartWatch 3 devices and needed to reset some of them to factory settings. It turned out that the NodeId changed quite significantly from a rather long one (such as 738eaa61-703a-4dcb-ae93-d1f326e0c6d1) to a relatively short one like ed806f56.
However, as long as I didn't reset the watch completely I did never experience a change in the NodeId and it should be a reliable value (after a reset, the Watch needs to be paired again with the phone anyway).

iBeacons - locationManager:didEnterRegion callback and UUID

Lets say I have four beacons configured with same UUID , same major value and different minor values.Then I am monitoring the regions using only the UUID and imagine the a scenario where the four beacons overlaps with each other, assume when entering the store. Will I get four locationManager:didEnterRegion callbacks for each beacon or will it be only one ?
You will only get one. (Small caveat: iOS sometimes sends multiple callbacks, but this is rare, and can be considered a glitch in CoreLocation. These glitches have nothing to do with multiple beacons in a region being detected.)
Also note that you won't know which of the iBeacons is visible when you get the entry notification. To get the specific identifier, you will need to start ranging.

Create an app that will scan barcode in a loop until the device's battery level is depleted

I need to create an app that will scan a barcode continuously until the battery level of the device is low to the point where it turns off. I need to test how long the battery will last while scanning barcodes. I need to collect the data of the barcode type, the barcode number, the time of duration to scan the barcode, and the battery percentage at each scan.
I am new to programming with Android and will appreciate all the help I can get!
So far I have modified the ZXing Barcode Scanner app and it will print the barcode type, barcode number, time of duration for one single scan, but I need to save these values as well as add in the battery component. Thank you for the help.
If you're only going to use this for testing and not release on Market, I think it may be easiest to modify the Barcode Scanner source to do what you say here. You can disable its automatic shutdown timer in the code, and log whatever you want with each scan.

Resources