72 | | The `prepToSend` function creates the raw data that is seen by `warpnet.c`in the FPGA. It creates a byte packed data of 6 bytes (6B), 1 short (H) and 3 ints (3I). This is exactly what the node is expecting. A appropriate response from the node is a `warpnetACK` which `updateFromNode` parses in the python file. |
| 75 | The `prepToSend` function creates the raw data that is seen by `warpnet.c` in the FPGA. It creates a byte packed data of 6 bytes (6B), 1 short (H) and 3 ints (3I). This is exactly what the node is expecting. A appropriate response from the node is a `warpnetACK` which `updateFromNode` parses in the python file. |
| 76 | |
| 77 | For a struct that is requesting data the raw data sent would be a `warpnetRequest` struct and expect a response of the appropriate type. |
| 78 | |
| 79 | === Logging Data === |
| 80 | |
| 81 | As statistics are received by the client, there is good chance that the data would want to be written to a file. There is a built in method to do this. In the top-level script create a `DataLogger` object like the following. |
| 82 | {{{ |
| 83 | dataLog = DataLogger('filename.txt', fileRefreshTime) |
| 84 | }}} |
| 85 | |
| 86 | When instantiating a struct pass the `dataLog` object to the it as follows: |
| 87 | {{{ |
| 88 | statStruct = StatisticsStruct(dataLog) |
| 89 | }}} |
| 90 | |
| 91 | In the StatisticsStruct any received data in `updateFromNode` can be written to the this log file using |
| 92 | {{{ |
| 93 | self.logData('Data0=%d, Data1=%d" %(dataTuple[0], dataTuple[1])) |
| 94 | }}} |