//------------------------------------------------------------------------------
// <copyright file="FltPyldComms.h" company="LiquidRobotics">
//
// Copyright (c) 2014 Liquid Robotics, Inc.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
// This software is associated with a release.  Liquid Robotics makes no
// representation that the design, interfaces or component distribution will
// remain unchanged in future releases.
//
// </copyright>
//
// <summary>
// 	This is the header for managing communication between the PIB, Float, and
//  other payloads daisychained off the PIB
// </summary>
//
// <owner>Jim Kirklin</owner>
//------------------------------------------------------------------------------

#ifndef _FLOAT_COMMS_H_
#define _FLOAT_COMMS_H_

//DWORD FloatComm(LPVOID pParam);
void *FloatComms(void *pParam);
DWORD PIBFileWatcher(LPVOID pParam);

#define YEAR0           1900                    /* the first year */
#define EPOCH_YR        1970            /* EPOCH = Jan 1 1970 00:00:00 */
#define SECS_DAY        (24L * 60L * 60L)
#define LEAPYEAR(year)  (!((year) % 4) && (((year) % 100) || !((year) % 400)))
#define YEARSIZE(year)  (LEAPYEAR(year) ? 366 : 365)

typedef long time_t_pyld;

#pragma pack(push,1)
typedef struct _TM_
{
	int tm_sec;
	int tm_min;
	int tm_hour;
	int tm_mday;
	int tm_mon;
	int tm_year;
	int tm_wday;
	int tm_yday;
	int tm_isdst;
}tm_pyld;
#pragma pack(pop)

//Time stamp structure
#pragma pack(push,1)
typedef struct
{
	int8_t	second;
	int8_t	minute;
	int8_t	hour;
	int8_t	day;
	int8_t	month;
	uint8_t	year;
}TIMESTAMP, *PTIMESTAMP;
#pragma pack(pop)

time_t_pyld mktime_pyld(tm_pyld time);
tm_pyld*	gmtime_pyld(time_t_pyld *timer);

uint8_t settime_pyld(time_t time);
time_t_pyld gettime_pyld();

// structure that holds the date and time with short year
#pragma pack(push,1)
typedef struct _DATE_TIME_
{
	uint8_t		hour;
	uint8_t		minute;
	uint8_t		second;
	uint8_t		month;
	uint8_t		day;
	uint8_t		year;		// since 2000
} DATE_TIME, *PDATE_TIME;
#pragma pack(pop)

#define FILE_INIT_WRITE		0x9000
#define FILE_WRITE_BLOCK	0x9001
#define FILE_DELETE			0x9002
#define FILE_READ_BLOCK		0x9003
#define FILE_GET_DETAIL		0x9004
#define FILE_GET_INFO		0x9008

#pragma pack(push,1)
typedef struct _FLOAT_TX_BUFFER_
{
	char bufFloat[250];
}FLOAT_TX_BUFFER, *PFLOAT_TX_BUFFER;
#pragma pack(pop)

#define MAX_FLOAT_BUFFERS	8

#define HDLC_SOF			0x7E
#define HDLC_ESC			0x7D
#define HDLC_EOF			0x7C
#define HDLC_TX_AND_MASK	0xDF
#define HDLC_RX_OR_MASK		0x20
#define HDLC_MAX_LENGTH		560

//Payload Communication Wrappers and Definitions

#pragma pack(push,1)
typedef struct _LRI_COMM_WRAPPER_
{
//	uint8_t 	sof;
	uint16_t	length;
	uint16_t	destination;
	uint16_t	source;
	uint16_t	msgID;
	uint16_t	msgType;
}LRI_COMM_WRAPPER, *PLRI_COMM_WRAPPER;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_GENERIC_NAK_
{
	uint16_t	originalCmd;
	uint8_t		nakSummary;
}LRI_GENERIC_NAK, *PLRI_GENERIC_NAK;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_GENERIC_ACK_
{
	uint16_t	originalCmd;
}LRI_GENERIC_ACK, *PLRI_GENERIC_ACK;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_REQUEST_ID_
{
	uint16_t	communicationProtocols;
	uint16_t	commandFormats;
}LRI_REQUEST_ID, *PLRI_REQUEST_ID;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_ID_PACKET_
{
	uint16_t	version;
	uint16_t	deviceType;
	uint16_t	address;
	char		serialNum[6];
	uint8_t		port;
	uint32_t	pollingRate;
	uint8_t		extraInfo;	//Bit 0 = telemetry, Bit 1 = power, Bit 2 = evets, Bit 3 = Echoed ACKS
	uint8_t		firmwareMajor;
	uint8_t		firmwareMinor;
	uint16_t	firmwareRev;
	char		description[20];
}LRI_ID_PACKET, *PLRI_ID_PACKET;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_ID_ACK_WRAPPER_
{
	uint16_t		totalNumber;
	uint16_t		numberOfReplies;
	LRI_ID_PACKET	firstID;
}LRI_ID_ACK_WRAPPER, *PLRI_ID_ACK_WRAPPER;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_ACK_COUNT_WRAPPER_
{
	uint16_t		totalNumber;
	uint16_t		numberOfReplies;
}LRI_ACK_COUNT_WRAPPER, *PLRI_ACK_COUNT_WRAPPER;
#pragma pack(pop)


#pragma pack(push,1)
typedef struct _LRI_TELEM_ACK_WRAPPER_
{
	uint16_t	numACKS;
	uint16_t	numDataWaiting;
	uint16_t	firstAddress;
}LRI_TELEM_ACK_WRAPPER, *PLRI_TELEM_ACK_WRAPPER;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_REQUEST_PIB_STATUS_
{
	TIMESTAMP	timestamp;
	uint32_t	latitude;
	uint32_t	longitude;
	char		fixValid;
}LRI_REQUEST_PIB_STATUS, *PLRI_REQUEST_PIB_STATUS;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_PIB_STATUS_
{
	uint16_t	version;	//Hi bit = Comand/Data Waiting
	uint16_t	address;	//PIB address
	uint16_t	alarms;
    uint8_t 	leak1;		//Leak Sensor 1 status
	uint8_t		leak2;		//Leak Sensor 2 status
	int8_t 		humidTemp;	//Temperature Form the Humidity Sensor (deg C)
	uint8_t 	humidity;	//Relative Humidity (%)
	int8_t 		presTemp;	//Temperature From the Pressure Sensor (deg C)
	uint8_t 	pressure;	//Pressure (kPa)
}LRI_PIB_STATUS, *PLRI_PIB_STATUS;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_STATUS_ACK_WRAPPER_
{
	uint16_t		totalNumber;
	uint16_t		numberOfReplies;
	LRI_PIB_STATUS	firstStatus;
}LRI_STATUS_ACK_WRAPPER, *PLRI_STATUS_ACK_WRAPPER;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_COMMAND_DATA_REQUEST_ACK_WRAPPER_
{
	uint16_t	commandFormat;
}LRI_COMMAND_REQUEST_ACK_WRAPPER, *PLRI_COMMAND_REQUEST_ACK_WRAPPER;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_IRIDIUM_DATA_REQUEST_ACK_WRAPPER_
{
	uint8_t		structureType;
	uint16_t	size;
}LRI_IRIDIUM_DATA_REQUEST_ACK_WRAPPER, *PLRI_IRIDIUM_DATA_REQUEST_ACK_WRAPPER;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_XBEE_DATA_REQUEST_ACK_WRAPPER_
{
	uint8_t		outputFormat;
	uint8_t		debugLevel;
	uint16_t	size;
}LRI_XBEE_DATA_REQUEST_ACK_WRAPPER, *PLRI_XBEE_DATA_REQUEST_ACK_WRAPPER;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _LRI_FLOAT_COMMAND_ACK_WRAPPER_
{
	uint16_t	commandFormat;
	uint16_t	acknowledgementCode;
}LRI_FLOAT_COMMAND_ACK_WRAPPER, *PLRI_FLOAT_COMMAND_ACK_WRAPPER;
#pragma pack(pop)


//Payload Buffer Sizes
#define PAYLOAD_RX_BUF_SIZE 556
#define PAYLOAD_TX_BUF_SIZE 556

//Payload Serial Port ID's
#define PAYLOAD_PORT_1	8
#define PAYLOAD_PORT_2	9

#define PAYLOAD_COMM_TIMEOUT	4

//Broadcast Addresses
#define ALL_BOARDS		0xFF00
#define	ALL_TASKS		0x00FF
#define	BROADCAST		0xFFFF

//Task ID's for Float C&C
#define FLOAT_BOARD_ADDRESS			0x0000

#define	FLOAT_COMMAND_INTERFACE		0x0001
#define FLOAT_IRIDIUM_INTERFACE		0x0002
#define FLOAT_DEBUG_INTERFACE		0x0003
#define FLOAT_FS_INTERFACE			0x0005
#define FLOAT_DATA_INTERFACE		0x0010


//Communication Protocols
#define PROTOCOL_1					0x0001

//Command Formats
#define IRIDIUM_SHIP_SHORE_ICD		0x0001

//Command ACK/NAK indicators
#define	CMD_ACK						0x0000
#define CMD_NAK_CMD					0x0001
#define CMD_NAK_DATA				0x0002
#define CMD_NAK_UNABLE_COMPLETE		0x0003
#define CMD_NAK_UNKNOWN_FORMAT		0x0004

//File System Types
#define ACK_WITH_LIST_DETAILED		0x1C
#define ACK_WITH_FILE_LIST			0x31
#define NEW_FILE_AVAILABLE			0x60

//Message Types
enum
{
	LRI_NAK = 0,
	LRI_ACK = 1,
	REQUEST_ID = 0x10,
	FLOAT_TELEMETRY_DATA = 0x15,
	REQUEST_PIB_STATUS = 0x22,
	SEND_FWD_ICD_CMD = 0x24,
	POWER_NOTIFICATION = 0x30,
	REQUEST_WAITING_PACKET = 0x40,
	ACK_REQUESTED_PACKET = 0x41
};
/*
#define LRI_NAK						0x0000
#define LRI_ACK						0x0001
#define	REQUEST_ID					0x0010
#define FLOAT_TELEMETRY_DATA		0x0015
#define REQUEST_PIB_STATUS			0x0022
#define SEND_FWD_ICD_CMD			0x0024
#define POWER_NOTIFICATION			0x0030
#define REQUEST_WAITING_PACKET		0x0040
#define ACK_REQUESTED_PACKET		0x0041
*/

//Custom Messages
#define MSG_PYLD_MGR_ENUMERATE			0x80000100
#define MSG_PYLD_MGR_CLR_ENUMERATE		0x80000101
#define MSG_PYLD_MGR_FLOAT_TELEM		0x80000200
#define MSG_PYLD_MGR_STATUS_REQ			0x80000300
#define MSG_PYLD_MGR_PACKET_REQUEST		0x80000400
#define MSG_PYLD_MGR_COMMAND_ACK		0x80000410
#define MSG_PYLD_MGR_ADD_COMMAND_ACK	0x80000411



//Nak Dispositions
#define	NAKDISP_SUCCEEDED			(3)				// this item succeeded, other items failed
#define	NAKDISP_DATA				(5)				// something was wrong with the data
#define	NAKDISP_FILE_IN_USE			(7)				// file exists and is in use
#define	NAKDISP_WOULD_OVERWRITE		(8)				// file exists (new file would overwrite)
#define	NAKDISP_READ_ONLY			(9)				// file is marked as read-only
#define	NAKDISP_MISSING_STORAGE		(10)			// storage device is missing, cannot be mounted
#define	NAKDISP_CRC_FAILED			(11)			// calculated CRC of file content does not match provided number
#define	NAKDISP_MD5_FAILED			(12)			// calculated MD5 of file content does not match provided signature
#define	NAKDISP_STORAGE_FULL		(13)			// storage device is full
#define	NAKDISP_STORAGE_IO_ERROR	(14)			// there was a problem talking to the storage device
#define	NAKDISP_BAD_FILE_CONTROL_BLOCK (15)			// there is a problem with the control blocks that describe the file
#define	NAKDISP_BAD_PROG_SELECT		(16)			// there is a problem with the configuration of program selection
#define	NAKDISP_TOO_MANY_COMMANDS	(17)			// there are too many active commands

// structure that holds a MD5 signature
#pragma pack(push,1)
typedef struct _MD5_
{
	uint8_t		data[16];
}MD5, *PMD5;
#pragma pack(pop)

//Structures Common to Inbound and Outboud traffic
#pragma pack(push,1)
typedef struct _COMM_HEADER_
{
	uint8_t		type;
	uint32_t	packetID;
	uint16_t	size;
}COMM_HEADER, *PCOMM_HEADER;
#pragma pack(pop)



#pragma pack(push,1)
typedef struct _CMD_FMT_18_
{
	uint16_t	storageControllerAddress;
	char		fileName[11];
	uint32_t	fileID;
	uint32_t	fileSize;
	DATE_TIME	creationDate;
	DATE_TIME	modifiedDate;
	uint8_t		fileAttributes;
	uint8_t		overwriteFile;
	uint16_t	contentCRC;
	MD5			contentMD5;
	uint16_t	numDataBytes;
	uint8_t		data[1];
}CMD_FMT_18, *PCMD_FMT_18;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _CMD_FMT_19_
{
	uint16_t	storageControllerAddress;
	uint32_t	fileID;
	uint32_t	offset;
	uint16_t	numDataBytes;
	uint8_t		data[1];
}CMD_FMT_19, *PCMD_FMT_19;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _CMD_FMT_1A_
{
	uint16_t	storageControllerAddress;
	char		fileName[11];
	uint32_t	fileID;
	uint8_t		overrideReadOnly;
}CMD_FMT_1A, *PCMD_FMT_1A;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _CMD_FMT_1B_
{
	uint16_t	storageControllerAddress;
	char		fileName[11];
	uint32_t	originalTransactionID;
	uint32_t	offset;
	uint32_t	readLength;
	uint16_t	maxResponseSize;
}CMD_FMT_1B, *PCMD_FMT_1B;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _CMD_FMT_1C_
{
	uint16_t	storageControllerAddress;
	char		fileName[11];
	uint32_t	fileID;
	uint8_t		actionFlags;
	uint16_t	maxResponseSize;
}CMD_FMT_1C, *PCMD_FMT_1C;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _CMD_FMT_1E_
{
	uint16_t dest;
	uint8_t function;
	uint16_t dataLength;
	char consoleData[1];
}CMD_FMT_1E, *PCMD_FMT_1E;
#pragma pack(pop)

typedef CMD_FMT_1C CMD_FMT_31, *PCMD_FMT_31;


////Structures Common to Inbound and Outboud traffic
//typedef struct _COMM_HEADER_
//{
//	uint8_t		type;
//	uint32_t	packetID;
//	uint16_t	size;
//}COMM_HEADER, *PCOMM_HEADER;

#pragma pack(push,1)
typedef struct _CMD_FMT_COMMON_
{
	uint8_t		fmtID;
	uint16_t	command;
}CMD_FMT_COMMON, *PCMD_FMT_COMMON;
#pragma pack(pop)


#pragma pack(push,1)
typedef struct _PYLD_MGR_FILE_RX_BUFFER_
{
	LRI_COMM_WRAPPER	wrapper;
	uint8_t		flagSendFwd;
	uint16_t	cmdFormat;
	COMM_HEADER		header;
	CMD_FMT_COMMON	type;
	union
	{
		CMD_FMT_18  initFileWrite;
		CMD_FMT_19  writeFile;
		CMD_FMT_1A  deleteFile;
		CMD_FMT_1B  readFile;
		CMD_FMT_1C  getFileListDetailed;
		CMD_FMT_1E  consoleInput;
		CMD_FMT_31  getFileList;
	};
}PYLD_MGR_FILE_RX_BUFFER, *PPYLD_MGR_FILE_RX_BUFFER;
#pragma pack(pop)


#define MAX_PYLD_FILE_BLOCK_SIZE	192

#define SHIP_SHORE_ICD		0x0001
#define EXECUTE_CMD			1
#define INFORMATION			0





#pragma pack(push,1)
typedef struct _ACK_READ_FILE_
{
	uint16_t	storageControllerAddress;	// storage controller address from request
	uint32_t	seekOffset;			// offset from start of file
	uint8_t		eofFlag;			// EOF flag (0 = not EOF, 0xFF = EOF)
	uint16_t	numDataBytes;		// number of data bytes to follow
	uint8_t		data[192];			// data bytes (content of file; may be larger, but at least 64)
	uint16_t	crc;				// placeholder for CRC
}ACK_READ_FILE, *PACK_READ_FILE;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _ACK_FILE_LIST_COMMON_HEADER_
{
	uint16_t	storageControllerAddress;	// storage controller address from request
	uint16_t	offset;				// number of files reported before this
	uint8_t		lastReport;			// 0 = not last report, 0xFF = last report
	uint16_t	numFiles;			// number of files in this message
}ACK_FILE_LIST_COMMON_HEADER, *PACK_FILE_LIST_COMMON_HEADER;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _ACK_FILE_LIST_RECORD_
{
	char		fileName[11];		// padded file name
	uint32_t	fileID;				// ID of file
	uint32_t	fileSize;			// size of file
	uint8_t		fileAttributes;		// attributes of file
}ACK_FILE_LIST_RECORD, *PACK_FILE_LIST_RECORD;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _ACK_FILE_LIST_
{
	ACK_FILE_LIST_COMMON_HEADER common;
	ACK_FILE_LIST_RECORD records[1];
	uint16_t	crc;
}ACK_FILE_LIST, *PACK_FILE_LIST;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _ACK_FILE_LIST_DETAILED_RECORD_
{
	char		fileName[11];		// padded file name
	uint32_t	fileID;				// ID of file
	uint32_t	fileSize;			// size of file
	DATE_TIME	creationDate;		// creation date from file
	DATE_TIME	modifiedDate;		// modified date from file
	uint8_t		fileAttributes;		// attributes of file
	uint16_t	providedCRC;		// CRC provided at initialization
	MD5			providedMD5;		// MD5 provided at initialization
	uint16_t	calculatedCRC;		// CRC calculated at last check
	MD5			calculatedMD5;		// MD5 calculated at last check
}ACK_FILE_LIST_DETAILED_RECORD, *PACK_FILE_LIST_DETAILED_RECORD;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _ACK_FILE_LIST_DETAILED_
{
	ACK_FILE_LIST_COMMON_HEADER common;
	ACK_FILE_LIST_DETAILED_RECORD records[1];
	uint16_t	crc;
}ACK_FILE_LIST_DETAILED, *PACK_FILE_LIST_DETAILED;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _ACK_NEW_FILE_AVAILABLE_
{
	uint16_t	storageControllerAddress;	// storage controller reporting new file
	char		fileName[11];		// padded file name
	uint32_t	fileSize;			// size of file
	DATE_TIME	creationDate;		// creation date from file
	DATE_TIME	modifiedDate;		// modified date from file
	uint8_t		fileAttributes;		// attributes of file
	uint16_t	providedCRC;		// CRC provided at initialization
	MD5			providedMD5;		// MD5 provided at initialization
	uint16_t	calculatedCRC;		// CRC calculated at last check
	MD5			calculatedMD5;		// MD5 calculated at last check
	uint16_t	crc;
}ACK_NEW_FILE_AVAILABLE, *PACK_NEW_FILE_AVAILABLE;
#pragma pack(pop)


#pragma pack(push,1)
typedef struct _NAK_FILE_
{
	uint16_t	count;		//always one for this application
	uint8_t		result;
	uint16_t	crc;
}NAK_FILE, *PNAK_FILE;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _FILE_ACKS_
{
	LRI_COMM_WRAPPER headers;
	LRI_GENERIC_ACK	 ackInfo;
	COMM_HEADER		toShoreheader;
	union
	{
		ACK_READ_FILE ackRead;
		ACK_FILE_LIST ackFileInfo;
		uint16_t crc;
	};

}FILE_ACKS, *PFILE_ACKS;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _FILE_NACKS_
{
	LRI_COMM_WRAPPER headers;
	LRI_GENERIC_NAK	 nakInfo;
	COMM_HEADER		toShoreheader;
	union
	{
		NAK_FILE	nakFile;
		uint16_t crc;
	};
}FILE_NAKS, *PFILE_NAKS;
#pragma pack(pop)









#pragma pack(push,1)
typedef struct _AIS_IRIDIUM_DATA_XMIT_
{
	LRI_COMM_WRAPPER 						headers;
	LRI_GENERIC_ACK							ackInfo;
	LRI_IRIDIUM_DATA_REQUEST_ACK_WRAPPER	iridiumInfo;
}AIS_IRIDIUM_DATA_XMIT, *PAIS_IRIDIUM_DATA_XMIT;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _FS_REPORT_
{
	LRI_COMM_WRAPPER 		headers;
	LRI_GENERIC_ACK			ackInfo;
	uint8_t					type;
	union
	{
		ACK_NEW_FILE_AVAILABLE	newFile;
		ACK_FILE_LIST			fileSummary;
		ACK_FILE_LIST_DETAILED	fileDetail;
	};
}FS_REPORT, *PFS_REPORT;
#pragma pack(pop)

#define NO_WRITE_IN_PROGRESS	0
#define WRITE_IN_PROGRESS		1
#define WRITE_COMPLETE			2

#pragma pack(push,1)
typedef struct _FILE_WRITE_IN_PROGRESS_
{
	uint8_t		writeStatus;
	char		tempFileName[13];
	char		finalFileName[13];
	uint32_t	tickCount;
	uint16_t	storageControllerAddress;
	char		fileName[11];
	uint32_t	fileID;
	uint32_t	fileSize;
	DATE_TIME	creationDate;
	DATE_TIME	modifiedDate;
	uint8_t		fileAttributes;
	uint8_t		overwriteFile;
	uint16_t	contentCRC;
	MD5			contentMD5;
	uint16_t	numDataBytes;
}FILE_WRITE_IN_PROGRESS, *PFILE_WRITE_IN_PROGRESS;
#pragma pack(pop)

#pragma pack(push,1)
typedef struct _ACK_PYLD_POWER_NOTIFICATION_RECORD_
{
	uint16_t	address;
	uint8_t		boardID;
	uint8_t		state;
	uint8_t		delayOff;
	uint8_t		delayOn;
}ACK_PYLD_POWER_NOTIFICATION_RECORD, *PACK_PYLD_POWER_NOTIFICATION_RECORD;
#pragma pack(pop)

#endif	//_FLOAT_COMMS_H_
