Thanks Chris,

 

Have the code downloaded and will be learning from it.

 

I’m having to brush up on my native ‘C’ skill set as well.  The OO derivatives tend to warp the mind over time.

 

Jim McCullers

WA4CWI

 

I mentioned to Jim and some others that I was working on some Pacsat code for an ARISS project.  This is just a prototype but it may be useful, especially for those seeking to understand the protocols.  I cleaned up the code a bit and checked it all in to here:

https://github.com/ac2cz/Pacsat/

 

I leveraged some of the old 1990s code from programs like PG and PB, but they are written in an old style of C that modern gcc does not like. They also rely on the bit size of char, int and long (and time_t it seems) in a way that does not work with modern computers.  So I updated much of that to use uint32_t etc.  Also PB/PG are for a ground station whereas this code is for the server.  So there were just a few structures and routines to leverage, but most of this is new code.  

 

This runs on Linux and has been tested on Ubuntu and the Raspberry PI.  I have assumed a little endian machine, there is no code to cope with big endianess  It works with Direwolf's AGW engine as the TNC.  I picked that over the KISS interface so I do not have to implement the connected mode state machine for AX25. 

 

Right now this just implements the broadcast protocol.  Specifically it stores the PB status for up to 10 stations, it transmits the PB status periodically, handles directory broadcast requests and file broadcast requests.  The functionality to handle holes in the directory and files is not fully tested, but the broadcast of a new directory or of a new file seem to work well.  I have no idea how these things were done in previous spacecraft, so I chose a linked list for the directory, which is rebuilt at startup, and a fixed structure to hold 10 stations on the PB, with memory allocated and freed for the list of holes that they supply.  If the directory grows to a large size then a hash table index by file id may be useful to save CPU at the expense of memory, but it is probably not needed given the frequency of requests is likely low (per second).


The code it split into files to handle the creation or parsing of Pacsat Headers and Files, the creation and maintenance of a directory and the broadcast protocol.  There are also test routines for each file, which you can see at the end.  These demonstrate how most of the functions work.  The Pacsat header/file routines may be the most useful to leverage as they are a pain to write and probably very portable.  Though I have assumed a normal C file system to load/save the files.

 

I'm happy to answer questions or discuss with anyone if that is helpful.  I don't claim any great skill in the C language, so feel free to point out any issues or make suggestions if you want.

 

Next I am going to finish up the handling of holes and then implement FTL0 for file uploads.  I want to setup a test loop to measure the relative performance of AX25 vs FX25 under simulated LEO conditions.  I also want to see if this prototype will work for the mission objectives of the ARISS Student Sensor project.

 

73

Chris

 

--

Chris E. Thompson
[email protected]
[email protected]