#DingDong iBeacons Repository contains sample codes to build a digital doorbell with a Estimote iBeacon. Cloudilly is used to build its internal chat + push notification system. When near an iBeacon, a visitor can press on a digital button to trigger a push notification out to the iBeacon's associated owner. If the owner choose to answer a ringing doorbell, both visitor and owner can communicate via a chat room. A secret token is used to verify ownership before associating the iBeacon to a user account.
Code is split into 2 portions: 1) iOS ObjC containing the majority of the logic, and 2) NodeJS Hook for initializing the secret token.
#####Create app If you have not already done so, first create an account on Cloudilly. Next create an app with a unique app identifier and a cool name. Once done, you should arrive at the app page with all the access keys for the different platforms. Under iOS SDK, you will find the parameters required for the ObjC portion of your application. "Access" refers to the access keys to be embedded in the ObjC codes. "Bundle ID" can be found inside xCode project under Targets >> General >> Identity. For this project we will require push notifications. Generate a non-password protected .P12 cert file and upload to the appropriate environment.
Under Hook SDK, you will find the parameters required for the NodeJS portion of your application. "Access" refers to the access keys to be embedded in your server side Hook codes.
#####Instantiate NodeJS server Deploy the below websocket dependency.
npm install --save ws
#####Update NodeJS codes Each iBeacon comes with a unique pair of major and minor number that can be retrieved via the Estimote Cloud. We will use the pair of major and minor number as our iBeacon's "identifier". Decide on a random string as its "secret token". This "secret token" will subsequently be used to verify ownership of the iBeacon. Update the "identifier" and "secret token". Update also your "App Name" and "Hook Access". Once done, upload your NodeJS files and run the application. Repeat steps if require more sets of iBeacons. Once done, there's no need to maintain the NodeJS server. The NodeJS server serves merely to initialize the "secret token".
#####Update ObjC codes From Estimote Cloud, obtain your developer's UUID and Identifer. Insert your "UUID" and "Identifer". Insert also your "App Name" and "Access". Once done, build and run the application on 2 sets of physical devices. On the first device, create a DingDong user account and then pair it with our iBeacon using the earlier "secret token". Move the second device into close proximity with the iBeacon. Press the doorbell on the second device to trigger a push notification out to the first device.