Closed Mas313 closed 3 months ago
@Mas313 Hey there.
To best of my understanding it can only generate payload and concatenate 'AVIDM' but cannot generate binary or bipolar values
Every message has a method to_bitarray()
which returns the binary representation of the message as an array of bits. Using this array you can perform whatever transformation you like:
from pyais.messages import MessageType5
from pyais.encode import encode_msg
payload = MessageType5.create(mmsi="123", shipname="Titanic", callsign="TITANIC", destination="New York")
bits = payload.to_bitarray()
print(bits)
# NRZI
state = 0
nrzi_encoded = []
for bit in bits:
if bit == 0:
state = 1 - state
nrzi_encoded.append(state)
print(nrzi_encoded)
Does this help?
Hi, Can i get NRZI data using pyais. I want to send NRZI data to SDR and verify using tools like rtl_Ais that pyais can be used for testing AIS messages. To best of my understanding it can only generate payload and concatenate 'AVIDM' but cannot generate binary or bipolar values. The encoder outputs as shown below. Any suggestions on how to get NRZI data. Thanks