AFTN 报文生成

class tafor.utils.message.AFTNMessageGenerator(text, channel='', number=1, priority='GG', address='', originator='', maxLineChar=69, sequenceLength=4, maxSendAddress=21, time=None)

航空固定电信网络(Aeronautical Fixed Telecommunication Network Message)报文的生成

参数:
  • text – 报文内容
  • channel – 信道
  • priority – 电报优先级,默认 GG
  • address – 收电地址
  • originator – 发点地址
  • maxLineChar – AFTN 线路每行最大字符数
  • time – AFTN 报文生成时间

使用方法:

m = AFTNMessageGenerator('TAF ZJHK 150726Z 150918 03003G10MPS 1600 BR OVC040 BECMG 1112 4000 BR=')
# 返回字符串格式 AFTN 报文
m.toString()
# 返回 JSON 格式 AFTN 报文
m.toJson()
divideAddress(address)

根据最大发送地址拆分地址组,比如允许最大地址是 7,有 10 个地址就拆成 2 组

返回:迭代器,拆分后的地址
generate()

生成 AFTN 电报格式的报文

toJson()

生成 JSON 格式的报文

返回:JSON
toString()

生成字符串格式的报文

返回:字符串,多份报文用 4 个换行符连接