コード例 #1
0
ファイル: radio.py プロジェクト: sensorlab/wishful_upis
DOT_80211_MAC_EDCA_CW_MAX = Attribute(
    key='DOT_80211_MAC_EDCA_CW_MAX', type=int,
    isReadOnly=False)  #: EDCA Contention Window Max value
DOT_80211_MAC_EDCA_TX_OP = Attribute(
    key='DOT_80211_MAC_EDCA_TX_OP', type=int,
    isReadOnly=False)  #: EDCA Transmit Opportunity value
DOT_80211_PHY_REGURATORY_DOMAIN = Attribute(
    key='DOT_80211_PHY_REGURATORY_DOMAIN', type=str,
    isReadOnly=False)  #: Reguratory domain information
DOT_80211_POWER_MANAGEMENT = Attribute(
    key='DOT_80211_POWER_MANAGEMENT', type=int,
    isReadOnly=False)  #: Power Managemenet Scheme: Fixed, Auto

# MEASUREMENTS
DOT_80211_MAC_STATE_IDLE_TIME = Measurement(
    key='DOT_80211_MAC_STATE_IDLE_TIME',
    type=int)  #: Time MAC spent in idle state in last sampling interval
DOT_80211_MAC_STATE_IDLE_RATIO = Measurement(
    key='DOT_80211_MAC_STATE_IDLE_RATIO', type=float
)  #: Ratio of time that MAC spent in idle state in last sampling interval
DOT_80211_MAC_STATE_BUSY_TIME = Measurement(
    key='DOT_80211_MAC_STATE_BUSY_TIME',
    type=int)  #: Time MAC spent in busy state in last sampling interval
DOT_80211_MAC_STATE_BUSY_RATIO = Measurement(
    key='DOT_80211_MAC_STATE_BUSY_RATIO', type=float
)  #: Ratio of time that MAC spent in busy state in last sampling interval
DOT_80211_MAC_STATE_TX_TIME = Measurement(
    key='DOT_80211_MAC_STATE_TX_TIME',
    type=int)  #: Time MAC spent in TX state in last sampling interval
DOT_80211_MAC_STATE_TX_RATIO = Measurement(
    key='DOT_80211_MAC_STATE_TX_RATIO', type=float
コード例 #2
0
DOT_802154_PHY_TXPOWER = Attribute("IEEE802154_phyTXPower", type=int, isReadOnly=False)  #: The transmit power of the device.
DOT_802154_MAC_EXTENDEDADDRESS = Attribute("IEEE802154_macExtendedAddress", type=list, isReadOnly=False)  #: The extended 64-bit IEEE address assigned to the device.
DOT_802154_MAC_SHORTADDRESS = Attribute("IEEE802154_macShortAddress", type=int, isReadOnly=False)  #: The short 16-bit address that the device uses to communicate in the PAN.
DOT_802154_MAC_PANID = Attribute("IEEE802154_macPANId", type=int, isReadOnly=False)  #: The 16-bit identifier of the PAN on which the device is operating.
DOT_802154_MAC_CW = Attribute("IEEE802154_macCW", type=int, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154_MAC_MAX_BE = Attribute("IEEE802154_macMaxBE", type=int, isReadOnly=False)  #: The maximum value of the backoff exponent, BE, in the CSMA-CA algorithm, as defined in Section 5.1.1.4. of the IEEE-802.15.4 standard.
DOT_802154_MAC_MIN_BE = Attribute("IEEE802154_macMinBE", type=int, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154_MAC_MAXCSMABACKOFFS = Attribute("IEEE802154_macMaxCSMABackoffs", type=int, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154_MAC_MAXFRAMERETRIES = Attribute("IEEE802154_macMaxFrameRetries", type=int, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154E_MAC_HOPPINGSEQUENCELENGTH = Attribute("IEEE802154e_macHoppingSequenceLength", type=int, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154E_MAC_HOPPINGSEQUENCELIST = Attribute("IEEE802154e_macHoppingSequenceList", type=list, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154E_MAC_SLOTFRAMESIZE = Attribute("IEEE802154e_macSlotframeSize", type=int, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154E_MAC_TIMESLOT = Attribute("IEEE802154e_macTimeslot", type=DOT_802154E_TimeSlot, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154E_MAC_TSTIMESLOTLENGTH = Attribute("IEEE802154e_macTsTimeslotLength", type=int, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154E_MAC_SLOTLIST = Attribute("IEEE802154e_macSlotList", type=DOT_802154E_SlotList, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154E_MAC_SLOTFRAME = Attribute("IEEE802154e_macSlotFrame", type=DOT_802154E_SlotFrame, isReadOnly=False)  #: IEEE-802.15.4 channel.
# protocol (LPL, e.g. contiki_mac specific attributes or TAISC SPECIFIC)
DOT_802154_MAC_LPL_CHANNELCHECKRATE = Attribute("IEEE802154_macLplChannelCheckRate", type=int, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154_MAC_LPL_PHASEOPTIMIZATION = Attribute("IEEE802154_macLplPhaseOptimization", type=bool, isReadOnly=False)  #: IEEE-802.15.4 channel.
DOT_802154_MAC_TAISC_ACTIVE_RADIO_PROGRAM = Attribute("TAISCActiveRadioProgram", type=str, isReadOnly=False)  #: IEEE-802.15.4 channel.

# MEASUREMENTS
DOT_802154_MAC_STATISTICS = Measurement("IEEE802154_macStats", type=list)

# EVENTS
DOT_802154_MAC_STATISTICS_EVENT = Event("IEEE802154_macStatsEvent", type=list)


def blacklist_channels():
    return
コード例 #3
0
ファイル: radio.py プロジェクト: sensorlab/wishful_upis
    isReadOnly=False)  #:CSMA protocol.Duration of the EIFS time
CSMA_DIFS = Attribute(
    key='CSMA_DIFS', type=int,
    isReadOnly=False)  #:CSMA protocol.Duration of the DIFS time
CSMA_SIFS = Attribute(
    key='CSMA_SIFS', type=int,
    isReadOnly=False)  #:CSMA protocol.Duration of the SIFS time
CSMA_MAC_PRIORITY_CLASS = Attribute(
    key='CSMA_MAC_PRIORITY_CLASS', type=int, isReadOnly=False
)  #:CSMA protocol.QUEUE class service associated with CSMA radio program
CSMA_NUM_FREEZING_COUNT = Attribute(
    key='CSMA_NUM_FREEZING_COUNT', type=int, isReadOnly=True
)  #:CSMA protocol.Total number of freezing during the backoff phase

# MEASUREMENTS
NOISE = Measurement(key='NOISE', type=int)  #: Level of noise in dBm
CSI = Measurement(key='CSA',
                  type=int)  #: Channel State Information' last measured value
RSSI = Measurement(
    key='RSSI', type=int
)  #:Received Signal Strength Indication (RSSI); it refers to the last received frame in dBm.
SNR = Measurement(
    key='SNR',
    type=int)  #:Signal-to-noise ratio (SNR) of the last received frame in dB.
LQI = Measurement(key='LQI', type=int)  #:Link Quality Indicator (LQI)
FER = Measurement(key='FER', type=int)  #:Frame Erasure Rate (FER)
BER = Measurement(key='BER', type=int)  #:Bit Error Rate (BER)
BUSY_TYME = Measurement(
    key='BUSY_TYME', type=int
)  #:Time interval in which the transceiver has been active (including reception, transmission and carrier sense)
TX_ACTIVITY = Measurement(
コード例 #4
0

from wishful_upis.meta_models import Attribute, Measurement, Event, Action

# The protocol-specific definition of the WiSHFUL network control interface, UPI_N, for configuration/monitoring of the higher
# layers of the network protocol stack (upper MAC and higher).
# IEEE 802.11 protocol family

# ATTRIBUTES
DOT_80211_MODE = Attribute(key='DOT_80211_MODE', type=int, isReadOnly=False) #: Mode of device: STA, AP, P2P, MESH, AD-HOC
DOT_80211_STA_BLACKLIST = Attribute(key='DOT_80211_STA_BLACKLIST', type=str, isReadOnly=False) #: List of MAC addressed of blacklisted STAs
DOT_80211_STA_TX_POWER = Attribute(key='DOT_80211_STA_TX_POWER', type=int, isReadOnly=False) #: Per STA TX power


# MEASUREMENTS
DOT_80211_AP_NUMBER = Measurement(key='DOT_80211_STA_NUMBER', type=int) #: Number of APs in communication range
DOT_80211_STA_NUMBER = Measurement(key='DOT_80211_STA_NUMBER', type=int) #: Number of STAs in communication range
DOT_80211_SEEN_SSIDS = Measurement(key='DOT_80211_SEEN_SSIDS', type=str) #: List of SSIDs seen in communication range
DOT_80211_CONNECTED_STA_NUMBER = Measurement(key='DOT_80211_CONNECTED_STA_NUMBER', type=int) #: Number of connected STAs to AP
DOT_80211_STA_RSSI = Measurement(key='DOT_80211_STA_RSSI', type=str) #: Per-STA RSSI
DOT_80211_STA_TX_BITRATE = Measurement(key='DOT_80211_STA_TX_BITRATE', type=str) #: Per-STA bitrate
DOT_80211_STA_TX_BYTES = Measurement(key='DOT_80211_STA_TX_BYTES', type=str) #: Per-STA TX bytes
DOT_80211_STA_TX_PKTS = Measurement(key='DOT_80211_STA_TX_PKTS', type=str) #: Per-STA TX packets
DOT_80211_STA_RX_BYTES = Measurement(key='DOT_80211_STA_RX_BYTES', type=str) #: Per-STA RX bytes
DOT_80211_STA_RX_PKTS = Measurement(key='DOT_80211_STA_RX_PKTS', type=str) #: Per-STA RX packets
DOT_80211_STA_INACTIVE_TIME = Measurement(key='DOT_80211_STA_INACTIVE_TIME', type=str) #: Per-STA inactivity time
DOT_80211_STA_RETRY_NUM = Measurement(key='DOT_80211_STA_RETRY_NUM', type=str) #: Per-STA TX retries number
DOT_80211_STA_TX_FAILED = Measurement(key='DOT_80211_STA_TX_FAILED', type=str) #: Per-STA number of failed transmissions

# EVENTS
DOT_80211_PROBE_REQUEST = Event(key='DOT_80211_PROBE_REQUEST', type=None) #: Event triggered on Probe Request reception
コード例 #5
0
Key_StartStopUSRP = 5  # 0: Stop, 1, Start
Key_EnableDisableSI = 6  # SelfInterferance: 0: Enable, 1, 0:Disable
Key_RetuneDuplexer = 7  # 0: Enable, 1, 0:Disable
Key_CollisionDetector = 8  # b0: Reset, b1:Train, b2: FixAlpha, b3: Start
Key_DeviceAdd = 9  # 16 bits
Key_DestinationAdd = 10  # 16 bits
Key_PacketRec_CD_Test = 11  #
Key_ReceivedPacketReq = 12  # Request for the received packet
Key_IQDataReq = 13  # Request for the IQ
Key_MACSetting = 14  # b0:Payload From Host, b1: TxMAC.CD.Enable
Key_CD_Average = 15  # CD.Average Length (uint8)
Key_CD_Average_Th = 16  # CD.Average.Th (uint8)
Key_HostPayload = 21
N_Payload = 118

RX_DATA = Measurement(key='RX_DATA', type=List)
CD_RESULT = Measurement(key='CD_RESULT', type=int)
NUM_RX = Measurement(key='NUM_RX', type=int)


# *******************************************
def double2bytearray(double_num):
    return reversed(bytearray(struct.pack("d", double_num)))


def MakePacket(Key, data):  # Make Packet: Tx frequency
    if Key <= 20:  # Key 0-20 for setting
        try:
            data_len = 8 + len(data)  # for doubel numbers
        except:
            data_len = 9