/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   PocsagDecoder.hpp
 * Author: jens
 *
 * Created on 11. Januar 2019, 17:20
 */

#ifndef POCSAGDECODER_HPP
#define POCSAGDECODER_HPP

#include <cstdlib>
#include <cstdio>
#include <cstdint>

class PocsagDecoder
{
public:
	PocsagDecoder();
	PocsagDecoder(const PocsagDecoder& orig);
	virtual ~PocsagDecoder();
	size_t process(uint8_t const *pData, size_t size); 

private:
	enum State
	{
		Sync,
		Data
	};

	State state = Sync;
	size_t dataCount;
	size_t msgPos = 0;
	uint8_t msgWord = 0;
	uint32_t func = 0;
	bool msgActive = 0;

	void messageBegin();
	void messageFinish();
};

#endif /* POCSAGDECODER_HPP */

