28import java.nio.ByteOrder;
29import java.util.ArrayList;
30import java.util.Arrays;
31import java.util.Iterator;
34import org.jau.net.EUI48;
35import org.jau.net.EUI48Sub;
61 this.addrSub = EUI48Sub.ALL_DEVICE;
66 return SMPIOCapability.UNSET !=
io_cap || BTSecurityLevel.UNSET !=
sec_level;
135 for(
final Iterator<BTSecurityRegistry.Entry> i=devicesSecDetails.iterator(); i.hasNext(); ) {
136 final BTSecurityRegistry.Entry sd = i.next();
137 if( m.match(addr, name, sd) ) {
150 for(
final Iterator<BTSecurityRegistry.Entry> i=devicesSecDetails.iterator(); i.hasNext(); ) {
151 final BTSecurityRegistry.Entry sd = i.next();
152 if( m.match(addrSub, name, sd) ) {
164 public static BTSecurityRegistry.Entry
get(
final String name,
final NameEntryMatch m) {
165 for(
final Iterator<BTSecurityRegistry.Entry> i=devicesSecDetails.iterator(); i.hasNext(); ) {
166 final BTSecurityRegistry.Entry sd = i.next();
167 if( m.match(name, sd) ) {
181 public static BTSecurityRegistry.Entry
getStartOf(
final EUI48 addr,
final String name) {
182 return get(addr, name, (
final EUI48 a,
final String n,
final BTSecurityRegistry.Entry e) -> {
183 return ( e.addrSub.length > 0 && 0 == a.indexOf(e.addrSub, ByteOrder.BIG_ENDIAN) ) ||
184 (e.nameSub.length() > 0 && n.startsWith(e.nameSub) );
194 public static BTSecurityRegistry.Entry
getStartOf(
final EUI48Sub addrSub,
final String name) {
195 return get(addrSub, name, (
final EUI48Sub as,
final String n,
final BTSecurityRegistry.Entry e) -> {
196 return ( e.addrSub.length > 0 && 0 == as.indexOf(e.addrSub, ByteOrder.BIG_ENDIAN) ) ||
197 ( e.nameSub.length() > 0 && n.startsWith(e.nameSub) );
206 public static BTSecurityRegistry.Entry
getStartOf(
final String name) {
207 return get(name, (
final String n,
final BTSecurityRegistry.Entry e) -> {
208 return e.nameSub.length() > 0 && n.startsWith(e.nameSub);
219 public static BTSecurityRegistry.Entry
getEqual(
final EUI48Sub addrSub,
final String name) {
220 return get(addrSub, name, (
final EUI48Sub as,
final String n,
final BTSecurityRegistry.Entry e) -> {
221 return ( e.addrSub.length > 0 && as.equals(e.addrSub) ) ||
222 ( e.nameSub.length() > 0 && n.equals(e.nameSub) );
231 public static BTSecurityRegistry.Entry
getEqual(
final String name) {
232 return get(name, (
final String n,
final BTSecurityRegistry.Entry e) -> {
233 return e.nameSub.length() > 0 && n.equals(e.nameSub);
241 return devicesSecDetails;
253 public static BTSecurityRegistry.Entry
getOrCreate(
final String addrOrNameSub) {
254 final EUI48Sub addr1 =
new EUI48Sub();
255 final StringBuilder errmsg =
new StringBuilder();
256 BTSecurityRegistry.Entry sec =
null;
257 if( EUI48Sub.scanEUI48Sub(addrOrNameSub, addr1, errmsg) ) {
261 devicesSecDetails.add(sec);
267 devicesSecDetails.add(sec);
277 devicesSecDetails.clear();
281 return Arrays.toString( devicesSecDetails.toArray() );
Entry specifying SMP security details associated to a device query via EUI48Sub or nameSub.
Entry(final String nameSub)
SMPIOCapability getSecurityAutoIOCap()
boolean getPairingNumericComparison()
SMPIOCapability io_cap_auto
Entry(final EUI48Sub addrSub)
SMPIOCapability getIOCap()
BTSecurityLevel sec_level
boolean isSecurityAutoEnabled()
boolean isSecLevelOrIOCapSet()
BTSecurityLevel getSecLevel()
Application toolkit providing BT security setup and its device association on a pattern matching basi...
static BTSecurityRegistry.Entry getEqual(final EUI48Sub addrSub, final String name)
Returns a matching BTSecurityRegistry.Entry,.
static void clear()
Clears internal list.
static List< BTSecurityRegistry.Entry > getEntries()
Returns the reference of the current list of BTSecurityRegistry.Entry, not a copy.
static final int NO_PASSKEY
static BTSecurityRegistry.Entry getEqual(final String name)
Returns a matching BTSecurityRegistry.Entry,.
static String allToString()
static BTSecurityRegistry.Entry getStartOf(final EUI48Sub addrSub, final String name)
Returns a matching BTSecurityRegistry.Entry,.
static BTSecurityRegistry.Entry getStartOf(final EUI48 addr, final String name)
Returns a matching BTSecurityRegistry.Entry,.
static BTSecurityRegistry.Entry getStartOf(final String name)
Returns a matching BTSecurityRegistry.Entry,.
static BTSecurityRegistry.Entry getOrCreate(final String addrOrNameSub)
Determines whether the given addrOrNameSub is a EUI48Sub or just a name and retrieves an entry.
Bluetooth Security Level.
UNSET
Security Level not set, value 0.
UNSET
Denoting unset value, i.e.
Interface for user defined EUI48 address and name BTSecurityRegistry.Entry matching criteria and algo...
boolean match(final EUI48 address, final String name, final BTSecurityRegistry.Entry e)
Return true if the given address or name matches with the BTSecurityRegistry.Entry.
Interface for user defined EUI48Sub addressSub and name BTSecurityRegistry.Entry matching criteria an...
boolean match(final EUI48Sub addressSub, final String name, final BTSecurityRegistry.Entry e)
Return true if the given addressSub or name matches with the BTSecurityRegistry.Entry.
Interface for user defined name BTSecurityRegistry.Entry matching criteria and algorithm.
boolean match(final String name, final BTSecurityRegistry.Entry e)
Return true if the given name matches with the BTSecurityRegistry.Entry.