This repository has been archived by the owner on Sep 4, 2019. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from jcmurray/master
New NFC Sample application using LLCP
- Loading branch information
Showing
44 changed files
with
1,296 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<classpath> | ||
<classpathentry kind="src" path="src"/> | ||
<classpathentry kind="src" path="res"/> | ||
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/net.rim.ejde.BlackBerryVMInstallType/BlackBerry JRE 7.1.0"/> | ||
<classpathentry kind="output" path="bin"/> | ||
</classpath> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<projectDescription> | ||
<name>LLCPDemo</name> | ||
<comment></comment> | ||
<projects> | ||
</projects> | ||
<buildSpec> | ||
<buildCommand> | ||
<name>net.rim.ejde.internal.builder.BlackBerryPreprocessBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>net.rim.ejde.internal.builder.BlackBerryResourcesBuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
<buildCommand> | ||
<name>org.eclipse.jdt.core.javabuilder</name> | ||
<arguments> | ||
</arguments> | ||
</buildCommand> | ||
</buildSpec> | ||
<natures> | ||
<nature>net.rim.ejde.BlackBerryPreProcessNature</nature> | ||
<nature>net.rim.ejde.BlackBerryProjectCoreNature</nature> | ||
<nature>org.eclipse.jdt.core.javanature</nature> | ||
</natures> | ||
</projectDescription> |
3 changes: 3 additions & 0 deletions
3
NFC/LLCPDemo/.settings/net.rim.browser.tools.debug.widget.prefs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#Thu Jul 12 09:19:09 BST 2012 | ||
eclipse.preferences.version=1 | ||
outputfolder=build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#Thu Jul 12 09:18:42 BST 2012 | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.4 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore | ||
org.eclipse.jdt.core.compiler.source=1.3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<!-- This file has been generated by the BlackBerry Plugin for Eclipse v3.6.1. --> | ||
|
||
<Properties ModelVersion="1.1.2"> | ||
<General Title="LLCPDemo" Version="1.0.0" Vendor="BlackBerry Developer" Description=""/> | ||
<Application Type="BlackBerry Application" MainMIDletName="" MainArgs="" HomeScreenPosition="0" StartupTier="7" IsSystemModule="false" IsAutostartup="false"/> | ||
<Resources hasTitleResource="false" TitleResourceBundleName="" TitleResourceBundleRelativePath="" TitleResourceBundleClassName="" TitleResourceBundleKey="" DescriptionId=""> | ||
<Icons> | ||
<Icon CanonicalFileName="res/img/my_icon.png" IsFocus="false"/> | ||
</Icons> | ||
</Resources> | ||
<KeywordResources KeywordResourceBundleName="" KeywordResourceBundleRelativePath="" KeywordResourceBundleClassName="" KeywordResourceBundleKey=""/> | ||
<Compile OutputCompilerMessages="false" ConvertImages="true" CreateWarningForNoExportedRoutine="true" CompressResources="false" AliasList=""> | ||
<PreprocessorDefines/> | ||
</Compile> | ||
<Packaging PreBuildStep="" PostBuildStep="" CleanStep="" OutputFileName="LLCPDemo" OutputFolder="deliverables" GenerateALXFile="true"> | ||
<AlxFiles/> | ||
</Packaging> | ||
<HiddenProperties> | ||
<ClassProtection/> | ||
<PackageProtection/> | ||
</HiddenProperties> | ||
<AlternateEntryPoints/> | ||
</Properties> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# NFC LLCP Sample | ||
|
||
|
||
The purpose of this application is to demonstrate how to transfer data from one NFC-enabled BlackBerry to another | ||
using the NFC Logical Link Control Protocol (LLCP). | ||
|
||
To use this application, you’ll need to install it on two NFC enabled BlackBerry devices. | ||
On the first device, select the Sender icon and on the second select the Receiver icon. | ||
Adjust the text on the next screen on the sender device and click "Continue" and then place both devices back-to-back. | ||
You should see the data transfer take place and this illustrated by messages on the activity log screen. | ||
|
||
The application is liberally instrumented with EventLogger Informational messages using the label "LLCPDemo" | ||
that can be examined in the event log of a device. Use Alt-LGLG to set the log level to Information and to examine the | ||
event log or use javaloader -u eventlog>eventlog.txt to extract the log to your PC over USB. | ||
|
||
The sample code for this application is Open Source under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0.html). | ||
|
||
**Applies To** | ||
|
||
* [BlackBerry Java SDK for Smartphones](http://us.blackberry.com/developers/javaappdev/) | ||
|
||
|
||
**Author(s)** | ||
|
||
* [John Murray](https://github.com/jcmurray) | ||
* [Martin Woolley](https://github.com/mdwoolley) | ||
|
||
|
||
**Dependencies** | ||
|
||
1. BlackBerry Device Software 7.1 and above. | ||
|
||
|
||
**Known Issues** | ||
|
||
None | ||
|
||
**To contribute code to this repository you must be [signed up as an official contributor](http://blackberry.github.com/howToContribute.html).** | ||
|
||
|
||
## Contributing Changes | ||
|
||
Please see the [README](https://github.com/blackberry/BlackBerry-Java) of the BlackBerry-Java repository for instructions on how to add new Samples or make modifications to existing Samples. | ||
|
||
|
||
## Bug Reporting and Feature Requests | ||
|
||
If you find a bug in a Sample, or have an enhancement request, simply file an [Issue](https://github.com/blackberry/BlackBerry-Java/issues) for the Sample and send a message (via github messages) to the Sample Author(s) to let them know that you have filed an [Issue](https://github.com/blackberry/BlackBerry-Java/issues). | ||
|
||
|
||
## Disclaimer | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
52525400=RIM Runtime API |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
33000000=RIMAPPSA2 | ||
52424200=RIM Blackberry Apps API | ||
52434900=RIM Crypto API - Internal | ||
52435200=RIM Crypto API - RIM | ||
4e464352=NFCRoutingAPI |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
MIDlet-Name: LLCPDemo | ||
MIDlet-Version: 1.0.0 | ||
MIDlet-Vendor: BlackBerry Developer | ||
MIDlet-Jar-URL: LLCPDemo.jar | ||
MIDlet-Jar-Size: 116307 | ||
MicroEdition-Profile: MIDP-2.0 | ||
MicroEdition-Configuration: CLDC-1.1 | ||
MIDlet-1: LLCPDemo,img/my_icon.png, | ||
RIM-MIDlet-Flags-1: 0 | ||
Manifest-Version: 1.0 | ||
RIM-COD-URL: LLCPDemo.cod | ||
RIM-COD-Size: 48348 | ||
RIM-COD-Creation-Time: 1342085635 | ||
RIM-COD-Module-Name: LLCPDemo | ||
RIM-COD-Module-Dependencies: net_rim_cldc,net_rim_nfc | ||
RIM-COD-SHA1: 9f b5 69 92 d6 8e ef c5 87 1a 0c 91 45 53 3d 3e 20 92 85 5c |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
MIDlet-Name: LLCPDemo | ||
MIDlet-Version: 1.0.0 | ||
MIDlet-Vendor: BlackBerry Developer | ||
MIDlet-Jar-URL: LLCPDemo.jar | ||
MIDlet-Jar-Size: 0 | ||
MicroEdition-Profile: MIDP-2.0 | ||
MicroEdition-Configuration: CLDC-1.1 | ||
MIDlet-1: LLCPDemo,img/my_icon.png, | ||
RIM-MIDlet-Flags-1: 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<loader version="1.0"> | ||
<application id="LLCPDemo"> | ||
<name > | ||
LLCPDemo | ||
</name> | ||
<description > | ||
|
||
</description> | ||
<version > | ||
1.0.0 | ||
</version> | ||
<vendor > | ||
BlackBerry Developer | ||
</vendor> | ||
<copyright > | ||
Copyright (c) 2012 BlackBerry Developer | ||
</copyright> | ||
<fileset Java="1.54" _blackberryVersion="[7.1.0)"> | ||
<directory > | ||
7.1.0 | ||
</directory> | ||
<files > | ||
LLCPDemo.cod | ||
|
||
</files> | ||
|
||
</fileset> | ||
|
||
</application> | ||
|
||
</loader> |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright (c) 2012 Research In Motion Limited. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package nfc.sample.llcp; | ||
|
||
public class Constants { | ||
|
||
public static final String MYAPP_VERSION = "1.0.0"; | ||
|
||
public static final int SND_BTN_STATE=0; | ||
public static final int RCV_BTN_STATE=0; | ||
|
||
public static final int SND=0; | ||
public static final int RCV=1; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
/* | ||
* Copyright (c) 2012 Research In Motion Limited. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package nfc.sample.llcp; | ||
|
||
import net.rim.device.api.ui.UiApplication; | ||
import nfc.sample.llcp.ui.RoleSelectionScreen; | ||
|
||
public class LLCPDemo extends UiApplication { | ||
|
||
public static void main(String[] args) { | ||
Utilities.initLogging(); | ||
LLCPDemo app = new LLCPDemo(); | ||
app.enterEventDispatcher(); | ||
} | ||
|
||
private LLCPDemo() { | ||
pushScreen(new RoleSelectionScreen()); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* Copyright (c) 2012 Research In Motion Limited. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package nfc.sample.llcp; | ||
|
||
import java.io.UnsupportedEncodingException; | ||
|
||
import net.rim.device.api.system.EventLogger; | ||
import net.rim.device.api.ui.UiApplication; | ||
import net.rim.device.api.ui.component.Dialog; | ||
|
||
public class Utilities { | ||
|
||
private static final long MYAPP_ID = 0xde587f9e4b151ce7L; | ||
private static final String MYAPP_NAME = "LLCPDemo"; | ||
|
||
public static void log(String logMessage) { | ||
try { | ||
boolean ok = EventLogger.logEvent(MYAPP_ID, logMessage.getBytes("US-ASCII"), EventLogger.INFORMATION); | ||
} catch(UnsupportedEncodingException e) { | ||
} | ||
} | ||
|
||
public static void initLogging() { | ||
EventLogger.register(MYAPP_ID, MYAPP_NAME, EventLogger.VIEWER_STRING); | ||
} | ||
|
||
public static void popupMessage(String message) { | ||
synchronized(UiApplication.getEventLock()) { | ||
Dialog.inform(message); | ||
} | ||
} | ||
|
||
public static boolean isOdd(int number) { | ||
int remainder = number % 2; | ||
return remainder == 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* | ||
* Copyright (c) 2012 Research In Motion Limited. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package nfc.sample.llcp.buttons; | ||
|
||
import java.util.Hashtable; | ||
|
||
|
||
/** | ||
* A MultiStateButtonField has a series of states, each of which has multiple visual indications depending on | ||
* focused/unfocused | ||
* click/unclick | ||
* | ||
*/ | ||
public class MsbConfig { | ||
|
||
private Hashtable states = new Hashtable(); | ||
|
||
public void addState(MsbState state) { | ||
Integer key = new Integer(state.getState_id()); | ||
states.put(key,state); | ||
} | ||
|
||
public MsbState getState(int state_id) { | ||
MsbState state = (MsbState) states.get(new Integer(state_id)); | ||
return state; | ||
} | ||
|
||
} |
Oops, something went wrong.