This package allows you to encode Nexus Keycodes. This is a beta release.
Learn more about about Angaza Nexus here.
Source archives for each release are available in releases.
This package comes with a full suite of unit tests, which you can run in the normal way in your IDE.
This package uses a form of semantic versioning. The version number is comprised of three components: MAJOR.MINOR.PATCH
Major version numbers represent breaking changes in the keycode protocol itself. This is the only version number that is relevant to keycodes themselves. For example, any keycode generated any version 1.X.Y of this encoder will be valid on any version 1.X.Y of the embedded decoder.
Minor version numbers represent breaking internal API changes. You may need to modify your code to accomodate these changes.
Patch version numbers represent changes that are fully backward compatible.
Generate keycodes for the full and small keypad protocols.
Add Credit
byte[] secretKey = newHexToByteArray().convert("deadbeefdeadbeefdeadbeefdeadbeef");
intmessageId = 42;
longseconds = 7/* days */ * 24/* hours */ * 60/* minutes */ * 60/* seconds */;
DateclampedTime = newDate();
KeycodeMetadataoutput = KeycodeFactory.addCredit(
clampedTime,
messageId,
secretKey,
KeycodeProtocol.FULL,
seconds
);
Stringkeycode = output.getKeycodeData().getKeycode();
// outputs *599 791 493 194 43#Set Credit
intmessageId = 43;
inthours = 14/* days */ * 24/* hours */;
FullMessagemessage = FullMessage.setCredit(messageId, hours, secretKey);
Stringkeycode = message.toKeycode();
// outputs *272 511 292 039 01#Unlock
intmessageId = 44;
KeycodeMetadataoutput = KeycodeFactory.unlock(messageId, secretKey, KeycodeProtocol.FULL);
Stringkeycode = output.getKeycodeData().getKeycode();
// outputs *578 396 697 305 45#Add Credit
intmessageId = 31;
longseconds = 7/* days */ * 24/* hours */ * 60/* minutes */ * 60/* seconds */;
DateclampedTime = newDate();
KeycodeMetadataoutput = KeycodeFactory.addCredit(
clampedTime,
messageId,
secretKey,
KeycodeProtocol.SMALL,
seconds
);
Stringkeycode = output.getKeycodeData().getKeycode();
// outputs 154 535 324 353 534Unlock
intmessageId = 32;
KeycodeMetadataoutput = KeycodeFactory.unlock(messageId, secretKey, KeycodeProtocol.SMALL);
Stringkeycode = output.getKeycodeData().getKeycode();
// outputs 153 233 555 553 342