Professional Documents
Culture Documents
Integration
Guide
Powermat Technologies
Nadav Reuveni, March 20, 2017
Table of Contents
For more information about Powermat, please visit our website at Powermat.com
Power charging spots, embedded in the tables, offers fast wireless charging to all mobile
phones.
Powermat IoT Platform enables to add a rich layer of services over wireless power
transmitters and devices by providing users as well as businesses personalized data driven
services
Powermat application layer - provides the tool to turn power into communication. The
pure act of placing the phone to charge create value turned into a means to engage
Powermat SDK solution:
Once user is tapping on that button, the phone will communicate directly with the nearby
charging spots using BLE technology in order to enable charging.
The user is instructed to place the phone (or a Ring accessory, where phone does not
contain an embedded wireless charging technology) on the charging spot and charging
will start.
How does micro location services work with Powermat SDK?
Powermat charging spots are working with iBeacon technology (and will soon support
EddyStone). The Beacon is embedded in the charging spot therefore powered and can be
upgraded remotely. No technician visits are required.
Once Powermat coded beacon is discovered by the app, it is being verified in Powermat
servers which return the venue information.
By knowing the exact venue location, your app can customize its UI and offers to that
location (Welcome to).
With micro location services, you can communicate with your customer in a more efficient
way, by sending targeted offers (either by push, or during app usage before or after
charging, second purchase mechanism etc.).
Getting Started
The Powermat SDK gives the host application the following capabilities:
The SDK is lightweight and easy to integrate within any app. Within a few function calls it enables
the host app to gain the full SDK capabilities and suit it to the apps needs.
iOS
The powermat SDK comes as an iOS framework library. In order to integrate it with the app follow
the process below:
1 Open Xcode
5. Drag PowermatSDK.framework file into the desired group of Xcodes Project Navigator. In the
displayed dialog check Copy items if needed, select Create groups and check your project
in Add to targets.
#import <PowermatSDK/PowermatSDK.h>
1. Add a description for BLE usage in your info.plist file with the key
NSBluetoothPeripheralUsageDescription
2. Declare Implementation of the Init Delegate <PMTCoreSDKDelegate> in your header
file.
/**
*/
@protocol PMTCoreSDKDelegate
/**
@param error an error object that contains the status code of the error
*/
/**
*/
-(void)PMTCoreSDKInitilized;
@end
3. Call the Init method with the parameters appKey and appId that were issued to you. if you dont have
these values please contact powermat support.
/**
*/
-(void)initWithDelegate:(nonnull id<PMTCoreSDKDelegate>)delegate
Enabling charge
1. After successful init either prepareForTap or discoverLocation should be called to get your app
ready for userTap and enable charge. Both methods include completion and failed blocks and the
difference is the data you get on the completion block. prepareForTap will only get you ready for
userTap while discoverLocation returns data for venue discovery.
prepareForTap:
[[PMTCoreSDK sharedInstance] prepareForTapWithCompletionBlock:^{
}];
discoverLocation:
[[PMTCoreSDK sharedInstance] discoverLocationWithCompletionBlock:^(PMTVenueData *
_Nonnull venueData) {
}];
2. After successful prepareForTap or discoverLocation you can safely call userTap method
}];
If charging did not begin userTap will enter failed block with status you can use to
show in app. See status codes section on this document for further details.
In order to fetch location data use discoverLocation method after successful Init.
/*Use the PMTVenueData object or save it for later usage. The object
contains all the relevant data for the venue including micro location
data*/
}];
If the method resulted with success block a PMTVenueData object is returned, it can be used to
determine if user is in a venue and which venue it is.
Micro location data is transmitted through the PMTVenueData object, received by the same
process described in Finding where we are section. The field microLocationsIds contains an
array of customer defined micro location codes that the user is in close proximity with.
The illustration below shows how the microLocationIds help us understand where we are
inside a venue.
Using SDK with Swift
The SDK was written in pure objective-c in order to use it inside you swift project create a
bridge header and import the objective-c framework inside the bridge header.
API reference
Method Purpose
initWithDelegate initializes SDK
Parameters: none
prepareForTapWithCom Prepares for userTap
pletionBlock
Parameters: none
userTapWithCompletio Enables charging on Powermat spots
nBlock
Parameters: none
isReadyToTap Checks if userTap can be called
Parameters: none
getAccountID Gets powermat user account id
Parameters: none
Requirements from Host App
1. In Android studio Click on File tab/New/New Module/ Import .JAR/.AAR Package =>
path to the .AAR
compile 'com.android.support:appcompat-v7:XX'
compile project(':PowermatSDK')
Before beginning it is important to understand that in the SDK each callback object is encapsulated
by a proper ResultReceiver class object. On each initiation of a ResultReceiver object, one should
pass a Handler object related to a Thread on which the result callback should be fire (main thread
VS worker thread etc.)
SdkInitResultReceiver sdkInitResultReceiver =
new SdkInitResultReceiver(new Handler());
sdkInitResultReceiver.setSdkInitCallback(
new SdkInitResultReceiver.SdkInitCallback() {
@Override
public Context getContext() {
return context; // should return the current context ex:
// getActivity() /MainActivity.this
}
@Override
public void onInitSuccess() {
//You can now perform discoverLocation call or prepareForTap call
}
@Override
public void onInitFailed(int errorCode) {
//Retry init, check internet connectivity etc.
}
});
After successful init either prepareForTap or discoverLocation should be called to get your
app ready for userTap and enable charge. Both methods differ in response data,
prepareForTap will get you ready for userTap while discoverLocation returns data for venue
discovery in addition to preparation for userTap.
import com.powermat.sdk.PMTSdk;
import com.powermat.sdk.handlers.PrepareForTapResultReceiver;
prepareForTapResultReceiver.setPrepareForTapCallback(new
PrepareForTapResultReceiver.PrepareForTapCallback() {
@Override
public void onReadyForTap() {
//userTap can be called
}
@Override
public void onPrepareFailed(int errorCode) {
//check error code for info about the failure
}
@Override
public Context getContext() {
return getActivity();
}
});
PMTSdk.prepareForTap(prepareForTapResultReceiver);
import com.powermat.sdk.PMTSdk;
import com.powermat.sdk.model.IPMTLocation;
import com.powermat.sdk.handlers.DiscoverLocationResultReceiver;
DiscoverLocationResultReceiver discoverLocationResultReceiver =
new DiscoverLocationResultReceiver(new Handler());
discoverLocationResultReceiver.setDiscoverLocationCallback(
new DiscoverLocationResultReceiver.DiscoverLocationCallback() {
@Override
public void onPMTLocationNotFound() {
//user is not in a venue
}
@Override
public void onDiscoveryFailed(int errorCode) {
//check error code to understand why discovery has failed
}
@Override
public void onPMTLocationFound(IPMTLocation location) {
// user is in a venue, check locations for info
}
@Override
public Context getContext() {
return getActivity();
}
});
PMTSdk.discoverLocation(discoverLocationResultReceiver);
tapToChargeResultReceiver.setTapToChargeCallback(new
TapToChargeResultReceiver.TapToChargeCallback() {
@Override
public Context getContext() {
return getActivity();
}
@Override
public void onChargeSucceeded() {
}
@Override
public void onChargeFailed(int errorCode) {
}
});
PMTSdk.userTap(tapToChargeResultReceiver);
If charging did not begin userTap will enter failed block with status you can use to show
in app. See status codes section on this document for further details.
Finding where we are
In order to fetch location data use discoverLocation method after successful Init:
DiscoverLocationResultReceiver discoverLocationResultReceiver =
new DiscoverLocationResultReceiver(new Handler());
discoverLocationResultReceiver.setDiscoverLocationCallback(
new DiscoverLocationResultReceiver.DiscoverLocationCallback() {
@Override
public void onPMTLocationNotFound() {
@Override
public void onDiscoveryFailed(int errorCode) {
//check error code to understand why discovery has failed
}
@Override
public void onPMTLocationFound(IPMTLocation location) {
//query location to get information about the venue
}
@Override
public Context getContext() {
return getActivity();
}
});
PMTSdk.discoverLocation(discoverLocationResultReceiver);
If the method succeeded and venue was found onPMTLocationFound will be called, query the
location parameter to get information regarding the venue the user is in.
Micro location data is transmitted through the IPMTLocation interface, The interface includes an
array property which contains Micro location ids (String), you can retrieve this object by calling
Discover location as described in the section above, the array of micro location ids can be empty if
user is not close to a Charging Spot.
The illustration below shows how the microLocationIds help us understand where we are
inside a venue.
API reference
Method Purpose
init initializes SDK
Parameters:
discoverLocationResultReceiver
prepareForTapWithCo Prepares for userTap
mpletionBlock
Parameters: none
userTapWithCompletio Enables charging on Powermat spots
nBlock
Parameters: none
isReadyToTap Checks if userTap can be called
Parameters: none
getAccountID Gets powermat user account id
Parameters: none
The minimum required android SDK version for the Powermat SDK to function is 19 (KitKat)
If your app supports lower SDK versions, to avoid build failures, you will need to add the following
lines to your manifest:
<uses-sdk android:targetSdkVersion=TARGET_SDK_VERSION
android:minSdkVersion=MIN_PROJECT_SDK_VERSION
tools:overrideLibrary="com.google.android.gms.tasks,
com.google.android.gms.location,com.google.android.gms.base,com.google.android.gms,com.powermat.s
dk"/>
Methods in SDK will return error codes in case that operation went wrong, the list below explains
what are the different error codes you may get
2 init failed