Add files via upload

This commit is contained in:
DJ2LS 2020-12-15 18:22:44 +01:00 committed by GitHub
parent a697b87087
commit 0805d3bca7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,6 +13,7 @@ import binascii #required for string.to_bytes() function
import sys
def main():
modem = FreeDV() #Load FreeDV Class as "modem"
@ -55,15 +56,15 @@ class FreeDV():
buffer[:len(data_list[i])] = data_list[i] # set buffersize to length of data which will be send
crc = c_ushort(self.c_lib.freedv_gen_crc16(bytes(buffer), self.payload_per_frame)) # generate CRC16
crc = crc.value.to_bytes(2, byteorder='big') # convert buffer to 2 byte hex string
crc = crc.value.to_bytes(2, byteorder='big') # convert crc to 2 byte hex string
buffer += crc # append crc16 to buffer
data = self.FrameBytes().from_buffer_copy(buffer) #change data format form bytearray to ctypes.u_byte
data = self.FrameBytes().from_buffer_copy(buffer) #change data format from bytearray to ctypes.u_byte
self.c_lib.freedv_rawdatatx(self.freedv,mod_out,data) # modulate DATA
self.c_lib.freedv_rawdatatx(self.freedv,mod_out,data) # modulate DATA and safe it into mod_out pointer
sys.stdout.buffer.write(mod_out) # the normal way of piping data
sys.stdout.flush() # flushing data
sys.stdout.buffer.write(mod_out) # print data to terminal for piping the output to other programs
sys.stdout.flush() # flushing stdout
main()