• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#
3#   Copyright 2022 - The Android Open Source Project
4#
5#   Licensed under the Apache License, Version 2.0 (the "License");
6#   you may not use this file except in compliance with the License.
7#   You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11#   Unless required by applicable law or agreed to in writing, software
12#   distributed under the License is distributed on an "AS IS" BASIS,
13#   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14#   See the License for the specific language governing permissions and
15#   limitations under the License.
16
17
18class OobData:
19    """
20    Represents an Out of Band data set in a readible object
21    """
22
23    def __init__(self, is_valid, transport, byte_string_address, byte_string_c, byte_string_r):
24        """
25        @param is_valid indicates whether the data was able to be parsed
26        @param transport LE or Classic
27        @param 7 octet byte string.  Little Endian 6 byte address + 1 byte transport
28        @param byte_string_c 16 octet confirmation
29        @param byte_string_r 16 octet randomizer
30        """
31        self.__is_valid = True if is_valid == "1" else False
32        self.__transport = int(transport)
33        self.__byte_string_address = byte_string_address
34        self.__byte_string_c = byte_string_c
35        self.__byte_string_r = byte_string_r
36
37    def is_valid(self):
38        return self.__is_valid
39
40    def transport(self):
41        return self.__transport
42
43    def address(self):
44        return self.__byte_string_address
45
46    def confirmation(self):
47        return self.__byte_string_c
48
49    def randomizer(self):
50        return self.__byte_string_r
51