package common_java;

public class FirmwareVersion {    
    public String  _printerBase = "";
    public int     _majorVersion = 0;
    public int     _minorVersion = 0;
    public int     _deviationVersion = 0;
 
    public FirmwareVersion() {
    }

    public Boolean ParseFirmwareRev(String strFwRev) {
		// FW revision is of the following format(s)
		// D3.17.3  or D3.17.3-4
    	Boolean bResult = true;
		String[] parts = strFwRev.split("\\.");

		if (parts.length == 3) {
			_printerBase = parts[0];
			_majorVersion = Integer.parseInt(parts[1]);
			String[] strMinorVersion = parts[2].split("-");
			_minorVersion = Integer.parseInt(strMinorVersion[0]);
			if (strMinorVersion.length >= 2) {
				_deviationVersion = Integer.parseInt(strMinorVersion[1]);
			}
		}
		else {
			bResult = false;
		}

        return bResult;
    }
}

