From 8dd797edcf75ed2a43eb855b728643eac1ee9915 Mon Sep 17 00:00:00 2001 From: MonHun Date: Tue, 10 Oct 2023 11:42:11 +0900 Subject: [PATCH] gpad1010 --- .../java/kr/gmtc/gw/dev/DevApplication.java | 2 + .../asderecv/asde/asterix/AsterixParser.java | 2046 +++++----- .../asde/asterix/AsterixParserThread.java | 292 +- .../asderecv/asde/asterix/YamlFileLoader.java | 126 +- .../controller/AsdeServiceController.java | 246 +- .../asde/controller/ParseController.java | 32 +- .../gw/dev/asderecv/asde/utils/AsdeUtil.java | 28 +- .../asde/utils/FieldNameReflectionUtils.java | 100 +- .../gw/dev/asderecv/config/ServiceConfig.java | 182 +- .../asderecv/controller/MainController.java | 726 ++-- .../gw/dev/asderecv/thread/CustomThread.java | 224 +- .../handler/CustomThreadOnTerminate.java | 12 +- .../thread/handler/CustomThreadWork.java | 12 +- .../gw/dev/restdev/config/RestConfig.java | 53 + .../controller/RestReciveController.java | 160 + .../controller/RestReqeustController.java | 83 + .../restdev/service/StandMasterService.java | 40 + .../gmtc/gw/dev/restdev/vo/AImetaTestVO.java | 178 + .../dev/restdev/vo/AiMetaVideoStatusVO.java | 56 + .../gmtc/gw/dev/restdev/vo/StandMasterVO.java | 35 + src/main/resources/application.yml | 4 + src/main/resources/asterixList.xml | 10 +- .../resources/spec/alterixCat010Indra.yml | 1464 ++++---- src/main/resources/spec/alterixCat011.yml | 3284 ++++++++--------- 24 files changed, 5003 insertions(+), 4392 deletions(-) create mode 100644 src/main/java/kr/gmtc/gw/dev/restdev/config/RestConfig.java create mode 100644 src/main/java/kr/gmtc/gw/dev/restdev/controller/RestReciveController.java create mode 100644 src/main/java/kr/gmtc/gw/dev/restdev/controller/RestReqeustController.java create mode 100644 src/main/java/kr/gmtc/gw/dev/restdev/service/StandMasterService.java create mode 100644 src/main/java/kr/gmtc/gw/dev/restdev/vo/AImetaTestVO.java create mode 100644 src/main/java/kr/gmtc/gw/dev/restdev/vo/AiMetaVideoStatusVO.java create mode 100644 src/main/java/kr/gmtc/gw/dev/restdev/vo/StandMasterVO.java diff --git a/src/main/java/kr/gmtc/gw/dev/DevApplication.java b/src/main/java/kr/gmtc/gw/dev/DevApplication.java index d45ec6c..ca45d51 100644 --- a/src/main/java/kr/gmtc/gw/dev/DevApplication.java +++ b/src/main/java/kr/gmtc/gw/dev/DevApplication.java @@ -7,7 +7,9 @@ import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.context.ApplicationPidFileWriter; import org.springframework.boot.system.ApplicationHome; +import org.springframework.scheduling.annotation.EnableScheduling; +@EnableScheduling @SpringBootApplication public class DevApplication { // implements CommandLineRunner diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/AsterixParser.java b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/AsterixParser.java index 7670543..0beb3d4 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/AsterixParser.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/AsterixParser.java @@ -1,1023 +1,1023 @@ -package kr.gmtc.gw.dev.asderecv.asde.asterix; - -import kr.gmtc.gw.dev.asderecv.asde.asterix.spec.*; -import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; -import kr.gmtc.gw.dev.asderecv.asde.utils.AsdeUtil; -import kr.gmtc.gw.dev.asderecv.asde.utils.FieldNameReflectionUtils; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.DecimalFormat; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - - -public class AsterixParser { - - private Logger logger; - - private AsterixSpec asterixSpec; - - private List serviceMap; - private AsterixSpecVO currentSpec; - - private LinkedHashMap resultMap ; - private ServiceAsdeData scMap ; - - private AsterixParserUtils apUtils = new AsterixParserUtils(); - private FieldNameReflectionUtils fieldUtils = new FieldNameReflectionUtils(); - - private DecimalFormat decFormat = new DecimalFormat("#.#########"); - - private String execMode; - - /***************************************** Constructor & Main Method *****************************************/ - - public AsterixParser() - { - initParser(); - } - - public AsterixParser( List serviceMap, String execMode ) { - - initParser(); - this.serviceMap = serviceMap; - this.execMode = execMode; - - } - - private void initParser() { - - asterixSpec = new AsterixSpec(); - apUtils = new AsterixParserUtils(); - logger = LoggerFactory.getLogger(AsterixParser.class); - - } - - public List> parse(byte[] data, String sRecvTime) { - String sCatNo = null; - try - { - if(data.length < 5) return null; - - // 바이트 값을 16진수(0xff, 255)와 비트연산하여 정수로 변환 - sCatNo = String.valueOf(data[0] & 0xff); - - // 데이터부의 category와 일치하는 스펙 가져오기 - currentSpec = asterixSpec.getSpec(sCatNo); - - if(currentSpec == null ) { - logger.error("[AsterixParser] Asterix Spec이 정의되어 있지 않음. [수신메시지의 category:" + sCatNo + "]"); - return null; - }else { - if (currentSpec.getDataitem().isEmpty()) { - logger.error("[AsterixParser] Asterix Spec yml파일에 구문 오류가 있음. [수신메시지의 category:" + sCatNo + "]"); - } - } - - // 데이터 블럭의 분석 결과 - List> result_list = new ArrayList>(); - - // 수신받은 데이터 총길이 - int total_len = data.length; - - // 데이터블럭 사이즈 (데이터 블럭(1) : 데이터 패킷(N)) - byte[] blSize = new byte[2]; - - // 분석 처리 대상 블럭 - byte[] blockData = null; - - // 한번에 여러개의 블럭을 수신 받은경우 반복하여 처리 하기위한 블럭단위 초기 인덱스 - // 1개 블럭의 마지막 인덱스를 저장 - int index = 0; - - // 데이터 블록에 정의되어 있는 총 길이 만큼 잘라서 분석하고 (real_data) - // 남아 있는 데이터가 있다면 새로운 데이터블록이므로 반복하여 처리 - while(total_len > index) - { -// int iCatNo = data[index] & 0xff; - - // 데이터 블록의 총 길이(2옥텟) - blSize[0] = data[index+1]; - blSize[1] = data[index+2]; - - int iDataBlockSize = apUtils.unsignedToInt(blSize); - int iBlockStartPos = 3; - -// logger.error("[AsterixParser:parse] 수신 데이터 총 길이:" + total_len + " / 분석대상 블록 길이" + iDataBlockSize, LogLevelType.LOG_DEBUG, "AllLog"); - - if(iDataBlockSize <= 0) return result_list; - - // 데이터 블록의 총 길이만큼 초기화 - blockData = new byte[iDataBlockSize]; - - try - { - if((index+iDataBlockSize) > total_len) iDataBlockSize = total_len-index; - - /* System.arraycopy(src, srcPos, dest, destPos, length); - src - 원본 배열 - srcPos - 원본 배열의 복사 시작 위치 - dest - 복사할 배열 - destPost - 복사할 배열의 복사 시작 위치 - length - 복사할 요소의 개수 - * */ - System.arraycopy(data, index + iBlockStartPos, blockData, 0, iDataBlockSize - iBlockStartPos); - - List> list = parseOneBlock(blockData, sRecvTime); - - if(list != null) result_list.addAll(list); - } - catch(Exception e) - { - e.printStackTrace(); - logger.error("[AsterixParser:parse] Exception:" + AsdeUtil.getStatckTrace(e)); - return result_list; - } - - index += iDataBlockSize; - } - - return result_list; - - } - catch(Exception e) - { - logger.error("[AsterixParser] 수신메시지 분석 실패 [CAT " + sCatNo + "]"); - return null; - } - } - - - private List> parseOneBlock(byte[] blockData, String sRecvTime) throws Exception { - - int body_len = blockData.length; - - List> result = new ArrayList>(); - - Map mapUAP; - - int index = 0; - int index_before = 0, parserCnt = 0; - int idx; - - while(index < body_len-1) - { - - int to_read = body_len - index; - mapUAP = new LinkedHashMap(); - - // UAP 체크 - for(idx=0; idx it = mapUAP.keySet().iterator(); - scMap = new ServiceAsdeData(); - - // 카테고리유형 셋팅 - fieldUtils.setItem(scMap, "cat_ty", currentSpec.getCat()); - - //수신시각 셋팅 - fieldUtils.setItem(scMap, "recptn_dt", sRecvTime); - - int result_index = 0; - resultMap = new LinkedHashMap(); - while(it.hasNext()) - { - - Integer frn = it.next(); - AsterixSpecVO_DataItem di = mapUAP.get(frn); - if(di == null) continue; - - //resultMap = new LinkedHashMap(); - result_index = makeResult(di, byteRecodeData, result_index); - if(result_index < 0) break; - - } - - if(resultMap != null && resultMap.size() > 0) - { - result.add(resultMap); - - // 서비스용 map에 적재하되 식별자가 없는 데이터는 스킵 - // key 값으로 사용할 수 있는 필드에 값이 있는 경우만 - if( scMap.filterSvcData() ) { - testScvMap(resultMap); - serviceMap.add(scMap); - } - - } - - parserCnt ++; - index_before = index; - - index = index + iUAPoffset + result_index; - - // log - byte[] bLogByte = new byte[index - index_before]; - System.arraycopy(blockData, index_before, bLogByte, 0, index - index_before); -// logger.error("[AsterixParser:parseOneBlock] packet [CNT :" + parserCnt + ", Hex Data :" + apUtils.cnvBytesToHex(bLogByte) + "]", LogLevelType.LOG_DEBUG, "AllLog"); - - if(result_index < 0) break; - - } - - return result; - } - - /***************************************** Make Result *****************************************/ - - private void testScvMap(LinkedHashMap resMap) { - - double dX = apUtils.parseDoubleDef(resMap.get("X-COMPONENT")); - double dY = apUtils.parseDoubleDef(resMap.get("Y-COMPONENT")); - int iXm = apUtils.parseIntDef(resMap.get("XM")); - int iYm = apUtils.parseIntDef(resMap.get("YM")); - double iVx = apUtils.parseDoubleDef(resMap.get("VX")); - double iVy = apUtils.parseDoubleDef(resMap.get("VY")); - double dDistNM = 1; - double dAzimuth = 0; - double dSpeed; - int iMax = 8191; - - Map posMap; - - // 위경도 변환 (x,y -> wgs84) - if(dX != 0 || dY != 0) { - if( !(iXm == 0 && iYm == 0) ){ - - if (iXm == 1) { - if(dX > 0) dX = dX + iMax; - else if(dX < 0) dX = dX - iMax; - else dX = 0; - } - - if (iYm == 1) { - if(dY > 0) dY = dY + iMax; - else if(dY < 0) dY = dY - iMax; - else dY = 0; - } - - } - - dDistNM = Math.sqrt(dX * dX + dY * dY) / 1852.0; // m >> NM - dAzimuth = apUtils.calcAngleDegree(0, 0, dX, dY); - - posMap = apUtils.calcDistanceAzimuth(apUtils.CONST_BASE_LAT, apUtils.CONST_BASE_LON, dDistNM, dAzimuth); - - scMap.setLat(String.format("%.14f", posMap.get("lat"))); - scMap.setLon(String.format("%.14f", posMap.get("lon"))); - //scMap.setCos(String.format("%.2f", dAzimuth)); - } - - // 속도 계산 -// if(resMap.get("cat_ty").equals("11")){ -// dSpeed = Math.sqrt(Math.pow(iVx, 2) + Math.pow(iVy, 2)); -// } -// else if(resMap.get("cat_ty").equals("10")){ -// -// ) - dSpeed = Math.sqrt(Math.pow(iVx, 2) + Math.pow(iVy, 2)); - - - dSpeed = dSpeed * 3.6; // m/s >> km/h - - //SX(Vx, 16) = 0 or SY(Vy, 8) = 0 if VX >= 0 or VY >= 0 - - - fieldUtils.setItem(scMap, "spd", String.format("%.2f", dSpeed)); -// fieldUtils.setItem(scMap, "spd_kts", String.format("%.2f", dSpeed * 0.5399570136727677)); - - // 방향 계산 - double dir = apUtils.calcDirection(iVx, iVy); - fieldUtils.setItem(scMap, "cos", String.format("%.2f", dir)); - - -/////////////////////////// test ////////////////////////////////////////////////// - - if( !(resMap.get("LAT") == null || resMap.get("LAT").equals("")) ){ - fieldUtils.setItem(scMap, "lat", resMap.get("LAT")); - fieldUtils.setItem(scMap, "lon", resMap.get("LON")); - - }else{ - fieldUtils.setItem(scMap, "lat", scMap.getLat()); - fieldUtils.setItem(scMap, "lon", scMap.getLon()); - } - - -/////////////////////////// test END ////////////////////////////////////////////////// - - - } - - private int makeResult(AsterixSpecVO_DataItem di, byte[] data, int index) { - - if(di == null || data == null || index < 0) return -1; - - int iRetIndex = -1; - - String sFrn = di.getFrn(); - int iSize = Integer.parseInt(di.getOctet()); - List st = di.getStructure(); - -// if(resultMap == null) resultMap = new LinkedHashMap(); - if(scMap == null) scMap = new ServiceAsdeData(); - - String sFormat = di.getFormat().trim(); - - if(iSize < 0) return -1; - if(data.length - index < iSize) { - iSize = data.length - index; - } - - if(di.getItemno().equals("SPF")) iRetIndex = makeResult_End(data, index); - else if(di.getRule().equals("X")) iRetIndex = makeResult_NeverSent(di, data, index, iSize); - else if(sFormat.equalsIgnoreCase("fixed")) iRetIndex = makeResult_Fixed(data, index, iSize, st); - else if(sFormat.equalsIgnoreCase("compound")) iRetIndex = makeResult_Compound(data, index, sFrn); - else if(sFormat.equalsIgnoreCase("variable")) iRetIndex = makeResult_Variable(data, index, sFrn); - else if(sFormat.equalsIgnoreCase("repetitive")) iRetIndex = makeResult_Repetitive(data, index, di); - else iRetIndex = -1; - - printLog(data, index, iRetIndex, di); - - return iRetIndex; - - } - - private int makeResult_Fixed(byte[] data, int index, int iSize, List itemStrucs) { - - int size = iSize; - - byte[] bTargetItem = new byte[size]; - - System.arraycopy(data, index, bTargetItem, 0, size); - - index += size; - - for(int i=0; i>> 8 - (frombit - tobit + 1) ; - - no = (double)number; - } - - } - else - { - - int byte_size = to_octet - from_octet; - - if(to_octet != from_octet) byte_size += 1; - bnum = new byte[byte_size]; - System.arraycopy(bTargetItem, from_octet-1, bnum, 0, byte_size); - - is_string = false; - - if(dataType.trim().equalsIgnoreCase("uint")) { - - if(bnum.length > 4) { - logger.error("[AsterixParser:makeResultFixed] bnum.length:" + bnum.length ); - }else { - no = apUtils.unsignedToInt(bnum); - } - - - } - else if(dataType.trim().equalsIgnoreCase("int")) - { -// if(bit_length < 16 && bit_length % 16 != 0) -// { -// int shift = 16 - bit_length - 1; -// bnum[0] = (byte)(bnum[0] << shift); -// bnum[0] = (byte)(bnum[0] & 0xff); -// bnum[0] = (byte)(bnum[0] >>> shift); -// bnum[0] = (byte)(bnum[0] & 0xff); -// -// } - no = apUtils.signedToInt(bnum); - } - else if(dataType.trim().equalsIgnoreCase("signbit")) - { - no = apUtils.signedToInt_withSignBit(bnum); - } - else if(dataType.trim().equalsIgnoreCase("octal")) - { - sResultValue = apUtils.makeOctal(bnum); - is_string = true; - } - else if(dataType.trim().equalsIgnoreCase("6bitschar")) - { - sResultValue = apUtils.makeICAOCode(bnum); - is_string = true; - } - else if(dataType.trim().equalsIgnoreCase("string")) - { - sResultValue = apUtils.byteArrayToString(bnum); - is_string = true; - - } - else if(dataType.trim().equalsIgnoreCase("ascii")) - { - sResultValue = apUtils.makeAscii(bnum); - is_string = true; - } - else sResultValue = ""; - } - - if(!is_string) - { - no *= Double.parseDouble(scale); - sResultValue = String.valueOf(decFormat.format(no)); - } - } - else - { - if(from_octet == to_octet) - { - int number = bTargetItem[to_octet - 1] & 0xff; -// int shift = (8*size) - frombit; -// number = number << shift; -// number = number & ( 0xff - shift ); -// number = number >>> (8 - ((size*8)-(tobit+shift))); - int from8bit = frombit%8; - if(from8bit==0) from8bit = 8; - - int shift = 8 - from8bit; - number = number << shift; - number = number & 0xff; - number = number >>> 8 - (frombit - tobit + 1) ; - - sResultValue = Integer.toString(number); - - } - else - { - - int byte_size = to_octet - from_octet; - - if(to_octet != from_octet) byte_size += 1; - bnum = new byte[byte_size]; - System.arraycopy(bTargetItem, from_octet-1, bnum, 0, byte_size); - - if(bnum.length > 4) { - logger.error("[AsterixParser:makeResultFixed2] bnum.length:" + bnum.length ); - sResultValue = ""; - }else { - no = apUtils.unsignedToInt(bnum); - sResultValue = String.valueOf(no); - } - - } - } - - resultMap.put(name, sResultValue); - if(struc.getServiceFieldName() != null) { -// logger.error("[AsterixParser:ServiceField] data:" + Arrays.toString(bTargetItem) , LogLevelType.LOG_INFO, "AllLog"); - inputServiceField(struc, sResultValue); - - } - - } - - return index; - } - - private int makeResult_Compound(byte[] data, int index, String sFrn) { - - if(sFrn.equals("14")) { - if(Arrays.toString(data).startsWith("[0, 5, 1, 32, -76, -29, 26, -94, -48, 45, 89, -17, 68, 68, 3, 92, 1, 36, -1, -1, -1, -1, 8, -28, 64, 120, 17, -43, 6, -6, 1, 0, -1")) { - String sTmp = ""; - } - - } - - try - { - String di_frn = sFrn; - int idx = 0; - Map compound_UAP = new LinkedHashMap(); - - while(true) - { - int fspec = data[index+idx] & 0xff; - if(!makeUAP_Compound(compound_UAP, idx, fspec, di_frn)) break; - ++idx; - } - - index += (idx+1); - - Iterator it = compound_UAP.keySet().iterator(); - - while(it.hasNext()) - { - int idx_after = index; - - Integer frn = it.next(); - AsterixSpecVO_DataItem _di = compound_UAP.get(frn); - index = makeResult( _di, data, index); - - printLog(data, idx_after, index, _di); - - if(index == -1) break; - } - - - } - catch(Exception e) - { - e.printStackTrace(); - logger.error("[AsterixParserUtils:makeResultCompound] Exception:" + e + "sFrn:" + sFrn + " data:[" + Arrays.toString(data) + "]"); - index = -1; - } - - return index; - } - - private int makeResult_Variable(byte[] data, int index, String sFrn) { - if(sFrn.equals("29")) { - String sTmp = ""; - } - - try - { - String di_frn = sFrn; - - Map variable_UAP = new LinkedHashMap(); - - makeUAP_Variable(variable_UAP, di_frn, data, index); - - Iterator it = variable_UAP.keySet().iterator(); - - while(it.hasNext()) - { - int idx_after = index; - - Integer frn = it.next(); - AsterixSpecVO_DataItem _di = variable_UAP.get(frn); - index = makeResult(_di, data, index); - - printLog(data, idx_after, index, _di); - - if(index == -1) break; - } - - return index; - } - catch(Exception e) - { - e.printStackTrace(); - logger.error("[AsterixParserUtils:makeResultVariable] Exception:" + e + "sFrn:" + sFrn + " data:[" + Arrays.toString(data) + "]"); - return -1; - } - } - - private int makeResult_Repetitive(byte[] data, int index, AsterixSpecVO_DataItem di) { - int di_len = Integer.parseInt(di.getOctet()); - - try - { - List st = di.getStructure(); - AsterixSpecVO_Structure s = st.get(0); - if(s == null) return index + di_len; - - int rep = data[index] & 0xff; - - ++index; -// Map result_map = new HashMap(); - di.setOctet(String.valueOf(di_len-1)); - di.setFormat("fixed"); - - for(int i=0; i 4) { - logger.error("[AsterixParserUtils:makeNeverSent] target.length:" + target.length ); - }else { - no = apUtils.signedToInt(target); - } - - - resultMap.put(di.getItemno(), String.valueOf(no)); - - // debug log 출력 - //printDataLog("NeverSent", di, map, target); - - return index; - } - - - /***************************************** Make UAP *****************************************/ - - private boolean makeUAP(Map mUAP, int idx, int fspec ) { - - // byte로 변환한 수신페킷중 3, 4, 5, 6 번째 byte를 이용하여 어떤 fspec이 포함되어 있는지 확인하고 순서에 맞게 분석용 UAP를 생성 - - if(mUAP == null) mUAP = new HashMap(); - if(idx < 0) return false; - -// logger.error("[AsterixParserUtils] UAP_" + idx + "_data:" + prtIntToCnv(fspec), LogLevelType.LOG_DEBUG, "AllLog"); - - // "& 0xff" : 8비트만 사용하기 위함 - fspec = fspec & 0xff; - - boolean extendable = false; - - // 1이면 FX(Field Extension Indicator) - if((fspec & 0x01) == 0x01) extendable = true; - - // 128(8bit, 0b10000000), 맨 앞자리부터 체크하기 위함 - int comp = 0x80; - - //UAP의 FX를 제외한 FRN 순번 체크 1~7, 8~14, 15~21, 22~28 (idx = FRN 그룹순번 1 ~ 4) - int offset = (idx * 7) + 1; - - // 8bit를 하나씩 체크하여 1인 것만 생성 - // offset => FRN 번호 - for(int i=0; i<7; i++) - { - if((fspec & comp) == comp) mUAP.put(new Integer(offset), apUtils.findAsterixDataItem(offset, currentSpec)); - - // 8번째자리 -> 7번째자리 -> 6번째자리 -> ... -> 1번째 자리 - comp = comp >>> 1; - ++offset; - } - - return extendable; - - } - - private boolean makeUAP_Compound(Map mUAP, int idx, int fspec, String frn) { - if(mUAP == null) mUAP = new HashMap(); - if(idx < 0) return false; - - fspec = fspec & 0xff; - - boolean extendable = false; - if((fspec & 0x01) == 0x01) extendable = true; - - int comp = 0x80; - - int offset = (idx * 7) + 1; - - for(int i=0; i<7; i++) - { - if(((fspec & comp) == comp) ) - { - String key = frn + apUtils.zeroPadding2digitAtFront(offset); - mUAP.put(new Integer(key), apUtils.findAsterixDataItem(Integer.parseInt(key), currentSpec)); - } - comp = comp >>> 1; - ++offset; - } - - return extendable; - - } - - private void makeUAP_Variable(Map mUAP, String di_frn, byte[] data, int index) { - if(mUAP == null) mUAP = new HashMap(); - - int comp = 0x01; - int offset = 1; - int idx = index; - - while(true) - { - try - { - String key = di_frn + apUtils.zeroPadding2digitAtFront(offset); - - AsterixSpecVO_DataItem di = apUtils.findAsterixDataItem(Integer.parseInt(key), currentSpec); - if(di == null) { - key = di_frn + apUtils.zeroPadding2digitAtFront(1); - di = apUtils.findAsterixDataItem(Integer.parseInt(key), currentSpec); - } - if(di == null) break; - - mUAP.put(new Integer(key), di); - - int data_length = Integer.parseInt(di.getOctet()); - idx = idx + data_length; - int next = data[idx-1] & 0xff; - - if((next & comp) != comp) break; - ++offset; - } - catch(Exception e) - { - break; - } - } - } - - - /***************************************** Service Field *****************************************/ - - public void inputServiceField(AsterixSpecVO_Structure struc, String sValue) { - - LinkedHashMap _resultMap = resultMap ; - String sServiceName = struc.getServiceFieldName(); -// ServiceAsdeData _scMap = scMap ; - - fieldUtils.setItem(scMap, sServiceName, sValue.trim()); - - return; - - // 위경도 -// if(sServiceName.equals("lon")) { -// -// double dX = apUtils.parseDoubleDef(_resultMap.get("X-COMPONENT")); -// double dY = apUtils.parseDoubleDef(_resultMap.get("Y-COMPONENT")); -// double dDistNM = 1; -// double dAzimuth = 0; -// -// // 위경도(x,y)값 둘다 있는 경우만 수행 -// if(dX == 0 || dY == 0) return ; -// -// dDistNM = Math.sqrt(dX * dX + dY * dY) / 1852.0; // m >> NM -// dAzimuth = apUtils.calcAngleDegree(0, 0, dX, dY); -// -// Map posMap; -// -// posMap = apUtils.calcDistanceAzimuth(apUtils.CONST_BASE_LAT, apUtils.CONST_BASE_LON, dDistNM, dAzimuth); -// -// scMap.setLat(String.format("%.14f", posMap.get("lat"))); -// scMap.setLon(String.format("%.14f", posMap.get("lon"))); -// scMap.setCos(String.format("%.2f", dAzimuth)); -// -// -// } -// // 위경도 추가정보 -// else if(sServiceName.equals("lon_add")) { -// -// int iXm = apUtils.parseIntDef(_resultMap.get("XM")); -// int iYm = apUtils.parseIntDef(_resultMap.get("YM")); -// double dX = apUtils.parseDoubleDef(_resultMap.get("X-COMPONENT")); -// double dY = apUtils.parseDoubleDef(_resultMap.get("Y-COMPONENT")); -// -// // x,y둘다 0이면 스킵 -// if(iXm == 0 && iYm == 0) return ; -// -// if (iXm == 1) { -// if(dX > 0) dX = dX + apUtils.parseIntDef( struc.getMax() ); // + 8191 -// else if(dX < 0) dX = dX - apUtils.parseIntDef( struc.getMax() ); // - 8191 -// else dX = 0; -// } -// -// if (iYm == 1) { -// if(dY > 0) dY = dY + apUtils.parseIntDef( struc.getMax() ); // + 8191 -// else if(dY < 0) dY = dY - apUtils.parseIntDef( struc.getMax() ); // - 8191 -// else dY = 0; -// } -// -// // 위경도(x,y)값 둘다 있는 경우만 수행 -// if(dX == 0 || dY == 0) return ; -// -// double dDistNM = Math.sqrt(dX * dX + dY * dY) / 1852.0; // m >> NM -// double dAzimuth = apUtils.calcAngleDegree(0, 0, dX, dY); -// -// Map posMap; -// -// posMap = apUtils.calcDistanceAzimuth(apUtils.CONST_BASE_LAT, apUtils.CONST_BASE_LON, dDistNM, dAzimuth); -// -// scMap.setLat(posMap.get("lat").toString()); -// scMap.setLon(posMap.get("lon").toString()); -// scMap.setCos(String.format("%.2f", dAzimuth)); -// -// } -// // 속도 -// else if(sServiceName.equals("spd")) { -// -// double iVx = apUtils.parseDoubleDef(_resultMap.get("VX")); -// double iVy = apUtils.parseDoubleDef(_resultMap.get("VY")); -// double dSpeed; -// -// // 속도 x,y 둘다 0이면 스킵 -// if(iVx == 0 && iVy == 0) return ; -// -// if ((iVx != 0) && (iVy != 0)) { -// -// dSpeed = Math.sqrt(Math.pow(iVx, 2) + Math.pow(iVy, 2)); -// } -// else if ((iVx == 0) && (iVy != 0)) -// dSpeed = Math.sqrt(Math.pow(iVy, 2)); -// else if ((iVx != 0) && (iVy == 0)) -// dSpeed = Math.sqrt(Math.pow(iVx, 2)); -// else -// dSpeed = 0; -// -// dSpeed = dSpeed * 3.6; // m/s >> km/h -// -// fieldUtils.setItem(scMap, sServiceName, String.format("%.2f", dSpeed)); -// } -// else { -// fieldUtils.setItem(scMap, sServiceName, sValue.trim()); -// } - - - - } - - private void printLog(byte[] logdata, int sidx, int tidx, AsterixSpecVO_DataItem di) { - - if(!execMode.equals("debug")) return; - - int iSize = tidx - sidx; - - if(iSize <= 0) return ; - - // log - byte[] bLogByte = new byte[tidx - sidx]; - System.arraycopy(logdata, sidx, bLogByte, 0, tidx - sidx); - - String sLotTxt = ""; - if(di.getStructure() == null) return; - - sLotTxt = di.getItemno().concat(" : ") - .concat(apUtils.prtStrucItems(di.getStructure(), resultMap)).concat(" ") - .concat(apUtils.cnvBytesToHex(bLogByte)).concat(" ") - .concat(Arrays.toString(bLogByte)).concat(" ") ; - - - logger.debug("[AsterixParser:makeResult] parser_Log [" + sLotTxt + "]"); - } - - -} +package kr.gmtc.gw.dev.asderecv.asde.asterix; + +import kr.gmtc.gw.dev.asderecv.asde.asterix.spec.*; +import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; +import kr.gmtc.gw.dev.asderecv.asde.utils.AsdeUtil; +import kr.gmtc.gw.dev.asderecv.asde.utils.FieldNameReflectionUtils; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import java.text.DecimalFormat; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; + + +public class AsterixParser { + + private Logger logger; + + private AsterixSpec asterixSpec; + + private List serviceMap; + private AsterixSpecVO currentSpec; + + private LinkedHashMap resultMap ; + private ServiceAsdeData scMap ; + + private AsterixParserUtils apUtils = new AsterixParserUtils(); + private FieldNameReflectionUtils fieldUtils = new FieldNameReflectionUtils(); + + private DecimalFormat decFormat = new DecimalFormat("#.#########"); + + private String execMode; + + /***************************************** Constructor & Main Method *****************************************/ + + public AsterixParser() + { + initParser(); + } + + public AsterixParser( List serviceMap, String execMode ) { + + initParser(); + this.serviceMap = serviceMap; + this.execMode = execMode; + + } + + private void initParser() { + + asterixSpec = new AsterixSpec(); + apUtils = new AsterixParserUtils(); + logger = LoggerFactory.getLogger(AsterixParser.class); + + } + + public List> parse(byte[] data, String sRecvTime) { + String sCatNo = null; + try + { + if(data.length < 5) return null; + + // 바이트 값을 16진수(0xff, 255)와 비트연산하여 정수로 변환 + sCatNo = String.valueOf(data[0] & 0xff); + + // 데이터부의 category와 일치하는 스펙 가져오기 + currentSpec = asterixSpec.getSpec(sCatNo); + + if(currentSpec == null ) { + logger.error("[AsterixParser] Asterix Spec이 정의되어 있지 않음. [수신메시지의 category:" + sCatNo + "]"); + return null; + }else { + if (currentSpec.getDataitem().isEmpty()) { + logger.error("[AsterixParser] Asterix Spec yml파일에 구문 오류가 있음. [수신메시지의 category:" + sCatNo + "]"); + } + } + + // 데이터 블럭의 분석 결과 + List> result_list = new ArrayList>(); + + // 수신받은 데이터 총길이 + int total_len = data.length; + + // 데이터블럭 사이즈 (데이터 블럭(1) : 데이터 패킷(N)) + byte[] blSize = new byte[2]; + + // 분석 처리 대상 블럭 + byte[] blockData = null; + + // 한번에 여러개의 블럭을 수신 받은경우 반복하여 처리 하기위한 블럭단위 초기 인덱스 + // 1개 블럭의 마지막 인덱스를 저장 + int index = 0; + + // 데이터 블록에 정의되어 있는 총 길이 만큼 잘라서 분석하고 (real_data) + // 남아 있는 데이터가 있다면 새로운 데이터블록이므로 반복하여 처리 + while(total_len > index) + { +// int iCatNo = data[index] & 0xff; + + // 데이터 블록의 총 길이(2옥텟) + blSize[0] = data[index+1]; + blSize[1] = data[index+2]; + + int iDataBlockSize = apUtils.unsignedToInt(blSize); + int iBlockStartPos = 3; + +// logger.error("[AsterixParser:parse] 수신 데이터 총 길이:" + total_len + " / 분석대상 블록 길이" + iDataBlockSize, LogLevelType.LOG_DEBUG, "AllLog"); + + if(iDataBlockSize <= 0) return result_list; + + // 데이터 블록의 총 길이만큼 초기화 + blockData = new byte[iDataBlockSize]; + + try + { + if((index+iDataBlockSize) > total_len) iDataBlockSize = total_len-index; + + /* System.arraycopy(src, srcPos, dest, destPos, length); + src - 원본 배열 + srcPos - 원본 배열의 복사 시작 위치 + dest - 복사할 배열 + destPost - 복사할 배열의 복사 시작 위치 + length - 복사할 요소의 개수 + * */ + System.arraycopy(data, index + iBlockStartPos, blockData, 0, iDataBlockSize - iBlockStartPos); + + List> list = parseOneBlock(blockData, sRecvTime); + + if(list != null) result_list.addAll(list); + } + catch(Exception e) + { + e.printStackTrace(); + logger.error("[AsterixParser:parse] Exception:" + AsdeUtil.getStatckTrace(e)); + return result_list; + } + + index += iDataBlockSize; + } + + return result_list; + + } + catch(Exception e) + { + logger.error("[AsterixParser] 수신메시지 분석 실패 [CAT " + sCatNo + "]"); + return null; + } + } + + + private List> parseOneBlock(byte[] blockData, String sRecvTime) throws Exception { + + int body_len = blockData.length; + + List> result = new ArrayList>(); + + Map mapUAP; + + int index = 0; + int index_before = 0, parserCnt = 0; + int idx; + + while(index < body_len-1) + { + + int to_read = body_len - index; + mapUAP = new LinkedHashMap(); + + // UAP 체크 + for(idx=0; idx it = mapUAP.keySet().iterator(); + scMap = new ServiceAsdeData(); + + // 카테고리유형 셋팅 + fieldUtils.setItem(scMap, "cat_ty", currentSpec.getCat()); + + //수신시각 셋팅 + fieldUtils.setItem(scMap, "recptn_dt", sRecvTime); + + int result_index = 0; + resultMap = new LinkedHashMap(); + while(it.hasNext()) + { + + Integer frn = it.next(); + AsterixSpecVO_DataItem di = mapUAP.get(frn); + if(di == null) continue; + + //resultMap = new LinkedHashMap(); + result_index = makeResult(di, byteRecodeData, result_index); + if(result_index < 0) break; + + } + + if(resultMap != null && resultMap.size() > 0) + { + result.add(resultMap); + + // 서비스용 map에 적재하되 식별자가 없는 데이터는 스킵 + // key 값으로 사용할 수 있는 필드에 값이 있는 경우만 + if( scMap.filterSvcData() ) { + testScvMap(resultMap); + serviceMap.add(scMap); + } + + } + + parserCnt ++; + index_before = index; + + index = index + iUAPoffset + result_index; + + // log + byte[] bLogByte = new byte[index - index_before]; + System.arraycopy(blockData, index_before, bLogByte, 0, index - index_before); +// logger.error("[AsterixParser:parseOneBlock] packet [CNT :" + parserCnt + ", Hex Data :" + apUtils.cnvBytesToHex(bLogByte) + "]", LogLevelType.LOG_DEBUG, "AllLog"); + + if(result_index < 0) break; + + } + + return result; + } + + /***************************************** Make Result *****************************************/ + + private void testScvMap(LinkedHashMap resMap) { + + double dX = apUtils.parseDoubleDef(resMap.get("X-COMPONENT")); + double dY = apUtils.parseDoubleDef(resMap.get("Y-COMPONENT")); + int iXm = apUtils.parseIntDef(resMap.get("XM")); + int iYm = apUtils.parseIntDef(resMap.get("YM")); + double iVx = apUtils.parseDoubleDef(resMap.get("VX")); + double iVy = apUtils.parseDoubleDef(resMap.get("VY")); + double dDistNM = 1; + double dAzimuth = 0; + double dSpeed; + int iMax = 8191; + + Map posMap; + + // 위경도 변환 (x,y -> wgs84) + if(dX != 0 || dY != 0) { + if( !(iXm == 0 && iYm == 0) ){ + + if (iXm == 1) { + if(dX > 0) dX = dX + iMax; + else if(dX < 0) dX = dX - iMax; + else dX = 0; + } + + if (iYm == 1) { + if(dY > 0) dY = dY + iMax; + else if(dY < 0) dY = dY - iMax; + else dY = 0; + } + + } + + dDistNM = Math.sqrt(dX * dX + dY * dY) / 1852.0; // m >> NM + dAzimuth = apUtils.calcAngleDegree(0, 0, dX, dY); + + posMap = apUtils.calcDistanceAzimuth(apUtils.CONST_BASE_LAT, apUtils.CONST_BASE_LON, dDistNM, dAzimuth); + + scMap.setLat(String.format("%.14f", posMap.get("lat"))); + scMap.setLon(String.format("%.14f", posMap.get("lon"))); + //scMap.setCos(String.format("%.2f", dAzimuth)); + } + + // 속도 계산 +// if(resMap.get("cat_ty").equals("11")){ +// dSpeed = Math.sqrt(Math.pow(iVx, 2) + Math.pow(iVy, 2)); +// } +// else if(resMap.get("cat_ty").equals("10")){ +// +// ) + dSpeed = Math.sqrt(Math.pow(iVx, 2) + Math.pow(iVy, 2)); + + + dSpeed = dSpeed * 3.6; // m/s >> km/h + + //SX(Vx, 16) = 0 or SY(Vy, 8) = 0 if VX >= 0 or VY >= 0 + + + fieldUtils.setItem(scMap, "spd", String.format("%.2f", dSpeed)); +// fieldUtils.setItem(scMap, "spd_kts", String.format("%.2f", dSpeed * 0.5399570136727677)); + + // 방향 계산 + double dir = apUtils.calcDirection(iVx, iVy); + fieldUtils.setItem(scMap, "cos", String.format("%.2f", dir)); + + +/////////////////////////// test ////////////////////////////////////////////////// + + if( !(resMap.get("LAT") == null || resMap.get("LAT").equals("")) ){ + fieldUtils.setItem(scMap, "lat", resMap.get("LAT")); + fieldUtils.setItem(scMap, "lon", resMap.get("LON")); + + }else{ + fieldUtils.setItem(scMap, "lat", scMap.getLat()); + fieldUtils.setItem(scMap, "lon", scMap.getLon()); + } + + +/////////////////////////// test END ////////////////////////////////////////////////// + + + } + + private int makeResult(AsterixSpecVO_DataItem di, byte[] data, int index) { + + if(di == null || data == null || index < 0) return -1; + + int iRetIndex = -1; + + String sFrn = di.getFrn(); + int iSize = Integer.parseInt(di.getOctet()); + List st = di.getStructure(); + +// if(resultMap == null) resultMap = new LinkedHashMap(); + if(scMap == null) scMap = new ServiceAsdeData(); + + String sFormat = di.getFormat().trim(); + + if(iSize < 0) return -1; + if(data.length - index < iSize) { + iSize = data.length - index; + } + + if(di.getItemno().equals("SPF")) iRetIndex = makeResult_End(data, index); + else if(di.getRule().equals("X")) iRetIndex = makeResult_NeverSent(di, data, index, iSize); + else if(sFormat.equalsIgnoreCase("fixed")) iRetIndex = makeResult_Fixed(data, index, iSize, st); + else if(sFormat.equalsIgnoreCase("compound")) iRetIndex = makeResult_Compound(data, index, sFrn); + else if(sFormat.equalsIgnoreCase("variable")) iRetIndex = makeResult_Variable(data, index, sFrn); + else if(sFormat.equalsIgnoreCase("repetitive")) iRetIndex = makeResult_Repetitive(data, index, di); + else iRetIndex = -1; + + printLog(data, index, iRetIndex, di); + + return iRetIndex; + + } + + private int makeResult_Fixed(byte[] data, int index, int iSize, List itemStrucs) { + + int size = iSize; + + byte[] bTargetItem = new byte[size]; + + System.arraycopy(data, index, bTargetItem, 0, size); + + index += size; + + for(int i=0; i>> 8 - (frombit - tobit + 1) ; + + no = (double)number; + } + + } + else + { + + int byte_size = to_octet - from_octet; + + if(to_octet != from_octet) byte_size += 1; + bnum = new byte[byte_size]; + System.arraycopy(bTargetItem, from_octet-1, bnum, 0, byte_size); + + is_string = false; + + if(dataType.trim().equalsIgnoreCase("uint")) { + + if(bnum.length > 4) { + logger.error("[AsterixParser:makeResultFixed] bnum.length:" + bnum.length ); + }else { + no = apUtils.unsignedToInt(bnum); + } + + + } + else if(dataType.trim().equalsIgnoreCase("int")) + { +// if(bit_length < 16 && bit_length % 16 != 0) +// { +// int shift = 16 - bit_length - 1; +// bnum[0] = (byte)(bnum[0] << shift); +// bnum[0] = (byte)(bnum[0] & 0xff); +// bnum[0] = (byte)(bnum[0] >>> shift); +// bnum[0] = (byte)(bnum[0] & 0xff); +// +// } + no = apUtils.signedToInt(bnum); + } + else if(dataType.trim().equalsIgnoreCase("signbit")) + { + no = apUtils.signedToInt_withSignBit(bnum); + } + else if(dataType.trim().equalsIgnoreCase("octal")) + { + sResultValue = apUtils.makeOctal(bnum); + is_string = true; + } + else if(dataType.trim().equalsIgnoreCase("6bitschar")) + { + sResultValue = apUtils.makeICAOCode(bnum); + is_string = true; + } + else if(dataType.trim().equalsIgnoreCase("string")) + { + sResultValue = apUtils.byteArrayToString(bnum); + is_string = true; + + } + else if(dataType.trim().equalsIgnoreCase("ascii")) + { + sResultValue = apUtils.makeAscii(bnum); + is_string = true; + } + else sResultValue = ""; + } + + if(!is_string) + { + no *= Double.parseDouble(scale); + sResultValue = String.valueOf(decFormat.format(no)); + } + } + else + { + if(from_octet == to_octet) + { + int number = bTargetItem[to_octet - 1] & 0xff; +// int shift = (8*size) - frombit; +// number = number << shift; +// number = number & ( 0xff - shift ); +// number = number >>> (8 - ((size*8)-(tobit+shift))); + int from8bit = frombit%8; + if(from8bit==0) from8bit = 8; + + int shift = 8 - from8bit; + number = number << shift; + number = number & 0xff; + number = number >>> 8 - (frombit - tobit + 1) ; + + sResultValue = Integer.toString(number); + + } + else + { + + int byte_size = to_octet - from_octet; + + if(to_octet != from_octet) byte_size += 1; + bnum = new byte[byte_size]; + System.arraycopy(bTargetItem, from_octet-1, bnum, 0, byte_size); + + if(bnum.length > 4) { + logger.error("[AsterixParser:makeResultFixed2] bnum.length:" + bnum.length ); + sResultValue = ""; + }else { + no = apUtils.unsignedToInt(bnum); + sResultValue = String.valueOf(no); + } + + } + } + + resultMap.put(name, sResultValue); + if(struc.getServiceFieldName() != null) { +// logger.error("[AsterixParser:ServiceField] data:" + Arrays.toString(bTargetItem) , LogLevelType.LOG_INFO, "AllLog"); + inputServiceField(struc, sResultValue); + + } + + } + + return index; + } + + private int makeResult_Compound(byte[] data, int index, String sFrn) { + + if(sFrn.equals("14")) { + if(Arrays.toString(data).startsWith("[0, 5, 1, 32, -76, -29, 26, -94, -48, 45, 89, -17, 68, 68, 3, 92, 1, 36, -1, -1, -1, -1, 8, -28, 64, 120, 17, -43, 6, -6, 1, 0, -1")) { + String sTmp = ""; + } + + } + + try + { + String di_frn = sFrn; + int idx = 0; + Map compound_UAP = new LinkedHashMap(); + + while(true) + { + int fspec = data[index+idx] & 0xff; + if(!makeUAP_Compound(compound_UAP, idx, fspec, di_frn)) break; + ++idx; + } + + index += (idx+1); + + Iterator it = compound_UAP.keySet().iterator(); + + while(it.hasNext()) + { + int idx_after = index; + + Integer frn = it.next(); + AsterixSpecVO_DataItem _di = compound_UAP.get(frn); + index = makeResult( _di, data, index); + + printLog(data, idx_after, index, _di); + + if(index == -1) break; + } + + + } + catch(Exception e) + { + e.printStackTrace(); + logger.error("[AsterixParserUtils:makeResultCompound] Exception:" + e + "sFrn:" + sFrn + " data:[" + Arrays.toString(data) + "]"); + index = -1; + } + + return index; + } + + private int makeResult_Variable(byte[] data, int index, String sFrn) { + if(sFrn.equals("29")) { + String sTmp = ""; + } + + try + { + String di_frn = sFrn; + + Map variable_UAP = new LinkedHashMap(); + + makeUAP_Variable(variable_UAP, di_frn, data, index); + + Iterator it = variable_UAP.keySet().iterator(); + + while(it.hasNext()) + { + int idx_after = index; + + Integer frn = it.next(); + AsterixSpecVO_DataItem _di = variable_UAP.get(frn); + index = makeResult(_di, data, index); + + printLog(data, idx_after, index, _di); + + if(index == -1) break; + } + + return index; + } + catch(Exception e) + { + e.printStackTrace(); + logger.error("[AsterixParserUtils:makeResultVariable] Exception:" + e + "sFrn:" + sFrn + " data:[" + Arrays.toString(data) + "]"); + return -1; + } + } + + private int makeResult_Repetitive(byte[] data, int index, AsterixSpecVO_DataItem di) { + int di_len = Integer.parseInt(di.getOctet()); + + try + { + List st = di.getStructure(); + AsterixSpecVO_Structure s = st.get(0); + if(s == null) return index + di_len; + + int rep = data[index] & 0xff; + + ++index; +// Map result_map = new HashMap(); + di.setOctet(String.valueOf(di_len-1)); + di.setFormat("fixed"); + + for(int i=0; i 4) { + logger.error("[AsterixParserUtils:makeNeverSent] target.length:" + target.length ); + }else { + no = apUtils.signedToInt(target); + } + + + resultMap.put(di.getItemno(), String.valueOf(no)); + + // debug log 출력 + //printDataLog("NeverSent", di, map, target); + + return index; + } + + + /***************************************** Make UAP *****************************************/ + + private boolean makeUAP(Map mUAP, int idx, int fspec ) { + + // byte로 변환한 수신페킷중 3, 4, 5, 6 번째 byte를 이용하여 어떤 fspec이 포함되어 있는지 확인하고 순서에 맞게 분석용 UAP를 생성 + + if(mUAP == null) mUAP = new HashMap(); + if(idx < 0) return false; + +// logger.error("[AsterixParserUtils] UAP_" + idx + "_data:" + prtIntToCnv(fspec), LogLevelType.LOG_DEBUG, "AllLog"); + + // "& 0xff" : 8비트만 사용하기 위함 + fspec = fspec & 0xff; + + boolean extendable = false; + + // 1이면 FX(Field Extension Indicator) + if((fspec & 0x01) == 0x01) extendable = true; + + // 128(8bit, 0b10000000), 맨 앞자리부터 체크하기 위함 + int comp = 0x80; + + //UAP의 FX를 제외한 FRN 순번 체크 1~7, 8~14, 15~21, 22~28 (idx = FRN 그룹순번 1 ~ 4) + int offset = (idx * 7) + 1; + + // 8bit를 하나씩 체크하여 1인 것만 생성 + // offset => FRN 번호 + for(int i=0; i<7; i++) + { + if((fspec & comp) == comp) mUAP.put(new Integer(offset), apUtils.findAsterixDataItem(offset, currentSpec)); + + // 8번째자리 -> 7번째자리 -> 6번째자리 -> ... -> 1번째 자리 + comp = comp >>> 1; + ++offset; + } + + return extendable; + + } + + private boolean makeUAP_Compound(Map mUAP, int idx, int fspec, String frn) { + if(mUAP == null) mUAP = new HashMap(); + if(idx < 0) return false; + + fspec = fspec & 0xff; + + boolean extendable = false; + if((fspec & 0x01) == 0x01) extendable = true; + + int comp = 0x80; + + int offset = (idx * 7) + 1; + + for(int i=0; i<7; i++) + { + if(((fspec & comp) == comp) ) + { + String key = frn + apUtils.zeroPadding2digitAtFront(offset); + mUAP.put(new Integer(key), apUtils.findAsterixDataItem(Integer.parseInt(key), currentSpec)); + } + comp = comp >>> 1; + ++offset; + } + + return extendable; + + } + + private void makeUAP_Variable(Map mUAP, String di_frn, byte[] data, int index) { + if(mUAP == null) mUAP = new HashMap(); + + int comp = 0x01; + int offset = 1; + int idx = index; + + while(true) + { + try + { + String key = di_frn + apUtils.zeroPadding2digitAtFront(offset); + + AsterixSpecVO_DataItem di = apUtils.findAsterixDataItem(Integer.parseInt(key), currentSpec); + if(di == null) { + key = di_frn + apUtils.zeroPadding2digitAtFront(1); + di = apUtils.findAsterixDataItem(Integer.parseInt(key), currentSpec); + } + if(di == null) break; + + mUAP.put(new Integer(key), di); + + int data_length = Integer.parseInt(di.getOctet()); + idx = idx + data_length; + int next = data[idx-1] & 0xff; + + if((next & comp) != comp) break; + ++offset; + } + catch(Exception e) + { + break; + } + } + } + + + /***************************************** Service Field *****************************************/ + + public void inputServiceField(AsterixSpecVO_Structure struc, String sValue) { + + LinkedHashMap _resultMap = resultMap ; + String sServiceName = struc.getServiceFieldName(); +// ServiceAsdeData _scMap = scMap ; + + fieldUtils.setItem(scMap, sServiceName, sValue.trim()); + + return; + + // 위경도 +// if(sServiceName.equals("lon")) { +// +// double dX = apUtils.parseDoubleDef(_resultMap.get("X-COMPONENT")); +// double dY = apUtils.parseDoubleDef(_resultMap.get("Y-COMPONENT")); +// double dDistNM = 1; +// double dAzimuth = 0; +// +// // 위경도(x,y)값 둘다 있는 경우만 수행 +// if(dX == 0 || dY == 0) return ; +// +// dDistNM = Math.sqrt(dX * dX + dY * dY) / 1852.0; // m >> NM +// dAzimuth = apUtils.calcAngleDegree(0, 0, dX, dY); +// +// Map posMap; +// +// posMap = apUtils.calcDistanceAzimuth(apUtils.CONST_BASE_LAT, apUtils.CONST_BASE_LON, dDistNM, dAzimuth); +// +// scMap.setLat(String.format("%.14f", posMap.get("lat"))); +// scMap.setLon(String.format("%.14f", posMap.get("lon"))); +// scMap.setCos(String.format("%.2f", dAzimuth)); +// +// +// } +// // 위경도 추가정보 +// else if(sServiceName.equals("lon_add")) { +// +// int iXm = apUtils.parseIntDef(_resultMap.get("XM")); +// int iYm = apUtils.parseIntDef(_resultMap.get("YM")); +// double dX = apUtils.parseDoubleDef(_resultMap.get("X-COMPONENT")); +// double dY = apUtils.parseDoubleDef(_resultMap.get("Y-COMPONENT")); +// +// // x,y둘다 0이면 스킵 +// if(iXm == 0 && iYm == 0) return ; +// +// if (iXm == 1) { +// if(dX > 0) dX = dX + apUtils.parseIntDef( struc.getMax() ); // + 8191 +// else if(dX < 0) dX = dX - apUtils.parseIntDef( struc.getMax() ); // - 8191 +// else dX = 0; +// } +// +// if (iYm == 1) { +// if(dY > 0) dY = dY + apUtils.parseIntDef( struc.getMax() ); // + 8191 +// else if(dY < 0) dY = dY - apUtils.parseIntDef( struc.getMax() ); // - 8191 +// else dY = 0; +// } +// +// // 위경도(x,y)값 둘다 있는 경우만 수행 +// if(dX == 0 || dY == 0) return ; +// +// double dDistNM = Math.sqrt(dX * dX + dY * dY) / 1852.0; // m >> NM +// double dAzimuth = apUtils.calcAngleDegree(0, 0, dX, dY); +// +// Map posMap; +// +// posMap = apUtils.calcDistanceAzimuth(apUtils.CONST_BASE_LAT, apUtils.CONST_BASE_LON, dDistNM, dAzimuth); +// +// scMap.setLat(posMap.get("lat").toString()); +// scMap.setLon(posMap.get("lon").toString()); +// scMap.setCos(String.format("%.2f", dAzimuth)); +// +// } +// // 속도 +// else if(sServiceName.equals("spd")) { +// +// double iVx = apUtils.parseDoubleDef(_resultMap.get("VX")); +// double iVy = apUtils.parseDoubleDef(_resultMap.get("VY")); +// double dSpeed; +// +// // 속도 x,y 둘다 0이면 스킵 +// if(iVx == 0 && iVy == 0) return ; +// +// if ((iVx != 0) && (iVy != 0)) { +// +// dSpeed = Math.sqrt(Math.pow(iVx, 2) + Math.pow(iVy, 2)); +// } +// else if ((iVx == 0) && (iVy != 0)) +// dSpeed = Math.sqrt(Math.pow(iVy, 2)); +// else if ((iVx != 0) && (iVy == 0)) +// dSpeed = Math.sqrt(Math.pow(iVx, 2)); +// else +// dSpeed = 0; +// +// dSpeed = dSpeed * 3.6; // m/s >> km/h +// +// fieldUtils.setItem(scMap, sServiceName, String.format("%.2f", dSpeed)); +// } +// else { +// fieldUtils.setItem(scMap, sServiceName, sValue.trim()); +// } + + + + } + + private void printLog(byte[] logdata, int sidx, int tidx, AsterixSpecVO_DataItem di) { + + if(!execMode.equals("debug")) return; + + int iSize = tidx - sidx; + + if(iSize <= 0) return ; + + // log + byte[] bLogByte = new byte[tidx - sidx]; + System.arraycopy(logdata, sidx, bLogByte, 0, tidx - sidx); + + String sLotTxt = ""; + if(di.getStructure() == null) return; + + sLotTxt = di.getItemno().concat(" : ") + .concat(apUtils.prtStrucItems(di.getStructure(), resultMap)).concat(" ") + .concat(apUtils.cnvBytesToHex(bLogByte)).concat(" ") + .concat(Arrays.toString(bLogByte)).concat(" ") ; + + + logger.debug("[AsterixParser:makeResult] parser_Log [" + sLotTxt + "]"); + } + + +} diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/AsterixParserThread.java b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/AsterixParserThread.java index 637357d..3c4f65a 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/AsterixParserThread.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/AsterixParserThread.java @@ -1,146 +1,146 @@ -package kr.gmtc.gw.dev.asderecv.asde.asterix; - -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.HashMap; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Queue; - -import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; -import kr.gmtc.gw.dev.asderecv.asde.utils.AsdeUtil; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.stereotype.Component; - -import com.fasterxml.jackson.databind.ObjectMapper; - - -@Component("asterixParserThread") -public class AsterixParserThread { - -// @Autowired - private AsterixParser asterixParser; - -// @Autowired -// private FMDecoder fmDecoder; -// - - private Logger logger = LoggerFactory.getLogger(AsterixParserThread.class); - - private boolean isRunning = true; - private Thread thread; - private int processCount = 0; - private int MAX_PROCESS_COUNT = 100; - - @Value("${asde.service.queueCount}") - private Integer scvQcount; - - @Value("${spring.profiles.active}") - private String execMode; - - List serviceMap; - - ObjectMapper mapper; - - DateTimeFormatter dfPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); - - int recvCnt; - - public AsterixParserThread(Queue packetQ, HashMap> sendQueue) { - thread = new Thread(new Runnable() { - @Override - public void run() { - while (isRunning) { - String packetMsg = ""; - try { - packetMsg = packetQ.poll(); - - if (packetMsg != null) { - - // 테스트용 - //String sBynary = "0A 05 BB E3 81 F1 91 03 8A 06 04 98 3C 00 C1 D9 F5 28 0E 72 45 54 48 33 36 36 37 20 04 01 68 45 54 41 57 45 20 20 20 02 8D 36 34 39 20 00 33 34 52 0B 8F 08 EB 81 71 01 03 02 06 04 98 41 00 D3 95 20 50 08 06 E8 41 46 4C 36 20 20 20 20 71 D1 48 53 49 41 31 34 38 20 20 08 20 EB 81 01 01 03 02 06 04 98 3D C1 CF 75 18 D7 01 00 E0 02 E0 EB 81 71 01 03 02 06 04 98 40 C1 EA EC E5 80 00 00 E8 46 49 52 45 35 20 20 20 71 D1 08 53 49 41 31 30 38 20 20 08 20 EB 81 01 01 03 02 06 04 98 3C 45 E9 6B EC FB 00 00 E0 02 E0 E3 81 81 81 03 02 06 04 98 3F C5 A3 C8 F1 38 06 03 02 AC 00 20 E3 81 81 81 03 02 06 04 98 41 05 46 90 F1 38 06 02 02 6A 00 20 EB 81 F1 91 03 8A 06 04 98 3E 46 E3 86 26 F7 F9 FB F2 07 E3 54 57 42 32 39 32 20 20 71 C3 24 48 4C 38 33 32 34 20 20 3F FE 31 32 39 20 02 33 33 52 04 A7 08 EB 81 F1 11 03 0A 06 04 98 3F 86 D5 73 10 DC FF 00 F8 04 00 4B 41 53 38 20 20 20 20 71 C2 12 48 4C 38 32 31 32 20 20 35 34 36 20 02 04 9A 08 EB 81 01 01 03 02 06 04 98 40 07 CB 78 28 01 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 3C CB D6 2D 0F 8A 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 3B 8E D3 69 14 D5 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 30 51 E8 81 14 CC 00 00 E0 00 E0 EB 81 F1 91 03 8A 06 04 98 3E 12 DA FA 58 54 A1 07 F5 20 08 CF 4B 41 4C 35 35 31 20 20 71 BE 01 48 4C 37 36 30 31 20 20 00 6C 36 30 39 20 00 33 34 52 06 A5 08 E3 81 F1 91 03 8A 06 04 98 3C 14 E4 E6 F5 28 0E 73 41 49 48 32 32 31 20 20 71 C5 03 48 4C 38 35 30 33 20 20 02 73 36 31 36 20 00 33 34 52 05 B4 08 EB 81 F1 91 03 8A 06 04 98 3E 14 D1 26 0E 46 03 02 F2 09 1B 43 53 4E 33 30 36 31 20 78 1D AC 42 33 32 39 53 20 20 20 3F FE 31 32 34 20 02 33 34 4C 04 A6 08 EB 81 01 01 03 02 06 04 98 42 D8 CC 92 18 B2 00 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 35 98 DE 2A 14 0B 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 3E DA 0B 2E 16 DE FF 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 40 9A DE FC 21 72 00 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 27 5C D3 D8 32 98 00 00 E0 00 E0 EB 81 F1 91 03 8A 06 04 98 3E 9C D4 72 FA 1A E4 27 F2 07 A8 4B 41 4C 37 35 36 20 20 71 C2 76 48 4C 38 32 37 36 20 20 3F FD 32 34 36 20 02 33 34 4C 04 A8 08 EB 81 01 01 03 02 06 04 98 3F A0 EC 22 01 A7 00 00 E0 02 E0 EB 81 F1 91 83 8A 06 04 98 3E A1 2A 7C CF 65 D6 3B F2 06 BD 4A 4E 41 32 38 32 20 20 71 BF 57 48 4C 37 37 35 37 20 20 00 1D 32 30 20 20 80 71 33 33 52 00 33 33 52 04 A9 08 EB 81 F1 91 03 8A 06 04 98 40 22 05 38 14 50 FC FD F4 0E 70 47 45 43 38 33 39 31 20 3C 70 C9 44 41 4C 46 49 20 20 20 3F FF 36 33 33 20 02 33 34 52 04 23 08 EB 81 01 01 03 02 06 04 98 3F E4 EF 9C 04 0B 00 00 E0 00 E0 EB 81 71 01 03 02 06 04 98 3C E5 D9 E1 09 F9 FD 09 E8 53 41 46 45 54 59 31 20 71 D1 13 53 49 41 31 31 33 20 20 0A 20 EB 81 01 01 03 02 06 04 98 3F E5 EE CB FA B5 00 00 E0 00 E0 EB 81 F1 91 03 8A 06 04 98 3D 66 FE 13 13 E4 08 F5 F2 08 F2 43 59 5A 32 33 31 41 20 78 05 CA 42 32 38 38 31 20 20 20 3F FE 36 30 34 20 02 33 33 52 04 A4 08 EB 81 F1 91 03 8A 06 04 98 3F 66 F8 39 07 39 FB FD F4 0E 63 46 44 58 35 33 39 31 20 AC 25 C4 4E 38 38 32 46 44 20 20 3F FE 36 35 32 20 02 33 34 52 08 97 08 EB 81 E1 81 03 02 06 04 98 3B 28 10 A1 72 50 C4 44 F1 10 00 C1 48 4C 35 32 33 39 20 20 71 AA 39 01 6C 00 20 E3 81 F1 91 03 8A 06 04 98 3E 68 86 EA F5 20 0E 5D 44 4C 48 37 31 39 20 20 3C 67 0E 44 41 49 58 4E 20 20 20 00 6B 33 32 20 20 00 33 34 52 04 24 08 EB 81 01 01 03 02 06 04 98 41 29 CA 2D 1A CC 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 39 2A 07 DB 16 5D 00 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 3D ED 0D E0 18 E4 00 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 2A AF CB D2 26 53 00 00 E0 02 E0 EB 81 F1 11 03 02 06 04 98 3A EF 0D 76 04 91 00 00 F2 08 E4 42 33 32 37 37 20 20 20 78 11 D5 42 33 32 37 37 20 20 20 38 34 32 20 02 E0 EB 81 01 01 03 02 06 04 98 3C 2F EA 89 ED 0F 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 3B F2 CA 19 24 BF 03 03 E0 02 E0 EB 81 01 01 03 02 06 04 98 41 34 0F 9F 1B C5 00 00 E0 00 E0 EB 81 71 01 03 02 06 04 98 3D B7 01 C9 F6 FB FF FF E8 46 49 52 45 33 20 20 20 71 D1 09 53 49 41 31 30 39 20 20 08 20 EB 81 01 01 03 02 06 04 98 3D F8 D4 C1 12 10 00 00 E0 02 E0 E3 81 81 81 03 02 06 04 98 40 39 4E BC F1 38 06 01 02 44 00 20 EB 81 F1 91 03 8A 06 04 98 3D BA DA EC 01 57 05 F8 F2 06 A6 41 41 52 31 31 31 20 20 71 BF 92 48 4C 37 37 39 32 20 20 3F FE 32 31 20 20 02 33 34 4C 04 A2 08 EB 81 E1 81 03 02 06 04 98 3D BC 13 53 7B 69 C7 58 F1 30 0F 14 4A 4E 41 33 38 30 20 20 71 C0 14 02 29 00 20 EB 81 01 01 03 02 06 04 98 3D 7F 11 2A 1B 1E 00 00 E0 00 E0 "; - //sBynary = sBynary.replaceAll("\\p{Z}", ""); - - // UDP 수신데이터 - String sBynary = packetMsg.replaceAll("\\p{Z}", ""); - String sTime = null; - - //sBynary = "0b00b5df5d6b02000501352f1a1aa4cbe959e6d555f35b05ddffe90021086840780fec074a410110000bffff00004fcc43455335303334413332314d524b53495a53504431364c0308071400100714004008380031323820202034520033f580472c43455335303334440000000000000000000000000000000000000000041000c9434553353033342020200001df0d0102000501352f561aa3b0e359ed549fffb0033bffff00000fcb010009520008902fba00d9"; - - // 수신시각 - if(sBynary.indexOf("*") > 0) { - sTime = packetMsg.substring(packetMsg.indexOf("*") +1); - sBynary = sBynary.substring(0, sBynary.indexOf("*")); - }else { - sTime = LocalDateTime.now().format(dfPattern); - } - - // 수신 메시지(Hex) byte로 변환 - byte[] data = new java.math.BigInteger(sBynary, 16).toByteArray(); - - recvCnt ++; - - // byte문자열 혹인 -// logger.writeLevelLog("[AsterixParserThread] ByteArray(" + recvCnt + "):" + packetMsg, LogLevelType.LOG_DEBUG, "AllLog"); - - // 수신메시지 파싱 - List> result = asterixParser.parse(data, sTime); - - // logger.info("[ASDE분석결과:"+LocalDateTime.now().format(dfPattern)+"] result = "+ result); - logger.info("[ASDE분석결과(service):"+LocalDateTime.now().format(dfPattern)+"] serviceMap = "+ Arrays.deepToString(serviceMap.toArray())); - - if(!serviceMap.isEmpty()) { - - for(int idx=0; idx Packet Message : " + packetMsg); - } else { - logger.error("[AsterixParserThread] Parsing Error Packet Message :" + packetMsg); - } - } finally { - processCount++; - - try { - if (processCount > MAX_PROCESS_COUNT) { - processCount = 0; - } - Thread.sleep(1); - } catch (InterruptedException e) { - logger.error("[ParserThread] : " + AsdeUtil.getStatckTrace(e)); - } - } - } - } - }); - - } - - public void start() { - - serviceMap = new ArrayList(); - - // Asterix Parser 객체 생성 (category별로 상이한 yaml파일의 spec내용을 로드) - asterixParser = new AsterixParser(serviceMap, execMode); - mapper = new ObjectMapper(); - - isRunning = true; - thread.start(); - } - -} +package kr.gmtc.gw.dev.asderecv.asde.asterix; + +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Queue; + +import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; +import kr.gmtc.gw.dev.asderecv.asde.utils.AsdeUtil; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Component; + +import com.fasterxml.jackson.databind.ObjectMapper; + + +@Component("asterixParserThread") +public class AsterixParserThread { + +// @Autowired + private AsterixParser asterixParser; + +// @Autowired +// private FMDecoder fmDecoder; +// + + private Logger logger = LoggerFactory.getLogger(AsterixParserThread.class); + + private boolean isRunning = true; + private Thread thread; + private int processCount = 0; + private int MAX_PROCESS_COUNT = 100; + + @Value("${asde.service.queueCount}") + private Integer scvQcount; + + @Value("${spring.profiles.active}") + private String execMode; + + List serviceMap; + + ObjectMapper mapper; + + DateTimeFormatter dfPattern = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); + + int recvCnt; + + public AsterixParserThread(Queue packetQ, HashMap> sendQueue) { + thread = new Thread(new Runnable() { + @Override + public void run() { + while (isRunning) { + String packetMsg = ""; + try { + packetMsg = packetQ.poll(); + + if (packetMsg != null) { + + // 테스트용 + //String sBynary = "0A 05 BB E3 81 F1 91 03 8A 06 04 98 3C 00 C1 D9 F5 28 0E 72 45 54 48 33 36 36 37 20 04 01 68 45 54 41 57 45 20 20 20 02 8D 36 34 39 20 00 33 34 52 0B 8F 08 EB 81 71 01 03 02 06 04 98 41 00 D3 95 20 50 08 06 E8 41 46 4C 36 20 20 20 20 71 D1 48 53 49 41 31 34 38 20 20 08 20 EB 81 01 01 03 02 06 04 98 3D C1 CF 75 18 D7 01 00 E0 02 E0 EB 81 71 01 03 02 06 04 98 40 C1 EA EC E5 80 00 00 E8 46 49 52 45 35 20 20 20 71 D1 08 53 49 41 31 30 38 20 20 08 20 EB 81 01 01 03 02 06 04 98 3C 45 E9 6B EC FB 00 00 E0 02 E0 E3 81 81 81 03 02 06 04 98 3F C5 A3 C8 F1 38 06 03 02 AC 00 20 E3 81 81 81 03 02 06 04 98 41 05 46 90 F1 38 06 02 02 6A 00 20 EB 81 F1 91 03 8A 06 04 98 3E 46 E3 86 26 F7 F9 FB F2 07 E3 54 57 42 32 39 32 20 20 71 C3 24 48 4C 38 33 32 34 20 20 3F FE 31 32 39 20 02 33 33 52 04 A7 08 EB 81 F1 11 03 0A 06 04 98 3F 86 D5 73 10 DC FF 00 F8 04 00 4B 41 53 38 20 20 20 20 71 C2 12 48 4C 38 32 31 32 20 20 35 34 36 20 02 04 9A 08 EB 81 01 01 03 02 06 04 98 40 07 CB 78 28 01 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 3C CB D6 2D 0F 8A 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 3B 8E D3 69 14 D5 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 30 51 E8 81 14 CC 00 00 E0 00 E0 EB 81 F1 91 03 8A 06 04 98 3E 12 DA FA 58 54 A1 07 F5 20 08 CF 4B 41 4C 35 35 31 20 20 71 BE 01 48 4C 37 36 30 31 20 20 00 6C 36 30 39 20 00 33 34 52 06 A5 08 E3 81 F1 91 03 8A 06 04 98 3C 14 E4 E6 F5 28 0E 73 41 49 48 32 32 31 20 20 71 C5 03 48 4C 38 35 30 33 20 20 02 73 36 31 36 20 00 33 34 52 05 B4 08 EB 81 F1 91 03 8A 06 04 98 3E 14 D1 26 0E 46 03 02 F2 09 1B 43 53 4E 33 30 36 31 20 78 1D AC 42 33 32 39 53 20 20 20 3F FE 31 32 34 20 02 33 34 4C 04 A6 08 EB 81 01 01 03 02 06 04 98 42 D8 CC 92 18 B2 00 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 35 98 DE 2A 14 0B 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 3E DA 0B 2E 16 DE FF 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 40 9A DE FC 21 72 00 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 27 5C D3 D8 32 98 00 00 E0 00 E0 EB 81 F1 91 03 8A 06 04 98 3E 9C D4 72 FA 1A E4 27 F2 07 A8 4B 41 4C 37 35 36 20 20 71 C2 76 48 4C 38 32 37 36 20 20 3F FD 32 34 36 20 02 33 34 4C 04 A8 08 EB 81 01 01 03 02 06 04 98 3F A0 EC 22 01 A7 00 00 E0 02 E0 EB 81 F1 91 83 8A 06 04 98 3E A1 2A 7C CF 65 D6 3B F2 06 BD 4A 4E 41 32 38 32 20 20 71 BF 57 48 4C 37 37 35 37 20 20 00 1D 32 30 20 20 80 71 33 33 52 00 33 33 52 04 A9 08 EB 81 F1 91 03 8A 06 04 98 40 22 05 38 14 50 FC FD F4 0E 70 47 45 43 38 33 39 31 20 3C 70 C9 44 41 4C 46 49 20 20 20 3F FF 36 33 33 20 02 33 34 52 04 23 08 EB 81 01 01 03 02 06 04 98 3F E4 EF 9C 04 0B 00 00 E0 00 E0 EB 81 71 01 03 02 06 04 98 3C E5 D9 E1 09 F9 FD 09 E8 53 41 46 45 54 59 31 20 71 D1 13 53 49 41 31 31 33 20 20 0A 20 EB 81 01 01 03 02 06 04 98 3F E5 EE CB FA B5 00 00 E0 00 E0 EB 81 F1 91 03 8A 06 04 98 3D 66 FE 13 13 E4 08 F5 F2 08 F2 43 59 5A 32 33 31 41 20 78 05 CA 42 32 38 38 31 20 20 20 3F FE 36 30 34 20 02 33 33 52 04 A4 08 EB 81 F1 91 03 8A 06 04 98 3F 66 F8 39 07 39 FB FD F4 0E 63 46 44 58 35 33 39 31 20 AC 25 C4 4E 38 38 32 46 44 20 20 3F FE 36 35 32 20 02 33 34 52 08 97 08 EB 81 E1 81 03 02 06 04 98 3B 28 10 A1 72 50 C4 44 F1 10 00 C1 48 4C 35 32 33 39 20 20 71 AA 39 01 6C 00 20 E3 81 F1 91 03 8A 06 04 98 3E 68 86 EA F5 20 0E 5D 44 4C 48 37 31 39 20 20 3C 67 0E 44 41 49 58 4E 20 20 20 00 6B 33 32 20 20 00 33 34 52 04 24 08 EB 81 01 01 03 02 06 04 98 41 29 CA 2D 1A CC 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 39 2A 07 DB 16 5D 00 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 3D ED 0D E0 18 E4 00 00 E0 00 E0 EB 81 01 01 03 02 06 04 98 2A AF CB D2 26 53 00 00 E0 02 E0 EB 81 F1 11 03 02 06 04 98 3A EF 0D 76 04 91 00 00 F2 08 E4 42 33 32 37 37 20 20 20 78 11 D5 42 33 32 37 37 20 20 20 38 34 32 20 02 E0 EB 81 01 01 03 02 06 04 98 3C 2F EA 89 ED 0F 00 00 E0 02 E0 EB 81 01 01 03 02 06 04 98 3B F2 CA 19 24 BF 03 03 E0 02 E0 EB 81 01 01 03 02 06 04 98 41 34 0F 9F 1B C5 00 00 E0 00 E0 EB 81 71 01 03 02 06 04 98 3D B7 01 C9 F6 FB FF FF E8 46 49 52 45 33 20 20 20 71 D1 09 53 49 41 31 30 39 20 20 08 20 EB 81 01 01 03 02 06 04 98 3D F8 D4 C1 12 10 00 00 E0 02 E0 E3 81 81 81 03 02 06 04 98 40 39 4E BC F1 38 06 01 02 44 00 20 EB 81 F1 91 03 8A 06 04 98 3D BA DA EC 01 57 05 F8 F2 06 A6 41 41 52 31 31 31 20 20 71 BF 92 48 4C 37 37 39 32 20 20 3F FE 32 31 20 20 02 33 34 4C 04 A2 08 EB 81 E1 81 03 02 06 04 98 3D BC 13 53 7B 69 C7 58 F1 30 0F 14 4A 4E 41 33 38 30 20 20 71 C0 14 02 29 00 20 EB 81 01 01 03 02 06 04 98 3D 7F 11 2A 1B 1E 00 00 E0 00 E0 "; + //sBynary = sBynary.replaceAll("\\p{Z}", ""); + + // UDP 수신데이터 + String sBynary = packetMsg.replaceAll("\\p{Z}", ""); + String sTime = null; + + //sBynary = "0b00b5df5d6b02000501352f1a1aa4cbe959e6d555f35b05ddffe90021086840780fec074a410110000bffff00004fcc43455335303334413332314d524b53495a53504431364c0308071400100714004008380031323820202034520033f580472c43455335303334440000000000000000000000000000000000000000041000c9434553353033342020200001df0d0102000501352f561aa3b0e359ed549fffb0033bffff00000fcb010009520008902fba00d9"; + + // 수신시각 + if(sBynary.indexOf("*") > 0) { + sTime = packetMsg.substring(packetMsg.indexOf("*") +1); + sBynary = sBynary.substring(0, sBynary.indexOf("*")); + }else { + sTime = LocalDateTime.now().format(dfPattern); + } + + // 수신 메시지(Hex) byte로 변환 + byte[] data = new java.math.BigInteger(sBynary, 16).toByteArray(); + + recvCnt ++; + + // byte문자열 혹인 +// logger.writeLevelLog("[AsterixParserThread] ByteArray(" + recvCnt + "):" + packetMsg, LogLevelType.LOG_DEBUG, "AllLog"); + + // 수신메시지 파싱 + List> result = asterixParser.parse(data, sTime); + + // logger.info("[ASDE분석결과:"+LocalDateTime.now().format(dfPattern)+"] result = "+ result); + logger.info("[ASDE분석결과(service):"+LocalDateTime.now().format(dfPattern)+"] serviceMap = "+ Arrays.deepToString(serviceMap.toArray())); + + if(!serviceMap.isEmpty()) { + + for(int idx=0; idx Packet Message : " + packetMsg); + } else { + logger.error("[AsterixParserThread] Parsing Error Packet Message :" + packetMsg); + } + } finally { + processCount++; + + try { + if (processCount > MAX_PROCESS_COUNT) { + processCount = 0; + } + Thread.sleep(1); + } catch (InterruptedException e) { + logger.error("[ParserThread] : " + AsdeUtil.getStatckTrace(e)); + } + } + } + } + }); + + } + + public void start() { + + serviceMap = new ArrayList(); + + // Asterix Parser 객체 생성 (category별로 상이한 yaml파일의 spec내용을 로드) + asterixParser = new AsterixParser(serviceMap, execMode); + mapper = new ObjectMapper(); + + isRunning = true; + thread.start(); + } + +} diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/YamlFileLoader.java b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/YamlFileLoader.java index 738028f..01e24ec 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/YamlFileLoader.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/asterix/YamlFileLoader.java @@ -1,63 +1,63 @@ -package kr.gmtc.gw.dev.asderecv.asde.asterix; - -import java.io.FileReader; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.Reader; -import java.util.LinkedHashMap; - -import org.json.simple.JSONObject; -import org.yaml.snakeyaml.Yaml; - -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.ObjectMapper; - - -public class YamlFileLoader { - - private Object returnObj; - - /** - * yamlLoadToVo() - * yaml 파일을 JSON포멧으로 로드하여 vo객체로 변환후 리턴 - * - * @param sFile - yaml 파일 경로 - * @param cVO - yaml파일 내용을 로드하여 담을 VO 클래스 - * @return Object를 파라메터로 넘어온 VO클래수로 casting하여 반환 - * @throws Json 포멧의 데이터를 Object로 변환시 오류발생하면 예외발생. - * @date 2023.02.07 - * - */ - public T yamlLoadToVo(String sFile, Class cVO) { - - if(sFile == null || sFile.equals("")) return cVO.cast(returnObj); - - try { - - InputStream is = this.getClass().getResourceAsStream("/" + sFile); - Reader reader = (is != null ? new InputStreamReader(is) : new FileReader(sFile)); - - // yaml 파일 로드 - //LinkedHashMap propMap = new Yaml().load(new FileReader(ResourceUtils.getFile(sFile))); - LinkedHashMap propMap = new Yaml().load(reader); - - // 파일내용을 JSON 포멧으로 변환 - JSONObject jsonObject = new JSONObject(propMap); - - // JSON 데이터를 Object로 변환 - ObjectMapper objectMapper = new ObjectMapper(); - - // Array Null값, 중간중간 존재하지 않는 필드 무시 - objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT); - objectMapper.configure(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY, false); - - returnObj = objectMapper.readValue(jsonObject.toJSONString(), cVO); - - } catch (Exception e) { - e.printStackTrace(); - } - - return cVO.cast(returnObj); - } - -} +package kr.gmtc.gw.dev.asderecv.asde.asterix; + +import java.io.FileReader; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; +import java.util.LinkedHashMap; + +import org.json.simple.JSONObject; +import org.yaml.snakeyaml.Yaml; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; + + +public class YamlFileLoader { + + private Object returnObj; + + /** + * yamlLoadToVo() + * yaml 파일을 JSON포멧으로 로드하여 vo객체로 변환후 리턴 + * + * @param sFile - yaml 파일 경로 + * @param cVO - yaml파일 내용을 로드하여 담을 VO 클래스 + * @return Object를 파라메터로 넘어온 VO클래수로 casting하여 반환 + * @throws Json 포멧의 데이터를 Object로 변환시 오류발생하면 예외발생. + * @date 2023.02.07 + * + */ + public T yamlLoadToVo(String sFile, Class cVO) { + + if(sFile == null || sFile.equals("")) return cVO.cast(returnObj); + + try { + + InputStream is = this.getClass().getResourceAsStream("/" + sFile); + Reader reader = (is != null ? new InputStreamReader(is) : new FileReader(sFile)); + + // yaml 파일 로드 + //LinkedHashMap propMap = new Yaml().load(new FileReader(ResourceUtils.getFile(sFile))); + LinkedHashMap propMap = new Yaml().load(reader); + + // 파일내용을 JSON 포멧으로 변환 + JSONObject jsonObject = new JSONObject(propMap); + + // JSON 데이터를 Object로 변환 + ObjectMapper objectMapper = new ObjectMapper(); + + // Array Null값, 중간중간 존재하지 않는 필드 무시 + objectMapper.enable(DeserializationFeature.ACCEPT_EMPTY_ARRAY_AS_NULL_OBJECT); + objectMapper.configure(DeserializationFeature.FAIL_ON_MISSING_EXTERNAL_TYPE_ID_PROPERTY, false); + + returnObj = objectMapper.readValue(jsonObject.toJSONString(), cVO); + + } catch (Exception e) { + e.printStackTrace(); + } + + return cVO.cast(returnObj); + } + +} diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/controller/AsdeServiceController.java b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/controller/AsdeServiceController.java index 2973778..d90f37b 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/controller/AsdeServiceController.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/controller/AsdeServiceController.java @@ -1,123 +1,123 @@ -package kr.gmtc.gw.dev.asderecv.asde.controller; - -import java.util.*; -import java.util.concurrent.LinkedBlockingQueue; - -import javax.annotation.Resource; - -import kr.gmtc.gw.dev.asderecv.asde.rest.vo.AsdeServiceVO; -import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; -import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceHeader; -import kr.gmtc.gw.dev.asderecv.config.ServiceConfig; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.MediaType; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RestController; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.ObjectMapper; - - -@RestController -@Component("AsdeServiceController") -public class AsdeServiceController{ - - // 프레임 워크 구성요소 // - /** 서비스 설정, {@code application.yml} */ - @Resource(name = "ServiceConfig") - private ServiceConfig serviceConfig; - - /* 실생상태 확인 */ - private boolean running = false; - - /* UDP test 소켓 */ - //UDPEchoClient UDPSocket ; - - @Resource(name = "sendQueue") - HashMap> sendQueue; - - Queue testMap = new LinkedBlockingQueue(); - - /* 서비스중인지 확인 */ - @Resource(name = "serviceRunnig") - - private boolean serviceRunnig = false; - - @Value("${asde.service.queueCount}") - private Integer scvQcount; - - @Value("${asde.service.serviceCount}") - private Integer scvDatacount; - - private AsdeServiceVO asdeServiceVO; - - @SuppressWarnings("deprecation") - @GetMapping(value = "/getASDE/{qid}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) - public String getASDE( @PathVariable Integer qid) { - String sendCode, sendMsg ; - ServiceHeader jsonHeader = new ServiceHeader(); - List jsonData = new ArrayList(); - - sendCode = "200"; - sendMsg = ""; - - asdeServiceVO = new AsdeServiceVO(); - - int idx = qid -1; - long qSize = sendQueue.get(idx).size(); - - if(qSize > 0) serviceRunnig = true ; - - if(qSize > scvDatacount) qSize = scvDatacount; - - if(qid > scvQcount || qid <= 0) { - sendCode = "Err-01"; - sendMsg = "할당되지 않은 큐를 지정했습니다."; -// retList.add(sendMsg); - }else { - if(sendQueue.get(idx).peek() == null) { - sendCode = "200"; - sendMsg = "전송할 데이터 없음."; -// retList.add(sendMsg); - }else{ - - while (qSize > 0 ) { - jsonData.add(sendQueue.get(idx).poll()); - qSize--; - } - } - - } - - jsonHeader.setResult_code(sendCode); - jsonHeader.setResult_msg(sendMsg); - - asdeServiceVO.setHeader(jsonHeader); - - if (sendCode.equals("200")) { - asdeServiceVO.setData(jsonData); - } - - ObjectMapper mapper = new ObjectMapper(); - - String sTmp = ""; - try { - sTmp = mapper.writeValueAsString(asdeServiceVO); - } catch (JsonProcessingException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - serviceRunnig = false ; - - return sTmp; - - } - - -} - - +package kr.gmtc.gw.dev.asderecv.asde.controller; + +import java.util.*; +import java.util.concurrent.LinkedBlockingQueue; + +import javax.annotation.Resource; + +import kr.gmtc.gw.dev.asderecv.asde.rest.vo.AsdeServiceVO; +import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; +import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceHeader; +import kr.gmtc.gw.dev.asderecv.config.ServiceConfig; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RestController; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; + + +@RestController +@Component("AsdeServiceController") +public class AsdeServiceController{ + + // 프레임 워크 구성요소 // + /** 서비스 설정, {@code application.yml} */ + @Resource(name = "ServiceConfig") + private ServiceConfig serviceConfig; + + /* 실생상태 확인 */ + private boolean running = false; + + /* UDP test 소켓 */ + //UDPEchoClient UDPSocket ; + + @Resource(name = "sendQueue") + HashMap> sendQueue; + + Queue testMap = new LinkedBlockingQueue(); + + /* 서비스중인지 확인 */ + @Resource(name = "serviceRunnig") + + private boolean serviceRunnig = false; + + @Value("${asde.service.queueCount}") + private Integer scvQcount; + + @Value("${asde.service.serviceCount}") + private Integer scvDatacount; + + private AsdeServiceVO asdeServiceVO; + + @SuppressWarnings("deprecation") + @GetMapping(value = "/getASDE/{qid}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE) + public String getASDE( @PathVariable Integer qid) { + String sendCode, sendMsg ; + ServiceHeader jsonHeader = new ServiceHeader(); + List jsonData = new ArrayList(); + + sendCode = "200"; + sendMsg = ""; + + asdeServiceVO = new AsdeServiceVO(); + + int idx = qid -1; + long qSize = sendQueue.get(idx).size(); + + if(qSize > 0) serviceRunnig = true ; + + if(qSize > scvDatacount) qSize = scvDatacount; + + if(qid > scvQcount || qid <= 0) { + sendCode = "Err-01"; + sendMsg = "할당되지 않은 큐를 지정했습니다."; +// retList.add(sendMsg); + }else { + if(sendQueue.get(idx).peek() == null) { + sendCode = "200"; + sendMsg = "전송할 데이터 없음."; +// retList.add(sendMsg); + }else{ + + while (qSize > 0 ) { + jsonData.add(sendQueue.get(idx).poll()); + qSize--; + } + } + + } + + jsonHeader.setResult_code(sendCode); + jsonHeader.setResult_msg(sendMsg); + + asdeServiceVO.setHeader(jsonHeader); + + if (sendCode.equals("200")) { + asdeServiceVO.setData(jsonData); + } + + ObjectMapper mapper = new ObjectMapper(); + + String sTmp = ""; + try { + sTmp = mapper.writeValueAsString(asdeServiceVO); + } catch (JsonProcessingException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + serviceRunnig = false ; + + return sTmp; + + } + + +} + + diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/controller/ParseController.java b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/controller/ParseController.java index 4c4625a..b09fd34 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/controller/ParseController.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/controller/ParseController.java @@ -1,16 +1,16 @@ -package kr.gmtc.gw.dev.asderecv.asde.controller; - -import java.util.HashMap; -import java.util.Queue; - -import org.springframework.stereotype.Component; - -import kr.gmtc.gw.dev.asderecv.asde.asterix.AsterixParserThread; - - -@Component("parseController") -public class ParseController { - public ParseController(Queue packetQ, HashMap> sendQueue, AsterixParserThread asterixParserThread) { - asterixParserThread.start(); - } -} +package kr.gmtc.gw.dev.asderecv.asde.controller; + +import java.util.HashMap; +import java.util.Queue; + +import org.springframework.stereotype.Component; + +import kr.gmtc.gw.dev.asderecv.asde.asterix.AsterixParserThread; + + +@Component("parseController") +public class ParseController { + public ParseController(Queue packetQ, HashMap> sendQueue, AsterixParserThread asterixParserThread) { + asterixParserThread.start(); + } +} diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/utils/AsdeUtil.java b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/utils/AsdeUtil.java index 066c727..b735d3c 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/utils/AsdeUtil.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/utils/AsdeUtil.java @@ -1,14 +1,14 @@ -package kr.gmtc.gw.dev.asderecv.asde.utils; - -import java.io.PrintWriter; -import java.io.StringWriter; - -public class AsdeUtil { - - public static String getStatckTrace(Throwable t) { - StringWriter sw = new StringWriter(); - t.printStackTrace(new PrintWriter(sw)); - return sw.toString(); - } - -} +package kr.gmtc.gw.dev.asderecv.asde.utils; + +import java.io.PrintWriter; +import java.io.StringWriter; + +public class AsdeUtil { + + public static String getStatckTrace(Throwable t) { + StringWriter sw = new StringWriter(); + t.printStackTrace(new PrintWriter(sw)); + return sw.toString(); + } + +} diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/utils/FieldNameReflectionUtils.java b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/utils/FieldNameReflectionUtils.java index 6b6a312..90612ce 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/asde/utils/FieldNameReflectionUtils.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/asde/utils/FieldNameReflectionUtils.java @@ -1,51 +1,51 @@ -package kr.gmtc.gw.dev.asderecv.asde.utils; - -import org.springframework.util.ReflectionUtils; - -import java.lang.reflect.Field; - -public class FieldNameReflectionUtils { - - - public String getItem(Object obj, String sFieldName) { - - String sRetValue = ""; - - Field field = ReflectionUtils.findField(obj.getClass(), sFieldName); - - if(field != null) { - field.setAccessible(true); - - try { - - sRetValue = (String) ReflectionUtils.getField(field, obj); - - } catch (Exception e) { - e.printStackTrace(); - } - - } - - return sRetValue; - - } - - - public void setItem(Object obj, String sFieldName, String sValue) { - - Field field = ReflectionUtils.findField(obj.getClass(), sFieldName); - - if(field != null) { - field.setAccessible(true); - - try { - ReflectionUtils.setField(field, obj, sValue); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - } - +package kr.gmtc.gw.dev.asderecv.asde.utils; + +import org.springframework.util.ReflectionUtils; + +import java.lang.reflect.Field; + +public class FieldNameReflectionUtils { + + + public String getItem(Object obj, String sFieldName) { + + String sRetValue = ""; + + Field field = ReflectionUtils.findField(obj.getClass(), sFieldName); + + if(field != null) { + field.setAccessible(true); + + try { + + sRetValue = (String) ReflectionUtils.getField(field, obj); + + } catch (Exception e) { + e.printStackTrace(); + } + + } + + return sRetValue; + + } + + + public void setItem(Object obj, String sFieldName, String sValue) { + + Field field = ReflectionUtils.findField(obj.getClass(), sFieldName); + + if(field != null) { + field.setAccessible(true); + + try { + ReflectionUtils.setField(field, obj, sValue); + } catch (Exception e) { + e.printStackTrace(); + } + + } + + } + } \ No newline at end of file diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/config/ServiceConfig.java b/src/main/java/kr/gmtc/gw/dev/asderecv/config/ServiceConfig.java index 5000e9c..1aa13c7 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/config/ServiceConfig.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/config/ServiceConfig.java @@ -1,91 +1,91 @@ -package kr.gmtc.gw.dev.asderecv.config; - -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; - -import javax.annotation.PostConstruct; -import java.nio.charset.Charset; -import java.util.*; -import java.util.concurrent.LinkedBlockingQueue; - -@Configuration("ServiceConfig") -public class ServiceConfig { - - @Value("${root}") - private String root; - -// @Value("${tcpip.client.send}") -// private String clientSendCharsetStr; -// @Value("${tcpip.client.receive}") -// private String clientReceiveCharsetStr; -// @Value("${tcpip.client.checksum}") -// private boolean clientReceiveChecksum; -// -// @Value("${tcpip.server.send}") -// private String serverSendCharsetStr; -// @Value("${tcpip.server.receive}") -// private String serverReceiveCharsetStr; -// @Value("${tcpip.server.checksum}") -// private boolean serverReceiveChecksum; - - private Charset clientReceiveCharset; - private Charset serverReceiveCharset; - private Charset clientSendCharset; - private Charset serverSendCharset; - - @PostConstruct - private void initialize() { -// clientSendCharset = Charset.forName(clientReceiveCharsetStr); -// serverSendCharset = Charset.forName(serverReceiveCharsetStr); -// clientReceiveCharset = Charset.forName(clientReceiveCharsetStr); -// serverReceiveCharset = Charset.forName(serverReceiveCharsetStr); - } - -// /** @return 프로그램 설치 경로 */ -// public String getRoot() { -// return root; -// } -// /** @return 클라이언트 포트 송신 인코드 캐릭터셋 */ -// public Charset getClientSendCharset() { -// return clientSendCharset; -// } -// /** @return 클라이언트 포트 수신 디코드 캐릭터셋 */ -// public Charset getClientReceiveCharset() { -// return clientReceiveCharset; -// } -// /** @return 클라이언트 포트 수신 체크섬 검증 여부 */ -// public boolean isClientReceiveChecksum() { -// return clientReceiveChecksum; -// } -// /** @return 서버 포트 송신 인코드 캐릭터셋 */ -// public Charset getServerSendCharset() { -// return serverSendCharset; -// } -// /** @return 서버 포트 수신 디코드 캐릭터셋 */ -// public Charset getServerReceiveCharset() { -// return serverReceiveCharset; -// } -// /** @return 서버 포트 수신 체크섬 검증 여부 */ -// public boolean isServerReceiveChecksum() { -// return serverReceiveChecksum; -// } - - @Bean(name = "packetQ") - public Queue packetQ(){ - return new LinkedBlockingQueue(); - } - - @Bean(name = "sendQueue") - public HashMap> sendQueue(){ - return new LinkedHashMap>(); - } - - @Bean(name = "serviceRunnig") - public boolean serviceRunnig(){ - return false; - } - -} +package kr.gmtc.gw.dev.asderecv.config; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; + +import javax.annotation.PostConstruct; +import java.nio.charset.Charset; +import java.util.*; +import java.util.concurrent.LinkedBlockingQueue; + +@Configuration("ServiceConfig") +public class ServiceConfig { + + @Value("${root}") + private String root; + +// @Value("${tcpip.client.send}") +// private String clientSendCharsetStr; +// @Value("${tcpip.client.receive}") +// private String clientReceiveCharsetStr; +// @Value("${tcpip.client.checksum}") +// private boolean clientReceiveChecksum; +// +// @Value("${tcpip.server.send}") +// private String serverSendCharsetStr; +// @Value("${tcpip.server.receive}") +// private String serverReceiveCharsetStr; +// @Value("${tcpip.server.checksum}") +// private boolean serverReceiveChecksum; + + // private Charset clientReceiveCharset; + // private Charset serverReceiveCharset; + // private Charset clientSendCharset; + // private Charset serverSendCharset; + + @PostConstruct + private void initialize() { +// clientSendCharset = Charset.forName(clientReceiveCharsetStr); +// serverSendCharset = Charset.forName(serverReceiveCharsetStr); +// clientReceiveCharset = Charset.forName(clientReceiveCharsetStr); +// serverReceiveCharset = Charset.forName(serverReceiveCharsetStr); + } + +// /** @return 프로그램 설치 경로 */ +// public String getRoot() { +// return root; +// } +// /** @return 클라이언트 포트 송신 인코드 캐릭터셋 */ +// public Charset getClientSendCharset() { +// return clientSendCharset; +// } +// /** @return 클라이언트 포트 수신 디코드 캐릭터셋 */ +// public Charset getClientReceiveCharset() { +// return clientReceiveCharset; +// } +// /** @return 클라이언트 포트 수신 체크섬 검증 여부 */ +// public boolean isClientReceiveChecksum() { +// return clientReceiveChecksum; +// } +// /** @return 서버 포트 송신 인코드 캐릭터셋 */ +// public Charset getServerSendCharset() { +// return serverSendCharset; +// } +// /** @return 서버 포트 수신 디코드 캐릭터셋 */ +// public Charset getServerReceiveCharset() { +// return serverReceiveCharset; +// } +// /** @return 서버 포트 수신 체크섬 검증 여부 */ +// public boolean isServerReceiveChecksum() { +// return serverReceiveChecksum; +// } + + @Bean(name = "packetQ") + public Queue packetQ(){ + return new LinkedBlockingQueue(); + } + + @Bean(name = "sendQueue") + public HashMap> sendQueue(){ + return new LinkedHashMap>(); + } + + @Bean(name = "serviceRunnig") + public boolean serviceRunnig(){ + return false; + } + +} diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/controller/MainController.java b/src/main/java/kr/gmtc/gw/dev/asderecv/controller/MainController.java index b2a1c3f..91db54c 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/controller/MainController.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/controller/MainController.java @@ -1,363 +1,363 @@ -package kr.gmtc.gw.dev.asderecv.controller; - -import kr.gmtc.gw.comp.socket.udp.UDPEventListener; -import kr.gmtc.gw.comp.socket.udp.UDPManager; -import kr.gmtc.gw.comp.socket.utils.SocketUtil; -import kr.gmtc.gw.comp.socket.vo.MsgObjVO; -import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; -import kr.gmtc.gw.dev.asderecv.asde.utils.AsdeUtil; - -import kr.gmtc.gw.dev.asderecv.thread.CustomThread; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.event.ApplicationReadyEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.context.event.ContextClosedEvent; -import org.springframework.context.event.EventListener; -import org.springframework.core.annotation.Order; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import java.io.IOException; -import java.time.Duration; -import java.time.LocalDateTime; -import java.time.format.DateTimeFormatter; -import java.util.HashMap; -import java.util.Queue; -import java.util.concurrent.ArrayBlockingQueue; - -@Component("controller") -public class MainController implements ApplicationListener { - - @Value("${root}") - private String path; - - @Resource(name = "packetQ") - Queue packetQ; - - @Resource(name = "sendQueue") - HashMap> sendQueue; - - @Resource(name = "serviceRunnig") - private boolean serviceRunnig = false; - - @Value("${asde.service.queueCount}") - private Integer scvQcount; - - @Value("${asde.service.clearQ.maxCount}") - private Integer scvQmaxCount; - - @Value("${asde.service.clearQ.diffTime}") - private Integer scvQdiffTime; - - @Value("${asde.service.clearQ.clearTime}") - private Integer scvQclearTime; - - - private boolean isRunning; - protected UDPManager udpManager; - private UDPEventListener udpListener; - - private ArrayBlockingQueue recvQ; - private ArrayBlockingQueue sendQ; - - private Thread recvQThread; - private Thread sendQThread; - - private CustomThread serviceQClearThread; - - - protected Logger logger; - - protected MainController(@Value("${root}") String path){ - - isRunning = false; - logger = LoggerFactory.getLogger(MainController.class); - - recvQ = new ArrayBlockingQueue<>(100000); - sendQ = new ArrayBlockingQueue(100000); - - udpListener = createUDPEventListener(); - udpManager = new UDPManager(path, udpListener); - - recvQThread = new Thread(new Runnable() { - @Override - public void run() { - while (isRunning) { - try { - int cnt = recvQ.size(); - if (cnt > 1000) { - cnt = 1000; - } - - for (int i = 0; i <= cnt - 1; i++) { - if (recvQ != null) { - MsgObjVO vo = recvQ.poll(); - if (vo != null) { - recvDataIn(vo); - vo = null; - } - } - } - Thread.sleep(1); - } catch (InterruptedException e) { - logger.error(SocketUtil.getStatckTrace(e)); - } - } - } - }); - - sendQThread = new Thread(new Runnable() { - @Override - public void run() { - while (isRunning) { - try { - int cnt = sendQ.size(); - if (cnt > 1000) { - cnt = 1000; - } - - for (int i = 0; i <= cnt - 1; i++) { - if (sendQ != null) { - MsgObjVO vo = sendQ.poll(); - if (vo != null) { - sendDataIn(vo); - vo = null; - } - } - } - Thread.sleep(1); - } catch (InterruptedException e) { - logger.error(SocketUtil.getStatckTrace(e)); - } - } - } - }); - - } - - @Order(0) - @EventListener(ApplicationReadyEvent.class) - public void initialize() { - try { - - // 전송용 Queue 생성 - createQueue(); - - // 업무 스레드 생성, 대기 없이 무한반복 - serviceQClearThread = new CustomThread("serviceQClearThread", this, CustomThread.NO_SLEEP, this::serviceQClear, null, false); - - } catch(Exception e){ - logger.error("[MainController] Prepare Fail " + AsdeUtil.getStatckTrace(e)); - System.exit(1); - } - } - - @Order(1) - @EventListener(ApplicationReadyEvent.class) - public void start() { - isRunning = true; - udpManager.initializeUDPFromXML(); - - udpManager.startClient(); - recvQThread.start(); - sendQThread.start(); - - } - - - public void stop() { - isRunning = false; - } - - ////////////////////////////////////////////////////////////////////// - - protected UDPEventListener createUDPEventListener() { - UDPEventListener listener = new UDPEventListener() { - - @Override - public void udpDataIn(MsgObjVO vo) { - // // TODO Auto-generated method stub - // throw new UnsupportedOperationException("Unimplemented method 'udpDataIn'"); - - //logger.info("RECV-DATA : " + vo.getMsg().toString()); - - recvPacketAdd(vo); - } - - @Override - public void udpSendData(MsgObjVO vo) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'udpSendData'"); - } - - @Override - public void udpSendData(String ip, int port, MsgObjVO vo) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'udpSendData'"); - } - - @Override - public void connected(String ip, int port, int statusCode, String description) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'connected'"); - } - - @Override - public void disconnected(String ip, int port, int statusCode, String description) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'disconnected'"); - } - - @Override - public void connectionStatus(String ip, int port, String connEvent, int statusCode, String description) { - // TODO Auto-generated method stub - throw new UnsupportedOperationException("Unimplemented method 'connectionStatus'"); - } - - }; - return listener; - } - - protected void recvPacketAdd(MsgObjVO vo) { - if (vo.getMsg().length < 1) { - return; - } - - String recvDate = ""; - - - try { - - String msg = SocketUtil.byteArrayToHexString(vo.getMsg()); - - recvDate = vo.getRecvDT().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")); - - msg = msg.concat("*").concat(recvDate); - - packetQ.add(msg); - - //logger.debug("[UDPDataIn] : " + msg); - - } catch (Exception e) { - - logger.error("[UDPDataIn] Unknown Exception Occur " + e.getMessage() ); - - } - } - - private void recvDataIn(MsgObjVO vo) { - try { - recvPacketAdd(vo); - } catch (Exception e) { - logger.error(SocketUtil.getStatckTrace(e)); - } - - } - - private void sendDataIn(MsgObjVO vo) { - try { - udpManager.sendMsg(vo.getSendClientIP(), vo.getSendClientPort(), vo); - } catch (Exception e) { - logger.error(SocketUtil.getStatckTrace(e)); - } - } - - // 설정에따라 REST용 서비스 큐 생성 - public void createQueue() { - - Class cls ; - - for(int idx=0; idx obj = null; - - try { - - cls = Class.forName(className); - obj = (Queue) cls.newInstance(); - - } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - sendQueue.put(idx, obj); - - } - - } - - private void serviceQClear() throws InterruptedException, IOException { - - String sRecvTime = ""; - - ServiceAsdeData jsonData = new ServiceAsdeData(); - - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); - - LocalDateTime dateTime; - - int iQcnt = 0; - - if(serviceRunnig) return; - - try { - - for(int idx=0; idx scvQmaxCount ) { - - jsonData = sendQueue.get(idx).peek(); - - sRecvTime = jsonData.getRecptn_dt(); - - dateTime = LocalDateTime.parse(sRecvTime, formatter); - - Duration diff = Duration.between(dateTime, LocalDateTime.now()); - - if( scvQclearTime > 0 && diff.toMillis() > scvQclearTime) { // 일정시간 미사용으로 판단 - sendQueue.get(idx).clear(); - logger.info("[MainController] serviceQClear : " + (idx +1) +"번 Queue 장기 미사용으로 초기화 (" + iQcnt +"건), 설정시간:" + scvQclearTime); - } - else if( diff.toMillis() > scvQdiffTime) { // 데이터 과적재 - - iQcnt = sendQueue.get(idx).size(); - int iPollCnt = iQcnt - scvQmaxCount; - - while (iQcnt - scvQmaxCount >= 0) { - sendQueue.get(idx).poll(); - iQcnt--; - } - - logger.info("[MainController] serviceQpoll : " + (idx +1) +"번 Queue 일부 버림 (" + iPollCnt +"건), 설정시간:" + scvQdiffTime + " 설정건수:"+ scvQmaxCount); - } - } - } - - - Thread.sleep(1000); - } catch (InterruptedException e) { - logger.error("[MainController] serviceQClear-InterruptedException : " + AsdeUtil.getStatckTrace(e)); - - } catch (Exception e) { - logger.error("[MainController] serviceQClear-Exception : " + AsdeUtil.getStatckTrace(e) + ">> " + sRecvTime.toString() ); - } - } - - @Override - public void onApplicationEvent(ContextClosedEvent contextClosedEvent) { - this.stop(); - logger.info("====================== SYSTEM STOPED ======================"); - } - - - - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -} +package kr.gmtc.gw.dev.asderecv.controller; + +import kr.gmtc.gw.comp.socket.udp.UDPEventListener; +import kr.gmtc.gw.comp.socket.udp.UDPManager; +import kr.gmtc.gw.comp.socket.utils.SocketUtil; +import kr.gmtc.gw.comp.socket.vo.MsgObjVO; +import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; +import kr.gmtc.gw.dev.asderecv.asde.utils.AsdeUtil; + +import kr.gmtc.gw.dev.asderecv.thread.CustomThread; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.context.event.ApplicationReadyEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.context.event.ContextClosedEvent; +import org.springframework.context.event.EventListener; +import org.springframework.core.annotation.Order; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import java.io.IOException; +import java.time.Duration; +import java.time.LocalDateTime; +import java.time.format.DateTimeFormatter; +import java.util.HashMap; +import java.util.Queue; +import java.util.concurrent.ArrayBlockingQueue; + +//@Component("controller") +public class MainController implements ApplicationListener { + + @Value("${root}") + private String path; + + @Resource(name = "packetQ") + Queue packetQ; + + @Resource(name = "sendQueue") + HashMap> sendQueue; + + @Resource(name = "serviceRunnig") + private boolean serviceRunnig = false; + + @Value("${asde.service.queueCount}") + private Integer scvQcount; + + @Value("${asde.service.clearQ.maxCount}") + private Integer scvQmaxCount; + + @Value("${asde.service.clearQ.diffTime}") + private Integer scvQdiffTime; + + @Value("${asde.service.clearQ.clearTime}") + private Integer scvQclearTime; + + + private boolean isRunning; + protected UDPManager udpManager; + private UDPEventListener udpListener; + + private ArrayBlockingQueue recvQ; + private ArrayBlockingQueue sendQ; + + private Thread recvQThread; + private Thread sendQThread; + + private CustomThread serviceQClearThread; + + + protected Logger logger; + + protected MainController(@Value("${root}") String path){ + + isRunning = false; + logger = LoggerFactory.getLogger(MainController.class); + + recvQ = new ArrayBlockingQueue<>(100000); + sendQ = new ArrayBlockingQueue(100000); + + udpListener = createUDPEventListener(); + udpManager = new UDPManager(path, udpListener); + + recvQThread = new Thread(new Runnable() { + @Override + public void run() { + while (isRunning) { + try { + int cnt = recvQ.size(); + if (cnt > 1000) { + cnt = 1000; + } + + for (int i = 0; i <= cnt - 1; i++) { + if (recvQ != null) { + MsgObjVO vo = recvQ.poll(); + if (vo != null) { + recvDataIn(vo); + vo = null; + } + } + } + Thread.sleep(1); + } catch (InterruptedException e) { + logger.error(SocketUtil.getStatckTrace(e)); + } + } + } + }); + + sendQThread = new Thread(new Runnable() { + @Override + public void run() { + while (isRunning) { + try { + int cnt = sendQ.size(); + if (cnt > 1000) { + cnt = 1000; + } + + for (int i = 0; i <= cnt - 1; i++) { + if (sendQ != null) { + MsgObjVO vo = sendQ.poll(); + if (vo != null) { + sendDataIn(vo); + vo = null; + } + } + } + Thread.sleep(1); + } catch (InterruptedException e) { + logger.error(SocketUtil.getStatckTrace(e)); + } + } + } + }); + + } + + @Order(0) + @EventListener(ApplicationReadyEvent.class) + public void initialize() { + try { + + // 전송용 Queue 생성 + createQueue(); + + // 업무 스레드 생성, 대기 없이 무한반복 + serviceQClearThread = new CustomThread("serviceQClearThread", this, CustomThread.NO_SLEEP, this::serviceQClear, null, false); + + } catch(Exception e){ + logger.error("[MainController] Prepare Fail " + AsdeUtil.getStatckTrace(e)); + System.exit(1); + } + } + + @Order(1) + @EventListener(ApplicationReadyEvent.class) + public void start() { + isRunning = true; + udpManager.initializeUDPFromXML(); + + udpManager.startClient(); + recvQThread.start(); + sendQThread.start(); + + } + + + public void stop() { + isRunning = false; + } + + ////////////////////////////////////////////////////////////////////// + + protected UDPEventListener createUDPEventListener() { + UDPEventListener listener = new UDPEventListener() { + + @Override + public void udpDataIn(MsgObjVO vo) { + // // TODO Auto-generated method stub + // throw new UnsupportedOperationException("Unimplemented method 'udpDataIn'"); + + //logger.info("RECV-DATA : " + vo.getMsg().toString()); + + recvPacketAdd(vo); + } + + @Override + public void udpSendData(MsgObjVO vo) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'udpSendData'"); + } + + @Override + public void udpSendData(String ip, int port, MsgObjVO vo) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'udpSendData'"); + } + + @Override + public void connected(String ip, int port, int statusCode, String description) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'connected'"); + } + + @Override + public void disconnected(String ip, int port, int statusCode, String description) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'disconnected'"); + } + + @Override + public void connectionStatus(String ip, int port, String connEvent, int statusCode, String description) { + // TODO Auto-generated method stub + throw new UnsupportedOperationException("Unimplemented method 'connectionStatus'"); + } + + }; + return listener; + } + + protected void recvPacketAdd(MsgObjVO vo) { + if (vo.getMsg().length < 1) { + return; + } + + String recvDate = ""; + + + try { + + String msg = SocketUtil.byteArrayToHexString(vo.getMsg()); + + recvDate = vo.getRecvDT().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS")); + + msg = msg.concat("*").concat(recvDate); + + packetQ.add(msg); + + //logger.debug("[UDPDataIn] : " + msg); + + } catch (Exception e) { + + logger.error("[UDPDataIn] Unknown Exception Occur " + e.getMessage() ); + + } + } + + private void recvDataIn(MsgObjVO vo) { + try { + recvPacketAdd(vo); + } catch (Exception e) { + logger.error(SocketUtil.getStatckTrace(e)); + } + + } + + private void sendDataIn(MsgObjVO vo) { + try { + udpManager.sendMsg(vo.getSendClientIP(), vo.getSendClientPort(), vo); + } catch (Exception e) { + logger.error(SocketUtil.getStatckTrace(e)); + } + } + + // 설정에따라 REST용 서비스 큐 생성 + public void createQueue() { + + Class cls ; + + for(int idx=0; idx obj = null; + + try { + + cls = Class.forName(className); + obj = (Queue) cls.newInstance(); + + } catch (ClassNotFoundException | InstantiationException | IllegalAccessException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + + sendQueue.put(idx, obj); + + } + + } + + private void serviceQClear() throws InterruptedException, IOException { + + String sRecvTime = ""; + + ServiceAsdeData jsonData = new ServiceAsdeData(); + + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS"); + + LocalDateTime dateTime; + + int iQcnt = 0; + + if(serviceRunnig) return; + + try { + + for(int idx=0; idx scvQmaxCount ) { + + jsonData = sendQueue.get(idx).peek(); + + sRecvTime = jsonData.getRecptn_dt(); + + dateTime = LocalDateTime.parse(sRecvTime, formatter); + + Duration diff = Duration.between(dateTime, LocalDateTime.now()); + + if( scvQclearTime > 0 && diff.toMillis() > scvQclearTime) { // 일정시간 미사용으로 판단 + sendQueue.get(idx).clear(); + logger.info("[MainController] serviceQClear : " + (idx +1) +"번 Queue 장기 미사용으로 초기화 (" + iQcnt +"건), 설정시간:" + scvQclearTime); + } + else if( diff.toMillis() > scvQdiffTime) { // 데이터 과적재 + + iQcnt = sendQueue.get(idx).size(); + int iPollCnt = iQcnt - scvQmaxCount; + + while (iQcnt - scvQmaxCount >= 0) { + sendQueue.get(idx).poll(); + iQcnt--; + } + + logger.info("[MainController] serviceQpoll : " + (idx +1) +"번 Queue 일부 버림 (" + iPollCnt +"건), 설정시간:" + scvQdiffTime + " 설정건수:"+ scvQmaxCount); + } + } + } + + + Thread.sleep(1000); + } catch (InterruptedException e) { + logger.error("[MainController] serviceQClear-InterruptedException : " + AsdeUtil.getStatckTrace(e)); + + } catch (Exception e) { + logger.error("[MainController] serviceQClear-Exception : " + AsdeUtil.getStatckTrace(e) + ">> " + sRecvTime.toString() ); + } + } + + @Override + public void onApplicationEvent(ContextClosedEvent contextClosedEvent) { + this.stop(); + logger.info("====================== SYSTEM STOPED ======================"); + } + + + + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +} diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/thread/CustomThread.java b/src/main/java/kr/gmtc/gw/dev/asderecv/thread/CustomThread.java index 4f8e717..0c6942c 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/thread/CustomThread.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/thread/CustomThread.java @@ -1,112 +1,112 @@ -package kr.gmtc.gw.dev.asderecv.thread; - -import kr.gmtc.gw.dev.asderecv.thread.handler.CustomThreadOnTerminate; -import kr.gmtc.gw.dev.asderecv.thread.handler.CustomThreadWork; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class CustomThread extends Thread{ - - /* 대기시간 없음 */ - public static final long NO_SLEEP = 0; - /* 1밀리 초 */ - public static final long SLEEP_MILLI_SEC = 1; - /* 1초 */ - public static final long SLEEP_SECOND = 1000; - /* 30초 */ - public static final long SLEEP_HALF_MINIUTE = 30000; - /* 1분 */ - public static final long SLEEP_MINIUTE = 60000; - - public final String controllClassName; - public final long repeatMiliSec; - public final CustomThreadWork definedWork; - public final CustomThreadOnTerminate definedTerminate; - public final Logger logger; - private boolean running; - - /** - * 인터럽트를 받을 시 스레드가 종료됨.
- * {@link Thread#sleep(long)} 기반으로 재실행 간격을 설정하므로 정확한 실행시간을 보장하지 않음.
- * 정확한 실행시간 보장이 필요 할 경우 sleep 간격을 짧게 설정하고 호출위치에서 시간확인
- * 정상적인 종료는 {@link #gracefulStop()}으로 종료함 - * @param threadName 스레드 이름 - * @param controllClass 스레드 관리 클래스, 일반적으로 this 사용 - * @param repeatMiliSec Sleep 시간(밀리 초), 0이하의 경우 대기시간 없음 - * @param definedWork 반복할 작업 - * @param definedTerminate 스레드가 인터럽트에 의해 종료될 경우 할 작업 - * @param autoStart 생성즉시 실행 - */ - - public CustomThread(String threadName, Object controllClass, long repeatMiliSec, - CustomThreadWork definedWork, CustomThreadOnTerminate definedTerminate, boolean autoStart) { - - if (definedWork == null) { - throw new IllegalArgumentException("[CustomThread] - definedWork is null."); - } - - this.definedWork = definedWork; - this.definedTerminate = definedTerminate; - this.controllClassName = controllClass == null ? "" : controllClass.getClass().getSimpleName(); - this.repeatMiliSec = repeatMiliSec > 0 ? repeatMiliSec : 0; - this.logger = LoggerFactory.getLogger(CustomThread.class); - this.running = false; - - setName(threadName); - setDaemon(true); - if (autoStart) { - this.start(); - } - } - - - @Override - public void run() { - logger.info("[CustomThread] Started."); - while ( this.running && !this.isInterrupted()) { - try { - try { - this.definedWork.work(); - } finally { - if (this.repeatMiliSec > 0) { - Thread.sleep(this.repeatMiliSec); - } - } - } catch(InterruptedException e) { // 인터럽트 수신시 종료 - logger.error("[CustomThread] Interrupted. "+ e.toString()); - Thread.currentThread().interrupt(); - break; - } catch(Exception e) { // 처리되지 않은 예외 로깅, 예외에 의한 무한루프에 주의 - logger.error("[CustomThread] Unknown Exception Occur. " + e.toString()); - } - } - - if(this.definedTerminate != null) { - this.definedTerminate.onTerminate(); - } - - logger.error("[CustomThread] Stoped."); - - } - - @Override - public String toString() { - - return "CustomThread [controllClass=" + this.controllClassName + ", threadName=" + getName() + - ", runnig=" + this.running + ", alive=" + isAlive()+ ", repeatMiliSec=" + this.repeatMiliSec + - ", definedTerminate=" + (this.definedTerminate == null ? "no" : "yes") + "]"; - } - - @Override - public synchronized void start() { - this.running = true; - super.start(); - } - - /** - * 스레드 정상종료, 진행중인 작업 완료 후 종료됨. - */ - public void gracefulStop() { - this.running = false; - } -} +package kr.gmtc.gw.dev.asderecv.thread; + +import kr.gmtc.gw.dev.asderecv.thread.handler.CustomThreadOnTerminate; +import kr.gmtc.gw.dev.asderecv.thread.handler.CustomThreadWork; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +public class CustomThread extends Thread{ + + /* 대기시간 없음 */ + public static final long NO_SLEEP = 0; + /* 1밀리 초 */ + public static final long SLEEP_MILLI_SEC = 1; + /* 1초 */ + public static final long SLEEP_SECOND = 1000; + /* 30초 */ + public static final long SLEEP_HALF_MINIUTE = 30000; + /* 1분 */ + public static final long SLEEP_MINIUTE = 60000; + + public final String controllClassName; + public final long repeatMiliSec; + public final CustomThreadWork definedWork; + public final CustomThreadOnTerminate definedTerminate; + public final Logger logger; + private boolean running; + + /** + * 인터럽트를 받을 시 스레드가 종료됨.
+ * {@link Thread#sleep(long)} 기반으로 재실행 간격을 설정하므로 정확한 실행시간을 보장하지 않음.
+ * 정확한 실행시간 보장이 필요 할 경우 sleep 간격을 짧게 설정하고 호출위치에서 시간확인
+ * 정상적인 종료는 {@link #gracefulStop()}으로 종료함 + * @param threadName 스레드 이름 + * @param controllClass 스레드 관리 클래스, 일반적으로 this 사용 + * @param repeatMiliSec Sleep 시간(밀리 초), 0이하의 경우 대기시간 없음 + * @param definedWork 반복할 작업 + * @param definedTerminate 스레드가 인터럽트에 의해 종료될 경우 할 작업 + * @param autoStart 생성즉시 실행 + */ + + public CustomThread(String threadName, Object controllClass, long repeatMiliSec, + CustomThreadWork definedWork, CustomThreadOnTerminate definedTerminate, boolean autoStart) { + + if (definedWork == null) { + throw new IllegalArgumentException("[CustomThread] - definedWork is null."); + } + + this.definedWork = definedWork; + this.definedTerminate = definedTerminate; + this.controllClassName = controllClass == null ? "" : controllClass.getClass().getSimpleName(); + this.repeatMiliSec = repeatMiliSec > 0 ? repeatMiliSec : 0; + this.logger = LoggerFactory.getLogger(CustomThread.class); + this.running = false; + + setName(threadName); + setDaemon(true); + if (autoStart) { + this.start(); + } + } + + + @Override + public void run() { + logger.info("[CustomThread] Started."); + while ( this.running && !this.isInterrupted()) { + try { + try { + this.definedWork.work(); + } finally { + if (this.repeatMiliSec > 0) { + Thread.sleep(this.repeatMiliSec); + } + } + } catch(InterruptedException e) { // 인터럽트 수신시 종료 + logger.error("[CustomThread] Interrupted. "+ e.toString()); + Thread.currentThread().interrupt(); + break; + } catch(Exception e) { // 처리되지 않은 예외 로깅, 예외에 의한 무한루프에 주의 + logger.error("[CustomThread] Unknown Exception Occur. " + e.toString()); + } + } + + if(this.definedTerminate != null) { + this.definedTerminate.onTerminate(); + } + + logger.error("[CustomThread] Stoped."); + + } + + @Override + public String toString() { + + return "CustomThread [controllClass=" + this.controllClassName + ", threadName=" + getName() + + ", runnig=" + this.running + ", alive=" + isAlive()+ ", repeatMiliSec=" + this.repeatMiliSec + + ", definedTerminate=" + (this.definedTerminate == null ? "no" : "yes") + "]"; + } + + @Override + public synchronized void start() { + this.running = true; + super.start(); + } + + /** + * 스레드 정상종료, 진행중인 작업 완료 후 종료됨. + */ + public void gracefulStop() { + this.running = false; + } +} diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/thread/handler/CustomThreadOnTerminate.java b/src/main/java/kr/gmtc/gw/dev/asderecv/thread/handler/CustomThreadOnTerminate.java index 7d09dda..c27d7ed 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/thread/handler/CustomThreadOnTerminate.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/thread/handler/CustomThreadOnTerminate.java @@ -1,6 +1,6 @@ -package kr.gmtc.gw.dev.asderecv.thread.handler; - -@FunctionalInterface -public interface CustomThreadOnTerminate { - public void onTerminate(); -} +package kr.gmtc.gw.dev.asderecv.thread.handler; + +@FunctionalInterface +public interface CustomThreadOnTerminate { + public void onTerminate(); +} diff --git a/src/main/java/kr/gmtc/gw/dev/asderecv/thread/handler/CustomThreadWork.java b/src/main/java/kr/gmtc/gw/dev/asderecv/thread/handler/CustomThreadWork.java index 8a9a8fb..1ef2584 100644 --- a/src/main/java/kr/gmtc/gw/dev/asderecv/thread/handler/CustomThreadWork.java +++ b/src/main/java/kr/gmtc/gw/dev/asderecv/thread/handler/CustomThreadWork.java @@ -1,6 +1,6 @@ -package kr.gmtc.gw.dev.asderecv.thread.handler; - -@FunctionalInterface -public interface CustomThreadWork { - public void work() throws Exception; -} +package kr.gmtc.gw.dev.asderecv.thread.handler; + +@FunctionalInterface +public interface CustomThreadWork { + public void work() throws Exception; +} diff --git a/src/main/java/kr/gmtc/gw/dev/restdev/config/RestConfig.java b/src/main/java/kr/gmtc/gw/dev/restdev/config/RestConfig.java new file mode 100644 index 0000000..1ac0e90 --- /dev/null +++ b/src/main/java/kr/gmtc/gw/dev/restdev/config/RestConfig.java @@ -0,0 +1,53 @@ +package kr.gmtc.gw.dev.restdev.config; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Queue; +import java.util.concurrent.LinkedBlockingQueue; + +import javax.annotation.PostConstruct; + +import org.springframework.beans.factory.annotation.Value; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +import kr.gmtc.gw.dev.asderecv.asde.rest.vo.ServiceAsdeData; + +//@Configuration("restConfig") +public class RestConfig { + + @Value("${root}") + private String root; + + @Value("${request.url.recvTest}") + private String testReqTestUrl = "http://localhost:18080/test"; + + + @PostConstruct + private void initialize() { + + } + + @Bean(name = "serviceRunnig") + public boolean serviceRunnig(){ + return false; + } + + @Bean(name = "packetQ") + public Queue packetQ(){ + return new LinkedBlockingQueue(); + } + + + + @Bean(name = "sendQueue") + public HashMap> sendQueue(){ + return new LinkedHashMap>(); + } + + + + + + +} diff --git a/src/main/java/kr/gmtc/gw/dev/restdev/controller/RestReciveController.java b/src/main/java/kr/gmtc/gw/dev/restdev/controller/RestReciveController.java new file mode 100644 index 0000000..a4e178e --- /dev/null +++ b/src/main/java/kr/gmtc/gw/dev/restdev/controller/RestReciveController.java @@ -0,0 +1,160 @@ +package kr.gmtc.gw.dev.restdev.controller; + +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Queue; +import java.util.concurrent.LinkedBlockingQueue; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.scheduling.annotation.Scheduled; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import com.fasterxml.jackson.databind.ObjectMapper; + +import kr.gmtc.gw.dev.restdev.service.StandMasterService; +import kr.gmtc.gw.dev.restdev.vo.AImetaTestVO; +import kr.gmtc.gw.dev.restdev.vo.AImetaTestVO.Data; +import kr.gmtc.gw.dev.restdev.vo.AiMetaVideoStatusVO; +import kr.gmtc.gw.dev.restdev.vo.AiMetaVideoStatusVO.AiMetaVideoStatusVO_Data; +import kr.gmtc.gw.dev.restdev.vo.AiMetaVideoStatusVO.AiMetaVideoStatusVO_Sts; +import kr.gmtc.gw.dev.restdev.vo.StandMasterVO; + +@Component("restReciveController") +public class RestReciveController { + + + private final RestTemplate restTemplate; + + private final ObjectMapper objectMapper; + + private Queue recvQ; + + private AiMetaVideoStatusVO mapStatus; + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); + + + @Autowired + private StandMasterService standService; + + public RestReciveController() { + + this.restTemplate = new RestTemplate(); + + this.objectMapper = new ObjectMapper(); + + this.recvQ = new LinkedBlockingQueue(); + + this.mapStatus = new AiMetaVideoStatusVO(); + } + + @Scheduled(fixedRate = 1000) // 1초마다 실행 + public void requestJsonData() { + // JSON 데이터를 요청할 URL 설정 + String apiUrl = "http://localhost"; + String sPort = "18082"; + String sReqMsg = "getVideoTest"; + + String sReqUrl = apiUrl + ":" +sPort + "/" + sReqMsg; + + // 요청을 보내고 JSON 데이터를 받아옴 + String jsonResponse = restTemplate.getForObject(sReqUrl, String.class); + + // 받아온 JSON 데이터를 Message 객체로 변환 + try { + AImetaTestVO message = objectMapper.readValue(jsonResponse, AImetaTestVO.class); + + recvQ.offer(message); + + // 변환된 Message 객체를 원하는 방식으로 처리 + System.out.println("Received Message: " + message.toString()); + + } catch (Exception e) { + // JSON 파싱 오류 처리 + e.printStackTrace(); + } + + splitData(); + } + + + private void splitData(){ + + for(AImetaTestVO oneData : recvQ ){ + + List recvDatas = oneData.getData(); + int iDataCnt = recvDatas.size(); + + for(int idx=0; idx listCctvs = recvDatas.get(idx).getCc_id(); + int iCctvCnt = listCctvs.size(); + + for(int idxC=0; idxC 주기장 번호 매핑 + // MetaAIVideoStatus3 mapStatus3 = new MetaAIVideoStatus3(); + + String sCctvID = listCctvs.get(idxC); + String sStandNO = mappingStand(sCctvID); + String sSts = recvDatas.get(idx).getStts_cls(); + + AiMetaVideoStatusVO_Sts stsMap = mapStatus.getStsMap(sStandNO); + + AiMetaVideoStatusVO_Data dataMap = mapStatus.getStsMap(sStandNO).getDataMap(sSts); + + Map standStsMap = new HashMap(); + + + Date now = new Date(); + + dataMap.setRecvTime( String.valueOf(sdf.format(now))); + dataMap.setStandNo(sStandNO); + dataMap.setSts(sSts); + + standStsMap.put(sStandNO, stsMap); + + mapStatus.setMapStandNoGroup(standStsMap); + + + } + } + } + + } + + private String mappingStand(String sCctvID){ + + String sRetStandNo = ""; + + List standList = standService.getStandList(); + + for(StandMasterVO standMaster : standList){ + if(standMaster.getCctvID().equals(sCctvID)){ + sRetStandNo = standMaster.getStandNO(); + return sRetStandNo; + } + + } + + return sRetStandNo; + } + + // private boolean checkExistMap(String sKey){ + // boolean isEx = false; + + // if(mapStatus.get(sKey) != null){ + // isEx = true; + // } + + // return isEx; + + // } + + +} diff --git a/src/main/java/kr/gmtc/gw/dev/restdev/controller/RestReqeustController.java b/src/main/java/kr/gmtc/gw/dev/restdev/controller/RestReqeustController.java new file mode 100644 index 0000000..bccaf7c --- /dev/null +++ b/src/main/java/kr/gmtc/gw/dev/restdev/controller/RestReqeustController.java @@ -0,0 +1,83 @@ +package kr.gmtc.gw.dev.restdev.controller; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Random; + +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.RestController; + +import kr.gmtc.gw.dev.restdev.vo.AImetaTestVO; +import kr.gmtc.gw.dev.restdev.vo.AImetaTestVO.Data; +import kr.gmtc.gw.dev.restdev.vo.AImetaTestVO.Header; + +@RestController +public class RestReqeustController { + + + @RequestMapping(value={"getTest/{param1}/{param2}"}, method=RequestMethod.GET) + public String getTest(@PathVariable String param1, @PathVariable String param2){ + String sParam1, sParam2; + + sParam1 = param1; + sParam2 = param2; + + + return "return :" + sParam1 + "/" + sParam2; + + } + + @RequestMapping(value={"getVideoTest"}, method=RequestMethod.GET) + public AImetaTestVO getMessage() { + // JSON 형식의 메시지를 생성 + Header header = new Header("200", "OK"); + + List dataList = new ArrayList<>(); + Random random = new Random(); + + for (int i = 0; i < 2; i++) { // 두 개의 데이터 생성 + String on_arcrft = random.nextBoolean() ? "true" : "false"; + String stts_cls = getRandomStatusClass(random); + String arcrft_tp = "A380-800"; + String zn_id = String.valueOf(106 + i); + List bb_tlp = Arrays.asList("241", "489"); + List crd_frm = Arrays.asList("286", "500"); + List cc_id = Arrays.asList(String.valueOf(random.nextInt(4) + 102), String.valueOf(random.nextInt(4) + 102)); // 102부터 105까지의 랜덤값 + List crd_glb = Arrays.asList("37.344556", "127.422913"); + List bb_brp = Arrays.asList("331", "512"); + String dtct_tm = ""; + String arln = "KOR-001"; + String trck_id = ""; + + Data data = new Data(); + data.setOn_arcrft(on_arcrft); + data.setStts_cls(stts_cls); + data.setArcrft_tp(arcrft_tp); + data.setZn_id(zn_id); + data.setBb_brp(bb_brp); + data.setBb_tlp(bb_tlp); + data.setCrd_frm(crd_frm); + data.setCc_id(cc_id); + data.setCrd_glb(crd_glb); + data.setDtct_tm(dtct_tm); + data.setArln(arln); + data.setTrck_id(trck_id); + + dataList.add(data); + } + + return new AImetaTestVO(header, dataList); + } + + private String getRandomStatusClass(Random random) { + String[] statusClasses = {"brdg_cnnctd", "crg_dr_opnd", "twng_cr_cnnctd"}; + int randomIndex = random.nextInt(statusClasses.length); + return statusClasses[randomIndex]; + } + + + +} diff --git a/src/main/java/kr/gmtc/gw/dev/restdev/service/StandMasterService.java b/src/main/java/kr/gmtc/gw/dev/restdev/service/StandMasterService.java new file mode 100644 index 0000000..a06ce3b --- /dev/null +++ b/src/main/java/kr/gmtc/gw/dev/restdev/service/StandMasterService.java @@ -0,0 +1,40 @@ +package kr.gmtc.gw.dev.restdev.service; + +import java.util.ArrayList; +import java.util.List; + +import org.springframework.stereotype.Service; + +import kr.gmtc.gw.dev.restdev.vo.StandMasterVO; + +@Service("standMasterService") +public class StandMasterService { + + private List standList; + + + public StandMasterService(){ + + standList = new ArrayList(); + + + standList.add(new StandMasterVO("G101", "101")); + standList.add(new StandMasterVO("G102", "102")); + standList.add(new StandMasterVO("G103", "103")); + standList.add(new StandMasterVO("G104", "104")); + standList.add(new StandMasterVO("G105", "105")); + standList.add(new StandMasterVO("G106", "106")); + standList.add(new StandMasterVO("G107", "107")); + standList.add(new StandMasterVO("G108", "108")); + standList.add(new StandMasterVO("G109", "109")); + + + } + + public List getStandList(){ + + return this.standList; + } + + +} diff --git a/src/main/java/kr/gmtc/gw/dev/restdev/vo/AImetaTestVO.java b/src/main/java/kr/gmtc/gw/dev/restdev/vo/AImetaTestVO.java new file mode 100644 index 0000000..c87b612 --- /dev/null +++ b/src/main/java/kr/gmtc/gw/dev/restdev/vo/AImetaTestVO.java @@ -0,0 +1,178 @@ +package kr.gmtc.gw.dev.restdev.vo; + +import java.util.List; + +public class AImetaTestVO { + + private Header header; + private List data; + + + + public AImetaTestVO() { + + } + + public AImetaTestVO(Header header, List data){ + this.header = header; + this.data = data; + } + + + public Header getHeader() { + return header; + } + + public void setHeader(Header header) { + this.header = header; + } + + public List getData() { + return data; + } + + public void setData(List data) { + this.data = data; + } + + public static class Header { + private String result_code; + private String result_msg; + + public Header() { + } + + public Header(String result_code, String result_msg) { + this.result_code = result_code; + this.result_msg = result_msg; + } + + public String getResult_code() { + return result_code; + } + + public void setResult_code(String result_code) { + this.result_code = result_code; + } + + public String getResult_msg() { + return result_msg; + } + + public void setResult_msg(String result_msg) { + this.result_msg = result_msg; + } + } + + public static class Data { + private String on_arcrft; + private String stts_cls; + private String arcrft_tp; + private String zn_id; + private List bb_tlp; + private List crd_frm; + private List cc_id; + private List crd_glb; + private List bb_brp; + private String dtct_tm; + private String arln; + private String trck_id; + + public String getOn_arcrft() { + return on_arcrft; + } + + public void setOn_arcrft(String on_arcrft) { + this.on_arcrft = on_arcrft; + } + + public String getStts_cls() { + return stts_cls; + } + + public void setStts_cls(String stts_cls) { + this.stts_cls = stts_cls; + } + + public String getArcrft_tp() { + return arcrft_tp; + } + + public void setArcrft_tp(String arcrft_tp) { + this.arcrft_tp = arcrft_tp; + } + + public String getZn_id() { + return zn_id; + } + + public void setZn_id(String zn_id) { + this.zn_id = zn_id; + } + + public List getBb_tlp() { + return bb_tlp; + } + + public void setBb_tlp(List bb_tlp) { + this.bb_tlp = bb_tlp; + } + + public List getCrd_frm() { + return crd_frm; + } + + public void setCrd_frm(List crd_frm) { + this.crd_frm = crd_frm; + } + + public List getCc_id() { + return cc_id; + } + + public void setCc_id(List cc_id) { + this.cc_id = cc_id; + } + + public List getCrd_glb() { + return crd_glb; + } + + public void setCrd_glb(List crd_glb) { + this.crd_glb = crd_glb; + } + + public List getBb_brp() { + return bb_brp; + } + + public void setBb_brp(List bb_brp) { + this.bb_brp = bb_brp; + } + + public String getDtct_tm() { + return dtct_tm; + } + + public void setDtct_tm(String dtct_tm) { + this.dtct_tm = dtct_tm; + } + + public String getArln() { + return arln; + } + + public void setArln(String arln) { + this.arln = arln; + } + + public String getTrck_id() { + return trck_id; + } + + public void setTrck_id(String trck_id) { + this.trck_id = trck_id; + } + + } +} diff --git a/src/main/java/kr/gmtc/gw/dev/restdev/vo/AiMetaVideoStatusVO.java b/src/main/java/kr/gmtc/gw/dev/restdev/vo/AiMetaVideoStatusVO.java new file mode 100644 index 0000000..9b08741 --- /dev/null +++ b/src/main/java/kr/gmtc/gw/dev/restdev/vo/AiMetaVideoStatusVO.java @@ -0,0 +1,56 @@ +package kr.gmtc.gw.dev.restdev.vo; + +import java.util.HashMap; +import java.util.Map; + +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +public class AiMetaVideoStatusVO { + + private Map mapStandNoGroup; + + public AiMetaVideoStatusVO(){ + mapStandNoGroup = new HashMap(); + } + + public AiMetaVideoStatusVO_Sts getStsMap(String sStandNo){ + + return mapStandNoGroup.get(sStandNo); + } + + @Getter + @Setter + public static class AiMetaVideoStatusVO_Sts { + + private Map mapStatusGroup; + + public AiMetaVideoStatusVO_Sts(String sSts, AiMetaVideoStatusVO_Data map){ + mapStatusGroup = new HashMap(); + } + + public AiMetaVideoStatusVO_Data getDataMap(String sSts){ + + return mapStatusGroup.get(sSts); + } + + } + + @Getter + @Setter + public static class AiMetaVideoStatusVO_Data { + + private String standNo; + private String sts; + private String cctvID; + private String recvTime; + + } + + +} + + + diff --git a/src/main/java/kr/gmtc/gw/dev/restdev/vo/StandMasterVO.java b/src/main/java/kr/gmtc/gw/dev/restdev/vo/StandMasterVO.java new file mode 100644 index 0000000..32225f0 --- /dev/null +++ b/src/main/java/kr/gmtc/gw/dev/restdev/vo/StandMasterVO.java @@ -0,0 +1,35 @@ +package kr.gmtc.gw.dev.restdev.vo; + +public class StandMasterVO { + private String standNO; + private String cctvID; + + + public StandMasterVO(String standNO, String cctvID){ + this.standNO = standNO; + this.cctvID = cctvID; + } + + + public String getStandNO() { + return standNO; + } + + + public void setStandNO(String standNo) { + this.standNO = standNo; + } + + + public String getCctvID() { + return cctvID; + } + + + public void setCctvID(String cctvID) { + this.cctvID = cctvID; + } + + + +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index 294b67d..085216d 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -41,3 +41,7 @@ spring: root: D:\Workspace\Odroid_repository\EyeGW_CompDev +request: + url: + recvTest: http://localhost:18082/getVideoTest + diff --git a/src/main/resources/asterixList.xml b/src/main/resources/asterixList.xml index 11491ee..d4e72a0 100644 --- a/src/main/resources/asterixList.xml +++ b/src/main/resources/asterixList.xml @@ -1,5 +1,5 @@ - - - - - + + + + + diff --git a/src/main/resources/spec/alterixCat010Indra.yml b/src/main/resources/spec/alterixCat010Indra.yml index 2ca654c..0f7850b 100644 --- a/src/main/resources/spec/alterixCat010Indra.yml +++ b/src/main/resources/spec/alterixCat010Indra.yml @@ -1,732 +1,732 @@ -cat: 10 -ver: 1.1_indra -dataitem: - - itemno: I010/010 - frn: 1 - rule: mandatory - itemdesc: Data Source Identifier - definition: Identification of the system from which the data are received. - format: fixed - octet: 2 - structure: - - name: SAC - frombit: 16 - tobit: 9 - desc: System Area Code fixed to zero - - name: SIC - frombit: 8 - tobit: 1 - desc: System Identification Code - - itemno: I010/020 - frn: 2 - rule: mandatory - itemdesc: Target Data Type (target descriptor) - definition: Type and characteristics of the data as transmitted by a system. - format: variable - octet: 1 - - itemno: I010/020-1 - frn: 201 - rule: mandatory - itemdesc: Target Report Descriptor - definition: Type and characteristics of the data as transmitted by a system. - format: fixed - octet: 1 - structure: - - name: TYP - frombit: 8 - desc: TYP - - name: DEC - frombit: 7 - tobit: 6 - desc: 00 default value for the SCA system. - - name: CTL - frombit: 5 - codes: - 0: disable the control function to perform calculation on the target - 1: enable the control function to perform calculation on the target - - name: VIS - frombit: 4 - desc: renamed from CHN (Chain 1/2) to VIS - codes: - 0: disable the label display - 1: enable the label display - - name: LAB - frombit: 3 - desc: renamed from GBS (Transponder ground) to LAB - codes: - 0: AUTOMATIC LABELLING - 1: MANUAL LABELLING - - name: TST - frombit: 2 - desc: renamed from CRT (Corrupted reply in multilateration) to TST - codes: - 0: real measure - 1: simulated data set - - name: EXT - frombit: 1 - codes: - 0: End of Data Item - 1: Extension into first extent - - itemno: I010/161 - frn: 3 - rule: optional - itemdesc: Track Number - definition: An integer value representing a unique reference to a track record within a particular track file. - format: fixed - octet: 2 - structure: - - name: TrkNb - serviceFieldName: track_no - frombit: 16 - tobit: 1 - max: 65535 - min: 0 - desc: Track number - - itemno: I010/040 - frn: 4 - rule: X - itemdesc: Target position in polar coordinates - definition: never present - format: fixed - octet: 4 - - itemno: I010/042 - frn: 5 - rule: optional - itemdesc: Position in Cartesian Coordinates - definition: Position of target in Cartesian Coordinates, in two’s complement form. - format: fixed - octet: 4 - structure: - - name: X-Component - serviceFieldName: lat - frombit: 32 - tobit: 17 - datatype: int - desc: X-Component - resolution: 0.25 - min: "-8191" - max: 8191 - unit: m - - name: Y-Component - serviceFieldName: lon - frombit: 16 - tobit: 1 - datatype: int - desc: Y-Component - resolution: 0.25 - min: "-8191" - max: 8191 - unit: m - - itemno: I010/200 - frn: 6 - rule: X - itemdesc: Target velocity in polar coordinates - definition: never present - format: fixed - octet: 2 - - itemno: I010/202 - frn: 7 - rule: optional - itemdesc: Velocity in Cartesian Coordinates - definition: Velocity in Cartesian Coordinates - format: fixed - octet: 2 - structure: - - name: Vx - serviceFieldName: spd - frombit: 16 - tobit: 9 - desc: Vx - resolution: 1 - min: "-127" - max: 127 - unit: m/s - datatype: int - - name: Vy - serviceFieldName: spd - frombit: 8 - tobit: 1 - desc: Vy - resolution: 1 - min: "-127" - max: 127 - unit: m/s - datatype: int - - itemno: I010/130 - frn: 8 - rule: optional - itemdesc: Track Information - definition: Track Information - format: variable - octet: 1 - - itemno: I010/130-1 - frn: 801 - rule: optional - itemdesc: Track Information - definition: Track Information - format: fixed - octet: 1 - structure: - - name: TLE - frombit: 8 - tobit: 6 - desc: target size - codes: - 7: Unknown size - - name: SHAPE - serviceFieldName: trgt_ty - frombit: 5 - tobit: 4 - desc: target size - codes: - 0: To be defined - 1: Vehicle (no Towing Plan linked) - 2: Aircraft (no Towing Plan linked) - 3: Towing (a Towing Plan is linked to the track). - - name: FLIGHT - frombit: 3 - tobit: 2 - desc: FLIGHT - codes: - 0: Other wise - 1: Inbound (arrival) - 2: Outbound (departure) - 3: De-icing, a departure aircraft taxying to de-icing zone or pad. - - name: EXT - frombit: 1 - tobit: 1 - desc: EXT - codes: - 0: No extension byte - 1: Extension byte - - itemno: I010/130-2 - frn: 802 - rule: optional - itemdesc: Track Information - definition: Track Information - format: fixed - octet: 1 - structure: - - name: XM - serviceFieldName: lat_add - frombit: 6 - tobit: 6 - max: 8191 - min: "-8191" - - name: YM - serviceFieldName: lon_add - frombit: 5 - tobit: 5 - max: 8191 - min: "-8191" - - name: VXM - frombit: 4 - tobit: 4 - max: 127 - min: "-127" - - name: VYM - frombit: 3 - tobit: 3 - max: 127 - min: "-127" - - itemno: I010/099 - frn: 9 - rule: X - itemdesc: Standard Instrumental Departure (SID) - definition: never present - format: fixed - octet: 8 - - itemno: I010/170 - frn: 10 - rule: X - itemdesc: Track Status - definition: never present - format: fixed - octet: 1 - - itemno: I010/141 - frn: 11 - rule: X - itemdesc: UTC time of day - definition: never present - format: fixed - octet: 3 - - itemno: I010/030 - frn: 12 - rule: X - itemdesc: Warning / Error - definition: never present - format: fixed - octet: 1 - - itemno: I010/270 - frn: 13 - rule: X - itemdesc: Target Size - definition: never present - format: fixed - octet: 1 - - itemno: I010/150 - frn: 14 - rule: X - itemdesc: Presence of X-Pulse - definition: never present - format: fixed - octet: 1 - - itemno: I010/070 - frn: 15 - rule: optional - itemdesc: Mode 3/A code (SSR Code) - definition: Mode-3/A code converted into octal representation. - format: fixed - octet: 2 - structure: - - name: V - frombit: 16 - desc: V - codes: - 0: Code validated - 1: Code not validated - - name: G - frombit: 15 - desc: G - codes: - 0: Default - 1: Garbled code - - name: L - frombit: 14 - desc: L - codes: - 0: Mode-2 code derived from the reply of the transponder - 1: Smoothed Mode-2 code as provided by a local tracker n - - name: spare - frombit: 13 - desc: Spare bit set to 0 - bitsConst: 0 - - name: Mod3A - serviceFieldName: ssr_cd - frombit: 12 - tobit: 1 - datatype: octal - desc: Mode-3/A reply in octal representation - - itemno: I010/072 - frn: 16 - rule: optional - itemdesc: Call Sign (Flight Number) - definition: The call sign is coded with 8 ASCII characters. - format: fixed - octet: 8 - structure: - - name: CallSign - serviceFieldName: clsgn - frombit: 64 - tobit: 1 - desc: CallSign - datatype: ascii - - itemno: I010/074 - frn: 17 - rule: optional - itemdesc: Mode S Address - definition: The mode S address is coded on three bytes. - format: fixed - octet: 3 - structure: - - name: ModeS - serviceFieldName: mode_s_cd - frombit: 24 - tobit: 1 - desc: ModeS - - itemno: I010/076 - frn: 18 - rule: optional - itemdesc: Registration Mark (Tail Number) - definition: The registration mark is coded with 8 ASCII characters. - format: fixed - octet: 8 - structure: - - name: Reg - serviceFieldName: tail_no - frombit: 64 - tobit: 1 - desc: Reg - datatype: ascii - - itemno: I010/300 - frn: 19 - rule: X - itemdesc: Position standard deviation in Cartesian Coordinates - definition: Position standard deviation in Cartesian coordinates - format: fixed - octet: 4 - - itemno: I010/302 - frn: 20 - rule: X - itemdesc: Velocity standard deviation in Cartesian coordinates - definition: never present - format: fixed - octet: 2 - - itemno: I010/032 - frn: 21 - rule: X - itemdesc: Label error - definition: never present - format: fixed - octet: 1 - - itemno: I010/090 - frn: 22 - rule: optional - itemdesc: Mode C Code (Height) - definition: Mode C height converted into binary representation on two bytes fixed length data item. - format: fixed - octet: 2 - structure: - - name: V - frombit: 16 - codes: - 0: Code validated - 1: Code not validated - - name: G - frombit: 15 - codes: - 0: Default value - 1: Garbled code - - name: S - frombit: 14 - desc: sign bit - - name: FL - frombit: 13 - tobit: 1 - datatype: int - desc: Mode C HEIGHT - resolution: 0.25 - unit: FL - - itemno: I010/044 - frn: 23 - rule: X - itemdesc: Target heading in degrees referenced to the North. - definition: never present - format: fixed - octet: 1 - - itemno: I010/078 - frn: 24 - rule: X - itemdesc: Aircraft Type - definition: never present - format: fixed - octet: 8 - - itemno: I010/080 - frn: 25 - rule: optional - itemdesc: Parking Position allocation - definition: Stand information for arrivals and/or de-icing zone/de-icing pad for departures that taxi for de-icing - format: fixed - octet: 4 - structure: - - name: STAND - frombit: 32 - tobit: 1 - desc: Parking Position allocation - datatype: ascii -# - name: Char2 -# frombit: 24 -# tobit: 17 -# desc: Char2 -# datatype: string -# - name: Char3 -# frombit: 16 -# tobit: 9 -# desc: Char3 -# datatype: string -# - name: Char4 -# frombit: 8 -# tobit: 1 -# desc: Char4 -# datatype: string - - itemno: I010/034 - frn: 26 - rule: X - itemdesc: Control alert - definition: never present - format: variable - octet: 1 - - itemno: I010/132 - frn: 27 - rule: X - itemdesc: Maneuver and Movement status - definition: never present - format: variable - octet: 1 - - itemno: I010/046 - frn: 28 - rule: X - itemdesc: Topological position and TopoObject-Id - definition: never present - format: fixed - octet: 10 - - itemno: I010/401 - frn: 29 - rule: optional - itemdesc: Time To Threshold - definition: Time To Threshold - format: variable - octet: 0 - - itemno: I010/401-1 - frn: 2901 - rule: optional - itemdesc: Time To Threshold - definition: Time To Threshold - format: fixed - octet: 2 - structure: - - name: SRC - frombit: 16 - tobit: 16 - desc: SRC - codes: - 0: TTT source is ARTS / Approach. - 1: TTT source is SDF. - - name: CST - frombit: 15 - tobit: 15 - desc: CST - codes: - 0: approach system or computed by SDF basing on an updated. - 1: extrapolated basing on computed. - - name: WRN - frombit: 14 - tobit: 14 - desc: WRN - codes: - 0: Normal condition. - 1: configurable threshold. - - name: TTT - frombit: 10 - tobit: 2 - desc: Seconds needed by aircraft to reach runway threshold. - unit: sec - max: 511 - min: 0 - - name: FX - frombit: 1 - tobit: 1 - codes: - 0: No additional bytes are present. - 1: Field extension. - - itemno: I010/401-2 - frn: 2902 - rule: optional - itemdesc: name of the runway - definition: name of the runway - format: fixed - octet: 3 - structure: - - name: NU1 - frombit: 24 - tobit: 17 - desc: First digit. - datatype: ascii - - name: NU2 - frombit: 16 - tobit: 9 - desc: Second digit. - datatype: ascii - - name: LTR - frombit: 8 - tobit: 1 - desc: Letter. - datatype: ascii - - itemno: I010/400 - frn: 35 - rule: mandatory - itemdesc: Identification of fused Sensors - definition: Identification of fused Sensors - format: variable - octet: 1 - - itemno: I010/400-1 - frn: 3501 - rule: mandatory - itemdesc: Identification of fused Sensors - definition: Identification of fused Sensors - format: fixed - octet: 1 - structure: - - name: S7 - frombit: 8 - desc: sensor7 - codes: - 0: target not detected by sensor - 1: target detected by sensor - - name: S6 - frombit: 7 - desc: sensor6 - codes: - 0: target not detected by sensor - 1: target detected by sensor - - name: S5 - frombit: 6 - desc: sensor5 - codes: - 0: target not detected by sensor - 1: target detected by sensor - - name: S4 - frombit: 5 - desc: sensor4 - codes: - 0: target not detected by sensor - 1: target detected by sensor - - name: S3 - frombit: 4 - desc: sensor3, target detected by ADS-B - codes: - 0: target not detected by sensor - 1: target detected by sensor - - name: S2 - frombit: 3 - desc: sensor2, target detected by Apron Control Tower SMR - codes: - 0: target not detected by sensor - 1: target detected by sensor - - name: S1 - frombit: 2 - desc: sensor1, target detected by ATCT SMR - codes: - 0: target not detected by sensor - 1: target detected by sensor - - name: EXT - frombit: 8 - desc: extension bit - - itemno: I010/081 - frn: 36 - rule: optional - itemdesc: Runway (RWY) - definition: Allocated Runway found in flight plan is set in this item. This item can deviate from the Runway threshold set in item I010/401 Time to Threshold. - format: fixed - octet: 3 - structure: - - name: RWY - frombit: 24 - tobit: 1 - desc: First ASCII character. - datatype: ascii -# - name: CHAR2 -# frombit: 16 -# tobit: 9 -# desc: Second ASCII character. -# datatype: string -# - name: CHAR3 -# frombit: 8 -# tobit: 1 -# desc: Third ASCII character. -# datatype: string - - itemno: I010/390 - frn: 37 - rule: X - itemdesc: Flight Plan Identifier (FPL-ID) - definition: never present - format: fixed - octet: 5 - - itemno: I010/082 - frn: 38 - rule: X - itemdesc: Actual Start Up Given Time (SUG) - definition: never present - format: fixed - octet: 2 - - itemno: I010/083 - frn: 39 - rule: X - itemdesc: Estimated/Actual Off-Block Time (EOFB/OFB) - definition: never present - format: fixed - octet: 2 - - itemno: I010/084 - frn: 40 - rule: optional - itemdesc: Estimated Time of Arrival (ETA) or Estimated Time of Departure (ETD) - definition: The Estimated Time of Arrival (ETA) or Estimated Time of Departure (ETD) - format: fixed - octet: 2 - structure: - - name: DAY - frombit: 16 - tobit: 15 - desc: DAY - codes: - 0: This day - 1: Last day - 2: Next day - 3: not used - - name: HOR - frombit: 14 - tobit: 9 - desc: Hours , from 0 to 23 - - name: ArrDep - frombit: 8 - tobit: 8 - desc: Arrival/Departure Flag - codes: - 0: Departure - 1: Arrival - - name: Spare - frombit: 7 - tobit: 7 - desc: Spare - - name: MIN - frombit: 6 - tobit: 1 - desc: Minutes, from 0 to 59 - - itemno: I010/085 - frn: 41 - rule: X - itemdesc: Estimated/Actual On-Block Time (EONB/ONB) - definition: never present - format: fixed - octet: 2 - - itemno: I010/391 - frn: 42 - rule: mandatory - itemdesc: Flight Plan Info (FPL-INFO) - definition: gives the CWP the information which action is allowed to execute from the controller on the track. - format: fixed - octet: 1 - structure: - - name: Drag&Drop - frombit: 8 - tobit: 8 - desc: Drag&Drop Assignment - codes: - 0: Forbidden - 1: Allowed - - name: Manual - frombit: 7 - tobit: 7 - desc: Manual Assignment - codes: - 0: Forbidden - 1: Allowed - - name: Deassignment - frombit: 6 - tobit: 6 - desc: Deassignment - codes: - 0: Forbidden - 1: Allowed - - name: Condition - frombit: 5 - tobit: 4 - desc: Condition - codes: - 0: No flight plan is correlated with the track - 1: Automatic identified track - 2: Drag&drop identified track - 3: Callsign manually assigned by operator - - name: Command - frombit: 3 - tobit: 2 - desc: Command - codes: - 0: deassign - 1: assign via automatic - 2: assign via drag&drop - 3: assign via manual - - name: SPA - frombit: 1 - tobit: 1 - desc: Spare Bit +cat: 10 +ver: 1.1_indra +dataitem: + - itemno: I010/010 + frn: 1 + rule: mandatory + itemdesc: Data Source Identifier + definition: Identification of the system from which the data are received. + format: fixed + octet: 2 + structure: + - name: SAC + frombit: 16 + tobit: 9 + desc: System Area Code fixed to zero + - name: SIC + frombit: 8 + tobit: 1 + desc: System Identification Code + - itemno: I010/020 + frn: 2 + rule: mandatory + itemdesc: Target Data Type (target descriptor) + definition: Type and characteristics of the data as transmitted by a system. + format: variable + octet: 1 + - itemno: I010/020-1 + frn: 201 + rule: mandatory + itemdesc: Target Report Descriptor + definition: Type and characteristics of the data as transmitted by a system. + format: fixed + octet: 1 + structure: + - name: TYP + frombit: 8 + desc: TYP + - name: DEC + frombit: 7 + tobit: 6 + desc: 00 default value for the SCA system. + - name: CTL + frombit: 5 + codes: + 0: disable the control function to perform calculation on the target + 1: enable the control function to perform calculation on the target + - name: VIS + frombit: 4 + desc: renamed from CHN (Chain 1/2) to VIS + codes: + 0: disable the label display + 1: enable the label display + - name: LAB + frombit: 3 + desc: renamed from GBS (Transponder ground) to LAB + codes: + 0: AUTOMATIC LABELLING + 1: MANUAL LABELLING + - name: TST + frombit: 2 + desc: renamed from CRT (Corrupted reply in multilateration) to TST + codes: + 0: real measure + 1: simulated data set + - name: EXT + frombit: 1 + codes: + 0: End of Data Item + 1: Extension into first extent + - itemno: I010/161 + frn: 3 + rule: optional + itemdesc: Track Number + definition: An integer value representing a unique reference to a track record within a particular track file. + format: fixed + octet: 2 + structure: + - name: TrkNb + serviceFieldName: track_no + frombit: 16 + tobit: 1 + max: 65535 + min: 0 + desc: Track number + - itemno: I010/040 + frn: 4 + rule: X + itemdesc: Target position in polar coordinates + definition: never present + format: fixed + octet: 4 + - itemno: I010/042 + frn: 5 + rule: optional + itemdesc: Position in Cartesian Coordinates + definition: Position of target in Cartesian Coordinates, in two’s complement form. + format: fixed + octet: 4 + structure: + - name: X-Component + serviceFieldName: lat + frombit: 32 + tobit: 17 + datatype: int + desc: X-Component + resolution: 0.25 + min: "-8191" + max: 8191 + unit: m + - name: Y-Component + serviceFieldName: lon + frombit: 16 + tobit: 1 + datatype: int + desc: Y-Component + resolution: 0.25 + min: "-8191" + max: 8191 + unit: m + - itemno: I010/200 + frn: 6 + rule: X + itemdesc: Target velocity in polar coordinates + definition: never present + format: fixed + octet: 2 + - itemno: I010/202 + frn: 7 + rule: optional + itemdesc: Velocity in Cartesian Coordinates + definition: Velocity in Cartesian Coordinates + format: fixed + octet: 2 + structure: + - name: Vx + serviceFieldName: spd + frombit: 16 + tobit: 9 + desc: Vx + resolution: 1 + min: "-127" + max: 127 + unit: m/s + datatype: int + - name: Vy + serviceFieldName: spd + frombit: 8 + tobit: 1 + desc: Vy + resolution: 1 + min: "-127" + max: 127 + unit: m/s + datatype: int + - itemno: I010/130 + frn: 8 + rule: optional + itemdesc: Track Information + definition: Track Information + format: variable + octet: 1 + - itemno: I010/130-1 + frn: 801 + rule: optional + itemdesc: Track Information + definition: Track Information + format: fixed + octet: 1 + structure: + - name: TLE + frombit: 8 + tobit: 6 + desc: target size + codes: + 7: Unknown size + - name: SHAPE + serviceFieldName: trgt_ty + frombit: 5 + tobit: 4 + desc: target size + codes: + 0: To be defined + 1: Vehicle (no Towing Plan linked) + 2: Aircraft (no Towing Plan linked) + 3: Towing (a Towing Plan is linked to the track). + - name: FLIGHT + frombit: 3 + tobit: 2 + desc: FLIGHT + codes: + 0: Other wise + 1: Inbound (arrival) + 2: Outbound (departure) + 3: De-icing, a departure aircraft taxying to de-icing zone or pad. + - name: EXT + frombit: 1 + tobit: 1 + desc: EXT + codes: + 0: No extension byte + 1: Extension byte + - itemno: I010/130-2 + frn: 802 + rule: optional + itemdesc: Track Information + definition: Track Information + format: fixed + octet: 1 + structure: + - name: XM + serviceFieldName: lat_add + frombit: 6 + tobit: 6 + max: 8191 + min: "-8191" + - name: YM + serviceFieldName: lon_add + frombit: 5 + tobit: 5 + max: 8191 + min: "-8191" + - name: VXM + frombit: 4 + tobit: 4 + max: 127 + min: "-127" + - name: VYM + frombit: 3 + tobit: 3 + max: 127 + min: "-127" + - itemno: I010/099 + frn: 9 + rule: X + itemdesc: Standard Instrumental Departure (SID) + definition: never present + format: fixed + octet: 8 + - itemno: I010/170 + frn: 10 + rule: X + itemdesc: Track Status + definition: never present + format: fixed + octet: 1 + - itemno: I010/141 + frn: 11 + rule: X + itemdesc: UTC time of day + definition: never present + format: fixed + octet: 3 + - itemno: I010/030 + frn: 12 + rule: X + itemdesc: Warning / Error + definition: never present + format: fixed + octet: 1 + - itemno: I010/270 + frn: 13 + rule: X + itemdesc: Target Size + definition: never present + format: fixed + octet: 1 + - itemno: I010/150 + frn: 14 + rule: X + itemdesc: Presence of X-Pulse + definition: never present + format: fixed + octet: 1 + - itemno: I010/070 + frn: 15 + rule: optional + itemdesc: Mode 3/A code (SSR Code) + definition: Mode-3/A code converted into octal representation. + format: fixed + octet: 2 + structure: + - name: V + frombit: 16 + desc: V + codes: + 0: Code validated + 1: Code not validated + - name: G + frombit: 15 + desc: G + codes: + 0: Default + 1: Garbled code + - name: L + frombit: 14 + desc: L + codes: + 0: Mode-2 code derived from the reply of the transponder + 1: Smoothed Mode-2 code as provided by a local tracker n + - name: spare + frombit: 13 + desc: Spare bit set to 0 + bitsConst: 0 + - name: Mod3A + serviceFieldName: ssr_cd + frombit: 12 + tobit: 1 + datatype: octal + desc: Mode-3/A reply in octal representation + - itemno: I010/072 + frn: 16 + rule: optional + itemdesc: Call Sign (Flight Number) + definition: The call sign is coded with 8 ASCII characters. + format: fixed + octet: 8 + structure: + - name: CallSign + serviceFieldName: clsgn + frombit: 64 + tobit: 1 + desc: CallSign + datatype: ascii + - itemno: I010/074 + frn: 17 + rule: optional + itemdesc: Mode S Address + definition: The mode S address is coded on three bytes. + format: fixed + octet: 3 + structure: + - name: ModeS + serviceFieldName: mode_s_cd + frombit: 24 + tobit: 1 + desc: ModeS + - itemno: I010/076 + frn: 18 + rule: optional + itemdesc: Registration Mark (Tail Number) + definition: The registration mark is coded with 8 ASCII characters. + format: fixed + octet: 8 + structure: + - name: Reg + serviceFieldName: tail_no + frombit: 64 + tobit: 1 + desc: Reg + datatype: ascii + - itemno: I010/300 + frn: 19 + rule: X + itemdesc: Position standard deviation in Cartesian Coordinates + definition: Position standard deviation in Cartesian coordinates + format: fixed + octet: 4 + - itemno: I010/302 + frn: 20 + rule: X + itemdesc: Velocity standard deviation in Cartesian coordinates + definition: never present + format: fixed + octet: 2 + - itemno: I010/032 + frn: 21 + rule: X + itemdesc: Label error + definition: never present + format: fixed + octet: 1 + - itemno: I010/090 + frn: 22 + rule: optional + itemdesc: Mode C Code (Height) + definition: Mode C height converted into binary representation on two bytes fixed length data item. + format: fixed + octet: 2 + structure: + - name: V + frombit: 16 + codes: + 0: Code validated + 1: Code not validated + - name: G + frombit: 15 + codes: + 0: Default value + 1: Garbled code + - name: S + frombit: 14 + desc: sign bit + - name: FL + frombit: 13 + tobit: 1 + datatype: int + desc: Mode C HEIGHT + resolution: 0.25 + unit: FL + - itemno: I010/044 + frn: 23 + rule: X + itemdesc: Target heading in degrees referenced to the North. + definition: never present + format: fixed + octet: 1 + - itemno: I010/078 + frn: 24 + rule: X + itemdesc: Aircraft Type + definition: never present + format: fixed + octet: 8 + - itemno: I010/080 + frn: 25 + rule: optional + itemdesc: Parking Position allocation + definition: Stand information for arrivals and/or de-icing zone/de-icing pad for departures that taxi for de-icing + format: fixed + octet: 4 + structure: + - name: STAND + frombit: 32 + tobit: 1 + desc: Parking Position allocation + datatype: ascii +# - name: Char2 +# frombit: 24 +# tobit: 17 +# desc: Char2 +# datatype: string +# - name: Char3 +# frombit: 16 +# tobit: 9 +# desc: Char3 +# datatype: string +# - name: Char4 +# frombit: 8 +# tobit: 1 +# desc: Char4 +# datatype: string + - itemno: I010/034 + frn: 26 + rule: X + itemdesc: Control alert + definition: never present + format: variable + octet: 1 + - itemno: I010/132 + frn: 27 + rule: X + itemdesc: Maneuver and Movement status + definition: never present + format: variable + octet: 1 + - itemno: I010/046 + frn: 28 + rule: X + itemdesc: Topological position and TopoObject-Id + definition: never present + format: fixed + octet: 10 + - itemno: I010/401 + frn: 29 + rule: optional + itemdesc: Time To Threshold + definition: Time To Threshold + format: variable + octet: 0 + - itemno: I010/401-1 + frn: 2901 + rule: optional + itemdesc: Time To Threshold + definition: Time To Threshold + format: fixed + octet: 2 + structure: + - name: SRC + frombit: 16 + tobit: 16 + desc: SRC + codes: + 0: TTT source is ARTS / Approach. + 1: TTT source is SDF. + - name: CST + frombit: 15 + tobit: 15 + desc: CST + codes: + 0: approach system or computed by SDF basing on an updated. + 1: extrapolated basing on computed. + - name: WRN + frombit: 14 + tobit: 14 + desc: WRN + codes: + 0: Normal condition. + 1: configurable threshold. + - name: TTT + frombit: 10 + tobit: 2 + desc: Seconds needed by aircraft to reach runway threshold. + unit: sec + max: 511 + min: 0 + - name: FX + frombit: 1 + tobit: 1 + codes: + 0: No additional bytes are present. + 1: Field extension. + - itemno: I010/401-2 + frn: 2902 + rule: optional + itemdesc: name of the runway + definition: name of the runway + format: fixed + octet: 3 + structure: + - name: NU1 + frombit: 24 + tobit: 17 + desc: First digit. + datatype: ascii + - name: NU2 + frombit: 16 + tobit: 9 + desc: Second digit. + datatype: ascii + - name: LTR + frombit: 8 + tobit: 1 + desc: Letter. + datatype: ascii + - itemno: I010/400 + frn: 35 + rule: mandatory + itemdesc: Identification of fused Sensors + definition: Identification of fused Sensors + format: variable + octet: 1 + - itemno: I010/400-1 + frn: 3501 + rule: mandatory + itemdesc: Identification of fused Sensors + definition: Identification of fused Sensors + format: fixed + octet: 1 + structure: + - name: S7 + frombit: 8 + desc: sensor7 + codes: + 0: target not detected by sensor + 1: target detected by sensor + - name: S6 + frombit: 7 + desc: sensor6 + codes: + 0: target not detected by sensor + 1: target detected by sensor + - name: S5 + frombit: 6 + desc: sensor5 + codes: + 0: target not detected by sensor + 1: target detected by sensor + - name: S4 + frombit: 5 + desc: sensor4 + codes: + 0: target not detected by sensor + 1: target detected by sensor + - name: S3 + frombit: 4 + desc: sensor3, target detected by ADS-B + codes: + 0: target not detected by sensor + 1: target detected by sensor + - name: S2 + frombit: 3 + desc: sensor2, target detected by Apron Control Tower SMR + codes: + 0: target not detected by sensor + 1: target detected by sensor + - name: S1 + frombit: 2 + desc: sensor1, target detected by ATCT SMR + codes: + 0: target not detected by sensor + 1: target detected by sensor + - name: EXT + frombit: 8 + desc: extension bit + - itemno: I010/081 + frn: 36 + rule: optional + itemdesc: Runway (RWY) + definition: Allocated Runway found in flight plan is set in this item. This item can deviate from the Runway threshold set in item I010/401 Time to Threshold. + format: fixed + octet: 3 + structure: + - name: RWY + frombit: 24 + tobit: 1 + desc: First ASCII character. + datatype: ascii +# - name: CHAR2 +# frombit: 16 +# tobit: 9 +# desc: Second ASCII character. +# datatype: string +# - name: CHAR3 +# frombit: 8 +# tobit: 1 +# desc: Third ASCII character. +# datatype: string + - itemno: I010/390 + frn: 37 + rule: X + itemdesc: Flight Plan Identifier (FPL-ID) + definition: never present + format: fixed + octet: 5 + - itemno: I010/082 + frn: 38 + rule: X + itemdesc: Actual Start Up Given Time (SUG) + definition: never present + format: fixed + octet: 2 + - itemno: I010/083 + frn: 39 + rule: X + itemdesc: Estimated/Actual Off-Block Time (EOFB/OFB) + definition: never present + format: fixed + octet: 2 + - itemno: I010/084 + frn: 40 + rule: optional + itemdesc: Estimated Time of Arrival (ETA) or Estimated Time of Departure (ETD) + definition: The Estimated Time of Arrival (ETA) or Estimated Time of Departure (ETD) + format: fixed + octet: 2 + structure: + - name: DAY + frombit: 16 + tobit: 15 + desc: DAY + codes: + 0: This day + 1: Last day + 2: Next day + 3: not used + - name: HOR + frombit: 14 + tobit: 9 + desc: Hours , from 0 to 23 + - name: ArrDep + frombit: 8 + tobit: 8 + desc: Arrival/Departure Flag + codes: + 0: Departure + 1: Arrival + - name: Spare + frombit: 7 + tobit: 7 + desc: Spare + - name: MIN + frombit: 6 + tobit: 1 + desc: Minutes, from 0 to 59 + - itemno: I010/085 + frn: 41 + rule: X + itemdesc: Estimated/Actual On-Block Time (EONB/ONB) + definition: never present + format: fixed + octet: 2 + - itemno: I010/391 + frn: 42 + rule: mandatory + itemdesc: Flight Plan Info (FPL-INFO) + definition: gives the CWP the information which action is allowed to execute from the controller on the track. + format: fixed + octet: 1 + structure: + - name: Drag&Drop + frombit: 8 + tobit: 8 + desc: Drag&Drop Assignment + codes: + 0: Forbidden + 1: Allowed + - name: Manual + frombit: 7 + tobit: 7 + desc: Manual Assignment + codes: + 0: Forbidden + 1: Allowed + - name: Deassignment + frombit: 6 + tobit: 6 + desc: Deassignment + codes: + 0: Forbidden + 1: Allowed + - name: Condition + frombit: 5 + tobit: 4 + desc: Condition + codes: + 0: No flight plan is correlated with the track + 1: Automatic identified track + 2: Drag&drop identified track + 3: Callsign manually assigned by operator + - name: Command + frombit: 3 + tobit: 2 + desc: Command + codes: + 0: deassign + 1: assign via automatic + 2: assign via drag&drop + 3: assign via manual + - name: SPA + frombit: 1 + tobit: 1 + desc: Spare Bit diff --git a/src/main/resources/spec/alterixCat011.yml b/src/main/resources/spec/alterixCat011.yml index d5fc7a6..1dfa9e1 100644 --- a/src/main/resources/spec/alterixCat011.yml +++ b/src/main/resources/spec/alterixCat011.yml @@ -1,1643 +1,1643 @@ -# CAT-11 Transmission of A-SMGCS Data -cat: 11 -ver: 1.3 -dataitem: - - itemno: I011/010 - itemdesc: Data Source Identifier - frn: 1 - definition: "Identification of the radar station from which the data are received." - format: fixed - octet: 2 - structure: - - name: SAC - frombit: 16 - tobit: 9 - desc: System Area Code Fixed to Zero - - name: SIC - frombit: 8 - tobit: 1 - desc: System Identification Code - dataItemNote: "Note: The SAC is fixed to zero to indicate a data flow local to the airport." - - itemno: I011/000 - itemdesc: Message Type - frn: 2 - definition: "This Data Item allows for a more convenient - handling of the messagesat the receiver side by further defining - the type of transaction." - format: fixed - octet: 1 - structure: - - name: MT - frombit: 8 - tobit: 1 - desc: Message Type - codes: - 1: Target reports, flight plan data and basic alerts - 2: Manual attachment of flight plan to track - 3: Manual detachment of flight plan to track - 4: Insertion of flight plan data - 5: Suppression of flight plan data - 6: Modification of flight plan data - 7: Holdbar status - - itemno: I011/015 - itemdesc: Service Identification - frn: 3 - definition: "Identification of the service provided to one or more users." - octet: 1 - format: fixed - structure: - - name: SI - frombit: 8 - tobit: 1 - desc: Service Identification - dataItemNote: "Note: The service identification is allocated by the A-SMGCS" - - itemno: I011/140 - itemdesc: Time of Track Information - frn: 4 - definition: "Absolute time stamping expressed as UTC." - format: fixed - octet: 3 - structure: - - name: ToTI - frombit: 24 - tobit: 1 - datatype: uint - desc: Time of Track Information - resolution: 0.0078125 - unit: s - dataItemNote: "Note: The Time of Track Information value is reset to zero each day at midnight." - - itemno: I011/041 - itemdesc: Position in WGS-84 Coordinates - frn: 5 - definition: "Position of a target in WGS-84 Coordinates." - octet: 8 - format: fixed - structure: - - name: LAT - serviceFieldName: lat_wgs - frombit: 64 - tobit: 33 - datatype: int - desc: Latitude in WGS-84 in Twos Complement - resolution: 0.00000008381903171539306640625 - min: "-90" - max: 90 - unit: deg - - name: LON - serviceFieldName: lon_wgs - frombit: 32 - tobit: 1 - datatype: int - desc: Longitude in WGS-84 in Twos Complement - resolution: 0.00000008381903171539306640625 - min: "-180" - max: 180 - unit: deg - - itemno: I011/042 - itemdesc: Calculated Position in Cartesian Co-ordinates - frn: 6 - definition: "Calculated position of a target in Cartesian co-ordinates (twos complement form)." - format: fixed - octet: 4 - structure: - - name: X-Component - serviceFieldName: lat - frombit: 32 - tobit: 17 - datatype: int - desc: X-Component - resolution: 1.0 - min: "-32768" - max: 32768 - unit: m - - name: Y-Component - serviceFieldName: lon - frombit: 16 - tobit: 1 - datatype: int - desc: Y-Component - resolution: 1.0 - min: "-32768" - max: 32768 - unit: m - - itemno: I011/202 - itemdesc: Calculated Track Velocity in Cartesian Coordinates - frn: 7 - definition: "Calculated track velocity expressed in Cartesian co-ordinates." - format: fixed - octet: 4 - structure: - - name: VX - serviceFieldName: spd - frombit: 32 - tobit: 17 - desc: Vx - resolution: 0.25 - min: "-8192" - max: 8192 - unit: m/s - datatype: int - - name: VY - serviceFieldName: spd - frombit: 16 - tobit: 1 - desc: Vy - resolution: 0.25 - min: "-8192" - max: 8192 - unit: m/s - datatype: int - - itemno: I011/210 - itemdesc: Calculated Acceleration - frn: 8 - definition: "Calculated Acceleration of the target, in twos complement form." - format: fixed - octet: 2 - structure: - - name: AX - frombit: 16 - tobit: 9 - datatype: int - desc: Ax - resolution: 0.25 - min: "-31" - max: 31 - unit: m/s2 - - name: AY - frombit: 8 - tobit: 1 - datatype: int - desc: Ay - resolution: 0.25 - min: "-31" - max: 31 - unit: m/s2 - - itemno: I011/060 - itemdesc: Mode-3/A Code in Octal Representation - frn: 9 - definition: "Track Mode-3/A code converted into Octal Representation." - format: fixed - octet: 2 - structure: -# - name: spare -# frombit: 16 -# tobit: 13 -# desc: Spare bit(s) set to 0 - - name: MOD3A - serviceFieldName: ssr_cd - frombit: 12 - tobit: 1 - datatype: octal - desc: Mode-3/A Reply in Octal Representation - - itemno: I011/245 - itemdesc: Target Identification - frn: 10 - definition: "Target (aircraft or vehicle) identification in 8 characters." - format: fixed - octet: 7 - structure: - - name: STI - frombit: 56 - tobit: 55 - codes: - 0: Callsign or registration downlinked from transponder - 1: Callsign not downlinked from transponder - 2: Registration not downlinked from transponder -# - name: spare -# frombit: 54 -# tobit: 49 -# desc: Spare bit(s) set to 0 - - name: TID - serviceFieldName: trgt_id - frombit: 48 - tobit: 1 - datatype: 6bitschar - desc: Target Identification - dataItemNote: "Note: Characters 1-8 (coded on 6 bits each) defining target identification" - - itemno: I011/380 - itemdesc: Mode-S / ADS-B Related Data - frn: 11 - definition: "Data specific to Mode-S ADS-B." - format: compound - octet: 1 - - itemno: I011/380-1 - title: Mode S MB Data - frn: 1101 - definition: - format: repetitive - octet: 9 - structure: - - name: REP - desc: Repetition facto - frombit: 72 - tobit: 65 - - name: MB-data - desc: 56 bit message conveying Mode S B message data - frombit: 64 - tobit: 9 - datatype: ascii - - name: BDS1 - desc: Comm B data Buffer Store 1 Address - frombit: 8 - tobit: 5 - datatype: string - - name: BDS2 - desc: Comm B data Buffer Store 2 Address - frombit: 4 - tobit: 1 - datatype: string - dataItemNote: "Note: Repetitive starting with an one-octet Field Repetition Indicator (REP) followed by at least one BDS report comprising one seven octet BDS register and one octet BDS code" - - itemno: I011/380-2 - frn: 1102 - title: Aircraft Address - definition: Aircraft Address - format: fixed - octet: 3 - structure: - - name: ADR - serviceFieldName: mode_s_cd - frombit: 24 - tobit: 1 - desc: 24 bits Aircraft address, A23 to A0 -# - itemno: I011/380-3 # Never Sent - - itemno: I011/380-4 - frn: 1104 - title: Communications/ACAS Capability and Flight Status - definition: Communications/ACAS Capability and Flight Status - format: fixed - octet: 3 - structure: - - name: COM - frombit: 24 - tobit: 22 - desc: Communications capability of the ransponder - codes: - 0: No communications capability (surveillance only) - 1: Comm. A and Comm. B capability - 2: Comm. A, Comm. B and Uplink ELM - 3: Comm. A, Comm. B, Uplink ELM and Downlink ELM - 4: Level 5 Transponder capability - 5: Not assigned - 6: Not assigned - 7: Not assigned - - name: STAT - frombit: 21 - tobit: 18 - desc: Flight Status - codes: - 0: No alert, no SPI, aircraft airborne - 1: No alert, no SPI, aircraft on ground - 2: Alert, no SPI, aircraft airborne - 3: Alert, no SPI, aircraft on ground - 4: Alert, SPI, aircraft airborne or on ground - 5: No alert, SPI, aircraft airborne or on ground - 6: General Emergency - 7: Lifeguard / medical - 8: Minimum fuel - 9: No communications - 10: Unlawful interference -# - name: spare -# frombit: 17 -# tobit: 17 -# desc: Spare bit(s) set to 0 - - name: SSC - frombit: 16 - tobit: 16 - desc: Specific Service Capability - codes: - 0: No - 1: Yes - - name: ARC - frombit: 15 - tobit: 15 - desc: Altitude Reporting Capability - codes: - 0: 100 ft resolution - 1: 25 ft resolution - - name: AIC - frombit: 14 - tobit: 14 - desc: Aircraft Identification Capability - codes: - 0: No - 1: Yes - - name: B1A - frombit: 13 - tobit: 13 - desc: BDS 1,0 Bit 16 - - name: B1B - frombit: 12 - tobit: 9 - desc: BDS 1,0 Bit 37/40 - - name: AC - frombit: 8 - tobit: 8 - desc: ACAS Operational - codes: - 0: No - 1: Yes - - name: MN - frombit: 7 - tobit: 7 - desc: Multiple Navigational Aids Operating - codes: - 0: No - 1: Yes - - name: DC - frombit: 6 - tobit: 6 - desc: Differential Correction - codes: - 0: Yes - 1: No -# - name: spare -# frombit: 5 -# tobit: 1 -# desc: Spare bits set to 0 -# - itemno: I011/380-5 # Never Sent -# - itemno: I011/380-6 # Never Sent -# - itemno: I011/380-7 # Never Sent - - itemno: I011/380-8 - frn: 1108 - title: Aircraft Derived Aircraft Type - definition: Aircraft Derived Aircraft Type - format: fixed - octet: 4 - structure: - - name: ACT - frombit: 32 - tobit: 1 - datatype: ascii - desc: Aircraft Derived Aircraft Type - dataItemNote: "Note: Each of the four bytes composing the type of an aircraft contains an ASCII Character \n - (upper-case alphanumeric characters with trailing spaces)." - - itemno: I011/380-9 - frn: 1109 - title: Emitter Category - definition: Emitter Category - format: fixed - octet: 1 - structure: - - name: ECAT - desc: Emitter Category - frombit: 8 - tobit: 1 - codes: - 1: Light aircraft <= 7000 kg - 2: Reserved - 3: 7000 kg < medium aircraft < 136000 kg - 4: Reserved - 5: 136000 kg <= heavy aircraft - 6: Highly manoeuvrable (5g acceleration capability) and high speed (>400 knots cruise) - 7: Reserved - 8: Reserved - 9: Reserved - 10: Rotocraft - 11: Glider / sailplane - 12: Lighter-than-air - 13: Unmanned aerial vehicle - 14: Space / transatmospheric vehicle - 15: Ultralight / handglider / paraglider - 16: Parachutist / skydiver - 17: Reserved - 18: Reserved - 19: Reserved - 20: Surface emergency vehicle - 21: Surface service vehicle - 22: Fixed ground or tethered obstruction - 23: Reserved - 24: Reserved -# - itemno: I011/380-10 # Never Sent - - itemno: I011/380-11 - frn: 1111 - title: Available Technologies - definition: Available Technologies - format: fixed - octet: 1 - structure: - - name: VDL - frombit: 8 - tobit: 8 - desc: VDL Mode 4 - codes: - 0: VDL Mode 4 available - 1: VDL Mode 4 not available - - name: MDS - frombit: 7 - tobit: 7 - desc: Mode S - codes: - 0: Mode S available - 1: Mode S not available - - name: UAT - frombit: 6 - tobit: 6 - desc: UAT - codes: - 0: UAT available - 1: UAT not available -# - name: spare -# frombit: 5 -# tobit: 1 -# desc: Spare bit(s) set to 0 - - itemno: I011/161 - frn: 12 - itemdesc: Track Number - definition: "Identification of a fusion track (single track number)." - format: fixed - octet: 2 - structure: -# - name: spare -# frombit: 16 -# desc: Spare bit(s) set to 0 - - name: FTN - serviceFieldName: track_no - frombit: 15 - tobit: 1 - desc: Fusion Track Number - - itemno: I011/170 - itemdesc: Track Status - frn: 13 - definition: "Status of track." - format: variable - octet: 1 - - itemno: I011/170-1 - itemdesc: Track Status - frn: 1301 - definition: "Status of track." - format: fixed - octet: 1 - structure: - - name: MON - frombit: 8 - tobit: 8 - codes: - 0: Multisensor Track - 1: Monosensor Track - - name: GBS - frombit: 7 - tobit: 7 - codes: - 0: Transponder Ground bit not set or unknown - 1: Transponder Ground bit set - - name: MRH - frombit: 6 - tobit: 6 - codes: - 0: Barometric altitude (Mode C) more reliable - 1: Geometric altitude more reliable - - name: SRC - frombit: 5 - tobit: 3 - codes: - 0: No source - 1: GPS - 2: 3d radar - 3: Triangulation - 4: Height from coverage - 5: Speed look-up table - 6: Default height - 7: Multilateration - - name: CNF - frombit: 2 - tobit: 2 - codes: - 0: Confirmed track - 1: Tentative track - - name: FX - frombit: 1 - tobit: 1 - desc: Extension Indicator - codes: - 0: End of Data Item - 1: Extension into first extent - - itemno: I011/170-2 - itemdesc: Track Status - frn: 1302 - definition: First Extension of Data Item. - format: fixed - octet: 1 - structure: - - name: SIM - frombit: 8 - tobit: 8 - codes: - 0: Actual Track - 1: Simulated track - - name: TSE - frombit: 7 - tobit: 7 - codes: - 0: Default value - 1: Track service end (i.e. last message transmitted to the user for the track) - - name: TSB - frombit: 6 - tobit: 6 - codes: - 0: Default value - 1: Track service begin (i.e. first message transmitted to the user for the track) - - name: FRIFOE - frombit: 5 - tobit: 4 - codes: - 0: No Mode 4 interrogationt - 1: Friendly target - 2: Unknown target - 3: No reply - - name: ME - frombit: 3 - tobit: 3 - codes: - 0: Default value - 1: Military Emergency present in the last report received from a sensor capable of decoding this data - - name: MI - frombit: 2 - tobit: 2 - codes: - 0: Default value - 1: Military Identification present in the last report received from a sensor capable of decoding this data - - name: FX - frombit: 1 - tobit: 1 - desc: Extension Indicator - codes: - 0: End of Data Item - 1: Extension - - itemno: I011/170-3 - itemdesc: Track Status - frn: 1303 - definition: Second Extension of Data Item. - format: fixed - octet: 1 - structure: - - name: AMA - frombit: 8 - codes: - 0: Track not resulting from amalgamation process - 1: Track resulting from amalgamation process - - name: SPI - frombit: 7 - codes: - 0: Default value - 1: SPI present in the last report received from a sensor capable of decoding this data - - name: CST - frombit: 6 - codes: - 0: Default value - 1: Age of the last received track update is higher than system dependent threshold (coasting) - - name: FPC - frombit: 5 - codes: - 0: Not flight-plan correlated - 1: Flight plan correlated - - name: AFF - frombit: 4 - codes: - 0: Default value - 1: ADS-B data inconsistent with other surveillance information -# - name: spare -# frombit: 3 -# tobit: 2 -# desc: Spare bit(s) set to 0 - - name: FX - frombit: 1 - tobit: 1 - desc: Extension Indicator - codes: - 0: End of Data Item - 1: Extension - - itemno: I011/170-4 - itemdesc: Track Status - frn: 1304 - definition: Third Extension of Data Item - format: fixed - octet: 1 - structure: -# - name: spare -# frombit: 8 -# desc: Spare bit(s) set to 0 - - name: PSR - frombit: 7 - codes: - 0: Default value - 1: Age of the last received PSR track update is higher than system dependent threshold - - name: SSR - frombit: 6 - codes: - 0: Default value - 1: Age of the last received SSR track update is higher than system dependent threshold - - name: MDS - frombit: 5 - codes: - 0: Default value - 1: Age of the last received Mode S track update is higher than system dependent threshold - - name: ADS - frombit: 4 - codes: - 0: Default value - 1: Age of the last received ADS track update is higher than system dependent threshold - - name: SUC - frombit: 3 - codes: - 0: Default value - 1: Special Used Code (Mode A codes to be defined in the system to mark a track with special interest) - - name: AAC - frombit: 2 - codes: - 0: Default value - 1: Assigned Mode A Code Conflict (same individual Mode A Code assigned to another track) - - name: FX - frombit: 1 - tobit: 1 - desc: Extension Indicator - codes: - 0: End of Data Item - 1: Extension - dataItemNote: "Track type and coasting can also be derived from Data Item I011/290 System Track Update Ages" - - itemno: I011/290 - itemdesc: System Track Update Ages - frn: 14 - definition: "Ages of the last plot/local track, or the last valid mode-A/mode-C, used to update the system track." - format: compound - octet: 2 - - itemno: I011/290-1 - itemdesc: System Track Update Ages - frn: 1401 - definition: PSR Age. - format: fixed - octet: 1 - structure: - - name: PSR - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last Primary Report Used to Update the Track - resolution: 0.25 - unit: s - - itemno: I011/290-2 - itemdesc: System Track Update Ages - frn: 1402 - definition: SSR Age. - format: fixed - octet: 1 - structure: - - name: SSR - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last Secondary Report Used to Update the Track - resolution: 0.25 - unit: s - - itemno: I011/290-3 - itemdesc: System Track Update Ages - frn: 1403 - definition: MDA Age. - format: fixed - octet: 1 - structure: - - name: MDA - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last Valid Mode A Report Used to Update the Track - resolution: 0.25 - unit: s - - itemno: I011/290-4 - itemdesc: System Track Update Ages - frn: 1404 - definition: MFL Age. - format: fixed - octet: 1 - structure: - - name: MFL - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last Valid and Credible Mode C Used to Update the - Track - resolution: 0.25 - unit: s - - itemno: I011/290-5 - itemdesc: System Track Update Ages - frn: 1405 - definition: MDS Age. - format: fixed - octet: 1 - structure: - - name: MDS - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last Mode S Report Used to Update the Track - resolution: 0.25 - unit: s - - itemno: I011/290-6 - itemdesc: System Track Update Ages - frn: 1406 - definition: ADS Age. - format: fixed - octet: 2 - structure: - - name: ADS - frombit: 16 - tobit: 1 - datatype: uint - desc: Age of the Last ADS Report Used to Update the Track - resolution: 0.25 - unit: s - - itemno: I011/290-7 - itemdesc: System Track Update Ages - frn: 1407 - definition: ADB Age. - format: fixed - octet: 1 - structure: - - name: ADB - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last ADS-B Report Used to Update the Track - resolution: 0.25 - unit: s - - itemno: I011/290-8 - itemdesc: System Track Update Ages - frn: 1408 - definition: MD1 Age. - format: fixed - octet: 1 - structure: - - name: MD1 - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last Valid Mode 1 Used to Update the Track - resolution: 0.25 - unit: s - - itemno: I011/290-9 - itemdesc: System Track Update Ages - frn: 1409 - definition: MD2 Age. - format: fixed - octet: 1 - structure: - - name: MD2 - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last Valid Mode 2 Used to Update the Track - resolution: 0.25 - unit: s - - itemno: I011/290-10 - itemdesc: System Track Update Ages - frn: 1410 - definition: LOP Age. - format: fixed - octet: 1 - structure: - - name: LOP - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last Magentic Loop Detection - resolution: 0.25 - unit: s - - itemno: I011/290-11 - itemdesc: System Track Update Ages - frn: 1411 - definition: TRK Age. - format: fixed - octet: 1 - structure: - - name: TRK - frombit: 8 - tobit: 1 - datatype: uint - desc: Actual Track Age Since First Occurrence - resolution: 0.25 - unit: s - - itemno: I011/290-12 - itemdesc: System Track Update Ages - frn: 1412 - definition: MUL Age. - format: fixed - octet: 1 - structure: - - name: MUL - frombit: 8 - tobit: 1 - datatype: uint - desc: Age of the Last Multilateration Detection - resolution: 0.25 - unit: s - dataItemNote: "Note: The ages are counted from Data Item I011/140, Time Of Track Information, \n - using the following formula: Age = Time of track information - Time of last (valid) \n - update If the computed age is greater than the maximum value \n - or if the data has never been received, then the corresponding subfield is not sent." - - itemno: I011/430 - itemdesc: Phase of Flight - frn: 15 - definition: "Current phase of the flight." - format: fixed - octet: 1 - structure: - - name: PoF - frombit: 8 - tobit: 1 - desc: Phase of Flight - codes: - 0: Unknown - 1: On stand - 2: Taxiing for departure - 3: Taxiing for arrival - 4: Runway for departure - 5: Runway for arrival - 6: Hold for departure - 7: Hold for arrival - 8: Push back - 9: On finals - - itemno: I011/090 - itemdesc: Measured Flight Level - frn: 16 - definition: "Last valid and credible flight level used to update the track, in twos complement representation." - format: fixed - octet: 2 - structure: - - name: MFL - frombit: 16 - tobit: 1 - datatype: int - desc: Measured Flight Level - resolution: 0.25 - min: "-12" - max: 1500 - unit: FL - dataItemNote: "Note: The criteria to determine - the credibility of the flight level are Tracker dependent. Credible - means: within reasonable range of change with respect to the previous detection." - - itemno: I011/093 - itemdesc: Calculated Track Barometric Altitude - frn: 17 - definition: "Calculated Barometric Altitude of the track." - format: fixed - octet: 2 - structure: - - name: QNH - frombit: 16 - desc: QNH Correction Applied - codes: - 0: No QNH Correction Applied - 1: QNH Correction Applied - - name: CTBA - serviceFieldName: alt - frombit: 15 - tobit: 1 - datatype: int - desc: Calculated Track Barometric Altitude - resolution: 0.25 - min: "-15" - max: 1500 - unit: FL - - itemno: I011/092 - itemdesc: Calculated Track Geometric Altitude - frn: 18 - definition: "Calculated geometric vertical distance above mean sea level, not related to barometric pressure." - format: fixed - octet: 2 - structure: - - name: CTGA - frombit: 16 - tobit: 1 - desc: Calculated Track Geometric Altitude - resolution: 6.25 - min: "-1500" - max: 150000 - unit: ft - dataItemNote: "Note: The source of altitude is identified in bits (SRC) of item I011/170 Track Status." - - itemno: I011/215 - itemdesc: Calculated Rate Of Climb/Descent - frn: 19 - definition: "Calculated rate of Climb/Descent of an aircraft, in twos complement form." - format: fixed - octet: 2 - structure: - - name: CROC - frombit: 16 - tobit: 1 - datatype: int - desc: Calculated Rate Of Climb/Descent - resolution: 6.25 - min: "-204800" - max: 204800 - unit: ft/min - - itemno: I011/270 - itemdesc: Target Size and Orientation - frn: 20 - definition: "Target size defined as length and with of the detected target, and orientation." - format: variable - octet: 1 - - itemno: I011/270-1 - itemdesc: Target Size and Orientation - frn: 2001 - definition: First Part - format: fixed - octet: 1 - structure: - - name: LENGTH - frombit: 8 - tobit: 2 - datatype: uint - desc: Length - resolution: 1.0 - unit: m - - name: FX - frombit: 1 - tobit: 1 - desc: Extension Indicator - codes: - 0: End of Data Item - 1: Extension - - itemno: I011/270-2 - itemdesc: Target Size and Orientation - frn: 2002 - definition: First Part - format: fixed - octet: 1 - structure: - - name: ORIENTATION - serviceFieldName: cos - frombit: 8 - tobit: 2 - datatype: uint - desc: Orientation - resolution: 2.8125 - unit: deg - - name: FX - frombit: 1 - fx: 1 - desc: Extension Indicator - codes: - 0: End of Data Item - 1: Extension - - itemno: I011/270-3 - itemdesc: Target Size and Orientation - frn: 2003 - definition: Second Extent - format: fixed - octet: 1 - structure: - - name: WIDTH - frombit: 8 - tobit: 2 - datatype: uint - desc: Width - resolution: 1.0 - unit: m - - name: FX - frombit: 1 - tobit: 1 - desc: Extension Indicator - codes: - 0: End of Data Item - 1: Extension - dataItemNote: "Note: The orientation gives the direction to which the aircraft nose is pointing, relative to the Geographical North." - - itemno: I011/390 - itemdesc: Flight Plan Related Data - frn: 21 - definition: "All flight plan related information." - format: compound - octet: 2 - - itemno: I011/390-1 - itemdesc: Flight Plan Related Data - frn: 2101 - definition: FPPS Identification Tag - format: fixed - octet: 1 - structure: - - name: SAC - frombit: 16 - tobit: 9 - desc: System Area Code - - name: SIC - frombit: 8 - tobit: 1 - desc: System Identity Code - - itemno: I011/390-2 - itemdesc: Flight Plan Related Data - frn: 2102 - definition: Callsign - format: fixed - octet: 7 - structure: - - name: CSN - serviceFieldName: clsgn - frombit: 56 - tobit: 1 - datatype: ascii - desc: Callsign - dataItemNote: "note: Each of the seven Octets contains an ASCII Character. The Callsign is always left adjusted. It contains up to seven upper-case alphanumeric characters, the remaining character positions (if any) are padded with space characters." - - itemno: I011/390-3 - itemdesc: Flight Plan Related Data - frn: 2103 - definition: IFPS_FLIGHT_ID - format: fixed - octet: 4 - structure: - - name: TYP - frombit: 32 - tobit: 31 - desc: IFPS Flight ID Type - codes: - 0: Plan number - 1: Unit 1 internal flight number - 2: Unit 2 internal flight number - 3: Unit 3 internal flight number -# - name: spare -# frombit: 30 -# tobit: 28 -# desc: Spare bit(s) set to 0 - - name: NBR - frombit: 27 - tobit: 1 - desc: IFPS Flight ID Number - - itemno: I011/390-4 - itemdesc: Flight Plan Related Data - frn: 2104 - definition: Flight Category - format: fixed - octet: 1 - structure: - - name: GATOAT - frombit: 8 - tobit: 7 - desc: Flight Type - codes: - 0: Unknown - 1: General Air Traffic - 2: Operational Air Traffic - 3: Not applicable - - name: FR1FR2 - frombit: 6 - tobit: 5 - desc: Flight Rules - codes: - 0: Instrument Flight Rules - 1: Visual Flight Rules - 2: Not applicable - 3: Controlled Visual Flight Rules - - name: RVSM - frombit: 4 - tobit: 3 - desc: RVSM - codes: - 0: Unknown - 1: Approved - 2: Exempt - 3: Not Approved - - name: HPR - frombit: 2 - desc: Flight Priority - codes: - 0: Normal Priority Flight - 1: High Priority Flight -# - name: spare -# frombit: 1 -# desc: Spare bit(s) set to 0 - - itemno: I011/390-5 - itemdesc: Flight Plan Related Data - frn: 2105 - definition: Type of Aircraft - format: fixed - octet: 4 - structure: - - name: TOA - frombit: 32 - tobit: 1 - datatype: ascii - desc: Type of Aircraft - - itemno: I011/390-6 - itemdesc: Flight Plan Related Data - frn: 2106 - definition: Wake Turbulence Category - format: fixed - octet: 1 - structure: - - name: WTC - frombit: 8 - tobit: 1 - desc: Wake Turbulence Category - codes: - 72: Heavy # H - 74: Super # J - 76: Light # L - 77: Medium # M - - itemno: I011/390-7 - itemdesc: Flight Plan Related Data - frn: 2107 - definition: Departure Airport - format: fixed - octet: 4 - structure: - - name: ADEP - frombit: 32 - tobit: 1 - datatype: ascii - desc: Departure Airport - - itemno: I011/390-8 - itemdesc: Flight Plan Related Data - frn: 2108 - definition: Destination Airport - format: fixed - octet: 4 - structure: - - name: ADES - frombit: 32 - tobit: 1 - datatype: ascii - desc: Destination Airport - - itemno: I011/390-9 - itemdesc: Flight Plan Related Data - frn: 2109 - definition: Runway Designation - format: fixed - octet: 3 - structure: - - name: RWY - frombit: 24 - tobit: 1 - datatype: ascii - desc: Runway Designation - - itemno: I011/390-10 - itemdesc: Flight Plan Related Data - frn: 2110 - definition: Current Cleared Flight Level - format: fixed - octet: 2 - structure: - - name: CFL - frombit: 16 - tobit: 1 - datatype: uint - desc: Current Cleared Flight Level - resolution: 0.25 - unit: FL - - itemno: I011/390-11 - itemdesc: Flight Plan Related Data - frn: 2111 - definition: Current Cleared Flight Level - format: fixed - octet: 2 - structure: - - name: CENTRE - frombit: 16 - tobit: 9 - desc: 8-bit Group Identification Code - - name: POSITION - frombit: 8 - tobit: 1 - desc: 8-bit Control Position Identification Code - - itemno: I011/390-12 - itemdesc: Flight Plan Related Data - frn: 2112 - definition: Time of Departure - format: repetitive - octet: 5 - structure: - - name: REP - frombit: 40 - tobit: 33 - desc: Repetition Factor - - name: TYP - frombit: 32 - tobit: 28 - desc: Time Type - codes: - 0: Scheduled off-block time - 1: Estimated off-block time - 2: Estimated take-off time - 3: Actual off-block time - 4: Predicted time at runway hold - 5: Actual time at runway hold - 6: Actual line-up time - 7: Actual take-off time - 8: Estimated time of arrival - 9: Predicted landing time - 10: Actual landing time - 11: Actual time off runway - 12: Predicted time to gate - 13: Actual on-block time - - name: DAY - frombit: 27 - tobit: 26 - desc: Day - codes: - 0: Today - 1: Yesterday - 2: Tomorrow -# - name: spare -# frombit: 25 -# tobit: 22 -# desc: spare bits set to zero - - name: HOR - frombit: 21 - tobit: 17 - datatype: uint - desc: Hours, from 0 to 23 - min: 0 - max: 23 -# - name: spare -# frombit: 16 -# tobit: 15 -# desc: Spare bit(s) set to 0 - - name: MIN - frombit: 14 - tobit: 9 - datatype: uint - desc: Minutes, from 0 to 59 - min: 0 - max: 59 - - name: AVS - frombit: 8 - desc: Seconds Available - codes: - 0: Seconds available - 1: Seconds not available -# - name: spare -# frombit: 7 -# desc: Spare bit(s) set to 0 - - name: SEC - frombit: 6 - tobit: 1 - datatype: uint - desc: Seconds, from 0 to 59 - min: 0 - max: 59 - - itemno: I011/390-13 - itemdesc: Flight Plan Related Data - frn: 2113 - definition: Aircraft Stand - format: fixed - octet: 6 - structure: - - name: AST - frombit: 48 - tobit: 1 - datatype: ascii - desc: Aircraft Stand - - itemno: I011/390-14 - itemdesc: Flight Plan Related Data - frn: 2114 - definition: Stand Status - format: fixed - octet: 1 - structure: - - name: EMP - frombit: 8 - tobit: 7 - desc: Stand Empty - codes: - 0: Empty - 1: Occupied - 2: Unknown - - name: AVL - frombit: 6 - tobit: 5 - desc: Stand Available - codes: - 0: Available - 1: Not available - 2: Unknown -# - name: spare -# frombit: 4 -# tobit: 1 - - itemno: I011/300 - itemdesc: Vehicle Fleet Identification - frn: 22 - definition: "Vehicle fleet identification number." - format: fixed - octet: 1 - structure: - - name: VFI - frombit: 8 - tobit: 1 - desc: Vehicle Fleet Identification - codes: - 0: Flyco (follow me) - 1: ATC equipment maintenance - 2: Airport maintenance - 3: Fire - 4: Bird scarer - 5: Snow plough - 6: Runway sweeper - 7: Emergency - 8: Police - 9: Bus - 10: Tug (push/tow) - 11: Grass cutter - 12: Fuel - 13: Baggage - 14: Catering - 15: Aircraft maintenance - 16: Unknown - - itemno: I011/310 - itemdesc: Pre-programmed Message - frn: 23 - definition: "Number related to a pre-programmed message that can be transmitted by a vehicle." - format: fixed - octet: 1 - structure: - - name: TRB - frombit: 8 - tobit: 8 - desc: In Trouble - codes: - 0: Default - 1: In Trouble - - name: MSG - frombit: 7 - tobit: 1 - desc: Message - codes: - 1: Towing aircraft - 2: FOLLOW-ME operation - 3: Runway check - 4: Emergency operation (fire, medical...) - 5: Work in progress (maintenance, birds scarer, sweepers...) - - itemno: I011/500 - itemdesc: Estimated Accuracies - frn: 24 - definition: "Overview of all important accuracies (standard deviations)." - octet: 1 - format: compound - - itemno: I011/500-1 - itemdesc: Estimated Accuracies - frn: 2401 - definition: Estimated Accuracy Of Track Position (Cartesian) - octet: 2 - format: fixed - structure: - - name: APC-X - frombit: 16 - tobit: 9 - datatype: uint - desc: Estimated Accuracy of the Calculated Position of X Component - resolution: 0.25 - unit: m - - name: APC-Y - frombit: 8 - tobit: 1 - datatype: uint - desc: Estimated Accuracy of the Calculated Position of Y Component - resolution: 0.25 - unit: m - - itemno: I011/500-2 - itemdesc: Estimated Accuracies - frn: 2402 - definition: Estimated Accuracy Of Track Position (WGS84) - octet: 4 - format: fixed - structure: - - name: APW-LAT - frombit: 32 - tobit: 17 - datatype: int - desc: APW Latitude Component Accuracy - resolution: 0.00000008381903171539306640625 - unit: deg - - name: APW-LON - frombit: 16 - tobit: 1 - datatype: int - desc: APW Longitude Component Accuracy - resolution: 0.00000008381903171539306640625 - unit: deg - - itemno: I011/500-3 - itemdesc: Estimated Accuracies - frn: 2403 - definition: Estimated Accuracy Of Height - octet: 2 - format: fixed - structure: - - name: ATH - frombit: 16 - tobit: 1 - datatype: int - desc: Estimated Accuracy Of the calculated altitude of an aircraft. - resolution: 0.5 - unit: m - - itemno: I011/500-4 - itemdesc: Estimated Accuracies - frn: 2404 - definition: Estimated Accuracy Of Track Velocity (Cartesian) - octet: 2 - format: fixed - structure: - - name: AVC-X - frombit: 16 - tobit: 9 - datatype: uint - desc: Estimated Accuracy of the Calculated Velocity of X Component - resolution: 0.1 - unit: m/s - - name: Y - frombit: 8 - tobit: 1 - datatype: uint - desc: Estimated Accuracy of the Calculated Velocity of Y Component - resolution: 0.1 - unit: m/s - - itemno: I011/500-5 - itemdesc: Estimated Accuracies - frn: 2405 - definition: Estimated Accuracy Of Rate Of Climb / Descent - octet: 2 - format: fixed - structure: - - name: ARC - frombit: 16 - tobit: 1 - datatype: int - desc: Estimated Accuracy Of Rate Of Climb / Descent - resolution: 0.1 - unit: m/s - - itemno: I011/500-6 - itemdesc: Estimated Accuracies - frn: 2406 - definition: Estimated Accuracy Of Acceleration (Cartesian) - octet: 2 - format: fixed - structure: - - name: AAC-X - frombit: 16 - tobit: 9 - datatype: uint - desc: Estimated Accuracy Of Acceleration of X Component - resolution: 0.01 - unit: m/s2 - - name: AAC-Y - frombit: 8 - tobit: 1 - datatype: uint - desc: Estimated Accuracy Of Acceleration of Y Component - resolution: 0.01 - unit: m/s2 - - itemno: I011/600 - itemdesc: Alert Messages - frn: 25 - definition: "Alert involving the targets indicated in I011/605." - format: fixed - octet: 3 - structure: - - name: ACK - frombit: 24 - desc: Alert Acknowleged - codes: - 0: Alert acknowledged - 1: Alert not acknowledged - - name: SVR - frombit: 23 - tobit: 22 - desc: Alert Severity - codes: - 0: End fo alert - 1: Pre-alarm - 2: Severe alert -# - name: spare -# frombit: 21 -# tobit: 17 -# desc: Spare bit(s) set to 0 - - name: AT - frombit: 16 - tobit: 9 - desc: Alert Type - - name: AN - frombit: 8 - tobit: 1 - desc: Alert Number - - itemno: I011/605 - itemdesc: Tracks in Alert - frn: 26 - definition: "List of track numbers of the targets concerned by the alert described in I011/600." - format: repetitive - octet: 2 - structure: - - name: Rep - frombit: 24 - tobit: 17 - desc: Repetition Factor -# - name: spare -# frombit: 16 -# tobit: 13 -# desc: Spare bit(s) set to 0 - - name: FTN - frombit: 12 - tobit: 1 - desc: Fusion Track Number - - itemno: I011/610 - itemdesc: Holdbar Status - frn: 27 - definition: "Status of up to sixteen banks of twelve indicators." - format: repetitive - octet: 2 - structure: - - name: Rep - frombit: 24 - tobit: 17 - desc: Repetition Factor - - name: BKN - frombit: 16 - tobit: 13 - desc: Bank Number - - name: I1 - frombit: 12 - desc: Indicator 1 - codes: - 0: Indicator on - 1: Indicator off - - name: I2 - frombit: 11 - desc: Indicator 2 - codes: - 0: Indicator on - 1: Indicator off - - name: I3 - frombit: 10 - desc: Indicator 3 - codes: - 0: Indicator on - 1: Indicator off - - name: I4 - frombit: 9 - desc: Indicator 4 - codes: - 0: Indicator on - 1: Indicator off - - name: I5 - frombit: 8 - desc: Indicator 5 - codes: - 0: Indicator on - 1: Indicator off - - name: I6 - frombit: 7 - desc: Indicator 6 - codes: - 0: Indicator on - 1: Indicator off - - name: I7 - frombit: 6 - desc: Indicator 7 - codes: - 0: Indicator on - 1: Indicator off - - name: I8 - frombit: 5 - desc: Indicator 8 - codes: - 0: Indicator on - 1: Indicator off - - name: I9 - frombit: 4 - desc: Indicator 9 - codes: - 0: Indicator on - 1: Indicator off - - name: I10 - frombit: 3 - desc: Indicator 10 - codes: - 0: Indicator on - 1: Indicator off - - name: I11 - frombit: 2 - desc: Indicator 11 - codes: - 0: Indicator on - 1: Indicator off - - name: I12 - frombit: 1 - desc: Indicator 12 - codes: - 0: Indicator on - 1: Indicator off - - itemno: SPF - itemdesc: Special Purpose Field - frn: 28 - definition: Special Purpose Field. - format: fixed - octet: 1 - structure: - - name: SPF - frombit: 8 - tobit: 1 - desc: SPF - - itemno: RE - itemdesc: Reserved Expansion Field - frn: 29 - definition: Reserved Expansion Field - format: repetitive - octet: 1 - structure: - - name: Rep - frombit: 8 - tobit: 1 +# CAT-11 Transmission of A-SMGCS Data +cat: 11 +ver: 1.3 +dataitem: + - itemno: I011/010 + itemdesc: Data Source Identifier + frn: 1 + definition: "Identification of the radar station from which the data are received." + format: fixed + octet: 2 + structure: + - name: SAC + frombit: 16 + tobit: 9 + desc: System Area Code Fixed to Zero + - name: SIC + frombit: 8 + tobit: 1 + desc: System Identification Code + dataItemNote: "Note: The SAC is fixed to zero to indicate a data flow local to the airport." + - itemno: I011/000 + itemdesc: Message Type + frn: 2 + definition: "This Data Item allows for a more convenient + handling of the messagesat the receiver side by further defining + the type of transaction." + format: fixed + octet: 1 + structure: + - name: MT + frombit: 8 + tobit: 1 + desc: Message Type + codes: + 1: Target reports, flight plan data and basic alerts + 2: Manual attachment of flight plan to track + 3: Manual detachment of flight plan to track + 4: Insertion of flight plan data + 5: Suppression of flight plan data + 6: Modification of flight plan data + 7: Holdbar status + - itemno: I011/015 + itemdesc: Service Identification + frn: 3 + definition: "Identification of the service provided to one or more users." + octet: 1 + format: fixed + structure: + - name: SI + frombit: 8 + tobit: 1 + desc: Service Identification + dataItemNote: "Note: The service identification is allocated by the A-SMGCS" + - itemno: I011/140 + itemdesc: Time of Track Information + frn: 4 + definition: "Absolute time stamping expressed as UTC." + format: fixed + octet: 3 + structure: + - name: ToTI + frombit: 24 + tobit: 1 + datatype: uint + desc: Time of Track Information + resolution: 0.0078125 + unit: s + dataItemNote: "Note: The Time of Track Information value is reset to zero each day at midnight." + - itemno: I011/041 + itemdesc: Position in WGS-84 Coordinates + frn: 5 + definition: "Position of a target in WGS-84 Coordinates." + octet: 8 + format: fixed + structure: + - name: LAT + serviceFieldName: lat_wgs + frombit: 64 + tobit: 33 + datatype: int + desc: Latitude in WGS-84 in Twos Complement + resolution: 0.00000008381903171539306640625 + min: "-90" + max: 90 + unit: deg + - name: LON + serviceFieldName: lon_wgs + frombit: 32 + tobit: 1 + datatype: int + desc: Longitude in WGS-84 in Twos Complement + resolution: 0.00000008381903171539306640625 + min: "-180" + max: 180 + unit: deg + - itemno: I011/042 + itemdesc: Calculated Position in Cartesian Co-ordinates + frn: 6 + definition: "Calculated position of a target in Cartesian co-ordinates (twos complement form)." + format: fixed + octet: 4 + structure: + - name: X-Component + serviceFieldName: lat + frombit: 32 + tobit: 17 + datatype: int + desc: X-Component + resolution: 1.0 + min: "-32768" + max: 32768 + unit: m + - name: Y-Component + serviceFieldName: lon + frombit: 16 + tobit: 1 + datatype: int + desc: Y-Component + resolution: 1.0 + min: "-32768" + max: 32768 + unit: m + - itemno: I011/202 + itemdesc: Calculated Track Velocity in Cartesian Coordinates + frn: 7 + definition: "Calculated track velocity expressed in Cartesian co-ordinates." + format: fixed + octet: 4 + structure: + - name: VX + serviceFieldName: spd + frombit: 32 + tobit: 17 + desc: Vx + resolution: 0.25 + min: "-8192" + max: 8192 + unit: m/s + datatype: int + - name: VY + serviceFieldName: spd + frombit: 16 + tobit: 1 + desc: Vy + resolution: 0.25 + min: "-8192" + max: 8192 + unit: m/s + datatype: int + - itemno: I011/210 + itemdesc: Calculated Acceleration + frn: 8 + definition: "Calculated Acceleration of the target, in twos complement form." + format: fixed + octet: 2 + structure: + - name: AX + frombit: 16 + tobit: 9 + datatype: int + desc: Ax + resolution: 0.25 + min: "-31" + max: 31 + unit: m/s2 + - name: AY + frombit: 8 + tobit: 1 + datatype: int + desc: Ay + resolution: 0.25 + min: "-31" + max: 31 + unit: m/s2 + - itemno: I011/060 + itemdesc: Mode-3/A Code in Octal Representation + frn: 9 + definition: "Track Mode-3/A code converted into Octal Representation." + format: fixed + octet: 2 + structure: +# - name: spare +# frombit: 16 +# tobit: 13 +# desc: Spare bit(s) set to 0 + - name: MOD3A + serviceFieldName: ssr_cd + frombit: 12 + tobit: 1 + datatype: octal + desc: Mode-3/A Reply in Octal Representation + - itemno: I011/245 + itemdesc: Target Identification + frn: 10 + definition: "Target (aircraft or vehicle) identification in 8 characters." + format: fixed + octet: 7 + structure: + - name: STI + frombit: 56 + tobit: 55 + codes: + 0: Callsign or registration downlinked from transponder + 1: Callsign not downlinked from transponder + 2: Registration not downlinked from transponder +# - name: spare +# frombit: 54 +# tobit: 49 +# desc: Spare bit(s) set to 0 + - name: TID + serviceFieldName: trgt_id + frombit: 48 + tobit: 1 + datatype: 6bitschar + desc: Target Identification + dataItemNote: "Note: Characters 1-8 (coded on 6 bits each) defining target identification" + - itemno: I011/380 + itemdesc: Mode-S / ADS-B Related Data + frn: 11 + definition: "Data specific to Mode-S ADS-B." + format: compound + octet: 1 + - itemno: I011/380-1 + title: Mode S MB Data + frn: 1101 + definition: + format: repetitive + octet: 9 + structure: + - name: REP + desc: Repetition facto + frombit: 72 + tobit: 65 + - name: MB-data + desc: 56 bit message conveying Mode S B message data + frombit: 64 + tobit: 9 + datatype: ascii + - name: BDS1 + desc: Comm B data Buffer Store 1 Address + frombit: 8 + tobit: 5 + datatype: string + - name: BDS2 + desc: Comm B data Buffer Store 2 Address + frombit: 4 + tobit: 1 + datatype: string + dataItemNote: "Note: Repetitive starting with an one-octet Field Repetition Indicator (REP) followed by at least one BDS report comprising one seven octet BDS register and one octet BDS code" + - itemno: I011/380-2 + frn: 1102 + title: Aircraft Address + definition: Aircraft Address + format: fixed + octet: 3 + structure: + - name: ADR + serviceFieldName: mode_s_cd + frombit: 24 + tobit: 1 + desc: 24 bits Aircraft address, A23 to A0 +# - itemno: I011/380-3 # Never Sent + - itemno: I011/380-4 + frn: 1104 + title: Communications/ACAS Capability and Flight Status + definition: Communications/ACAS Capability and Flight Status + format: fixed + octet: 3 + structure: + - name: COM + frombit: 24 + tobit: 22 + desc: Communications capability of the ransponder + codes: + 0: No communications capability (surveillance only) + 1: Comm. A and Comm. B capability + 2: Comm. A, Comm. B and Uplink ELM + 3: Comm. A, Comm. B, Uplink ELM and Downlink ELM + 4: Level 5 Transponder capability + 5: Not assigned + 6: Not assigned + 7: Not assigned + - name: STAT + frombit: 21 + tobit: 18 + desc: Flight Status + codes: + 0: No alert, no SPI, aircraft airborne + 1: No alert, no SPI, aircraft on ground + 2: Alert, no SPI, aircraft airborne + 3: Alert, no SPI, aircraft on ground + 4: Alert, SPI, aircraft airborne or on ground + 5: No alert, SPI, aircraft airborne or on ground + 6: General Emergency + 7: Lifeguard / medical + 8: Minimum fuel + 9: No communications + 10: Unlawful interference +# - name: spare +# frombit: 17 +# tobit: 17 +# desc: Spare bit(s) set to 0 + - name: SSC + frombit: 16 + tobit: 16 + desc: Specific Service Capability + codes: + 0: No + 1: Yes + - name: ARC + frombit: 15 + tobit: 15 + desc: Altitude Reporting Capability + codes: + 0: 100 ft resolution + 1: 25 ft resolution + - name: AIC + frombit: 14 + tobit: 14 + desc: Aircraft Identification Capability + codes: + 0: No + 1: Yes + - name: B1A + frombit: 13 + tobit: 13 + desc: BDS 1,0 Bit 16 + - name: B1B + frombit: 12 + tobit: 9 + desc: BDS 1,0 Bit 37/40 + - name: AC + frombit: 8 + tobit: 8 + desc: ACAS Operational + codes: + 0: No + 1: Yes + - name: MN + frombit: 7 + tobit: 7 + desc: Multiple Navigational Aids Operating + codes: + 0: No + 1: Yes + - name: DC + frombit: 6 + tobit: 6 + desc: Differential Correction + codes: + 0: Yes + 1: No +# - name: spare +# frombit: 5 +# tobit: 1 +# desc: Spare bits set to 0 +# - itemno: I011/380-5 # Never Sent +# - itemno: I011/380-6 # Never Sent +# - itemno: I011/380-7 # Never Sent + - itemno: I011/380-8 + frn: 1108 + title: Aircraft Derived Aircraft Type + definition: Aircraft Derived Aircraft Type + format: fixed + octet: 4 + structure: + - name: ACT + frombit: 32 + tobit: 1 + datatype: ascii + desc: Aircraft Derived Aircraft Type + dataItemNote: "Note: Each of the four bytes composing the type of an aircraft contains an ASCII Character \n + (upper-case alphanumeric characters with trailing spaces)." + - itemno: I011/380-9 + frn: 1109 + title: Emitter Category + definition: Emitter Category + format: fixed + octet: 1 + structure: + - name: ECAT + desc: Emitter Category + frombit: 8 + tobit: 1 + codes: + 1: Light aircraft <= 7000 kg + 2: Reserved + 3: 7000 kg < medium aircraft < 136000 kg + 4: Reserved + 5: 136000 kg <= heavy aircraft + 6: Highly manoeuvrable (5g acceleration capability) and high speed (>400 knots cruise) + 7: Reserved + 8: Reserved + 9: Reserved + 10: Rotocraft + 11: Glider / sailplane + 12: Lighter-than-air + 13: Unmanned aerial vehicle + 14: Space / transatmospheric vehicle + 15: Ultralight / handglider / paraglider + 16: Parachutist / skydiver + 17: Reserved + 18: Reserved + 19: Reserved + 20: Surface emergency vehicle + 21: Surface service vehicle + 22: Fixed ground or tethered obstruction + 23: Reserved + 24: Reserved +# - itemno: I011/380-10 # Never Sent + - itemno: I011/380-11 + frn: 1111 + title: Available Technologies + definition: Available Technologies + format: fixed + octet: 1 + structure: + - name: VDL + frombit: 8 + tobit: 8 + desc: VDL Mode 4 + codes: + 0: VDL Mode 4 available + 1: VDL Mode 4 not available + - name: MDS + frombit: 7 + tobit: 7 + desc: Mode S + codes: + 0: Mode S available + 1: Mode S not available + - name: UAT + frombit: 6 + tobit: 6 + desc: UAT + codes: + 0: UAT available + 1: UAT not available +# - name: spare +# frombit: 5 +# tobit: 1 +# desc: Spare bit(s) set to 0 + - itemno: I011/161 + frn: 12 + itemdesc: Track Number + definition: "Identification of a fusion track (single track number)." + format: fixed + octet: 2 + structure: +# - name: spare +# frombit: 16 +# desc: Spare bit(s) set to 0 + - name: FTN + serviceFieldName: track_no + frombit: 15 + tobit: 1 + desc: Fusion Track Number + - itemno: I011/170 + itemdesc: Track Status + frn: 13 + definition: "Status of track." + format: variable + octet: 1 + - itemno: I011/170-1 + itemdesc: Track Status + frn: 1301 + definition: "Status of track." + format: fixed + octet: 1 + structure: + - name: MON + frombit: 8 + tobit: 8 + codes: + 0: Multisensor Track + 1: Monosensor Track + - name: GBS + frombit: 7 + tobit: 7 + codes: + 0: Transponder Ground bit not set or unknown + 1: Transponder Ground bit set + - name: MRH + frombit: 6 + tobit: 6 + codes: + 0: Barometric altitude (Mode C) more reliable + 1: Geometric altitude more reliable + - name: SRC + frombit: 5 + tobit: 3 + codes: + 0: No source + 1: GPS + 2: 3d radar + 3: Triangulation + 4: Height from coverage + 5: Speed look-up table + 6: Default height + 7: Multilateration + - name: CNF + frombit: 2 + tobit: 2 + codes: + 0: Confirmed track + 1: Tentative track + - name: FX + frombit: 1 + tobit: 1 + desc: Extension Indicator + codes: + 0: End of Data Item + 1: Extension into first extent + - itemno: I011/170-2 + itemdesc: Track Status + frn: 1302 + definition: First Extension of Data Item. + format: fixed + octet: 1 + structure: + - name: SIM + frombit: 8 + tobit: 8 + codes: + 0: Actual Track + 1: Simulated track + - name: TSE + frombit: 7 + tobit: 7 + codes: + 0: Default value + 1: Track service end (i.e. last message transmitted to the user for the track) + - name: TSB + frombit: 6 + tobit: 6 + codes: + 0: Default value + 1: Track service begin (i.e. first message transmitted to the user for the track) + - name: FRIFOE + frombit: 5 + tobit: 4 + codes: + 0: No Mode 4 interrogationt + 1: Friendly target + 2: Unknown target + 3: No reply + - name: ME + frombit: 3 + tobit: 3 + codes: + 0: Default value + 1: Military Emergency present in the last report received from a sensor capable of decoding this data + - name: MI + frombit: 2 + tobit: 2 + codes: + 0: Default value + 1: Military Identification present in the last report received from a sensor capable of decoding this data + - name: FX + frombit: 1 + tobit: 1 + desc: Extension Indicator + codes: + 0: End of Data Item + 1: Extension + - itemno: I011/170-3 + itemdesc: Track Status + frn: 1303 + definition: Second Extension of Data Item. + format: fixed + octet: 1 + structure: + - name: AMA + frombit: 8 + codes: + 0: Track not resulting from amalgamation process + 1: Track resulting from amalgamation process + - name: SPI + frombit: 7 + codes: + 0: Default value + 1: SPI present in the last report received from a sensor capable of decoding this data + - name: CST + frombit: 6 + codes: + 0: Default value + 1: Age of the last received track update is higher than system dependent threshold (coasting) + - name: FPC + frombit: 5 + codes: + 0: Not flight-plan correlated + 1: Flight plan correlated + - name: AFF + frombit: 4 + codes: + 0: Default value + 1: ADS-B data inconsistent with other surveillance information +# - name: spare +# frombit: 3 +# tobit: 2 +# desc: Spare bit(s) set to 0 + - name: FX + frombit: 1 + tobit: 1 + desc: Extension Indicator + codes: + 0: End of Data Item + 1: Extension + - itemno: I011/170-4 + itemdesc: Track Status + frn: 1304 + definition: Third Extension of Data Item + format: fixed + octet: 1 + structure: +# - name: spare +# frombit: 8 +# desc: Spare bit(s) set to 0 + - name: PSR + frombit: 7 + codes: + 0: Default value + 1: Age of the last received PSR track update is higher than system dependent threshold + - name: SSR + frombit: 6 + codes: + 0: Default value + 1: Age of the last received SSR track update is higher than system dependent threshold + - name: MDS + frombit: 5 + codes: + 0: Default value + 1: Age of the last received Mode S track update is higher than system dependent threshold + - name: ADS + frombit: 4 + codes: + 0: Default value + 1: Age of the last received ADS track update is higher than system dependent threshold + - name: SUC + frombit: 3 + codes: + 0: Default value + 1: Special Used Code (Mode A codes to be defined in the system to mark a track with special interest) + - name: AAC + frombit: 2 + codes: + 0: Default value + 1: Assigned Mode A Code Conflict (same individual Mode A Code assigned to another track) + - name: FX + frombit: 1 + tobit: 1 + desc: Extension Indicator + codes: + 0: End of Data Item + 1: Extension + dataItemNote: "Track type and coasting can also be derived from Data Item I011/290 System Track Update Ages" + - itemno: I011/290 + itemdesc: System Track Update Ages + frn: 14 + definition: "Ages of the last plot/local track, or the last valid mode-A/mode-C, used to update the system track." + format: compound + octet: 2 + - itemno: I011/290-1 + itemdesc: System Track Update Ages + frn: 1401 + definition: PSR Age. + format: fixed + octet: 1 + structure: + - name: PSR + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last Primary Report Used to Update the Track + resolution: 0.25 + unit: s + - itemno: I011/290-2 + itemdesc: System Track Update Ages + frn: 1402 + definition: SSR Age. + format: fixed + octet: 1 + structure: + - name: SSR + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last Secondary Report Used to Update the Track + resolution: 0.25 + unit: s + - itemno: I011/290-3 + itemdesc: System Track Update Ages + frn: 1403 + definition: MDA Age. + format: fixed + octet: 1 + structure: + - name: MDA + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last Valid Mode A Report Used to Update the Track + resolution: 0.25 + unit: s + - itemno: I011/290-4 + itemdesc: System Track Update Ages + frn: 1404 + definition: MFL Age. + format: fixed + octet: 1 + structure: + - name: MFL + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last Valid and Credible Mode C Used to Update the + Track + resolution: 0.25 + unit: s + - itemno: I011/290-5 + itemdesc: System Track Update Ages + frn: 1405 + definition: MDS Age. + format: fixed + octet: 1 + structure: + - name: MDS + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last Mode S Report Used to Update the Track + resolution: 0.25 + unit: s + - itemno: I011/290-6 + itemdesc: System Track Update Ages + frn: 1406 + definition: ADS Age. + format: fixed + octet: 2 + structure: + - name: ADS + frombit: 16 + tobit: 1 + datatype: uint + desc: Age of the Last ADS Report Used to Update the Track + resolution: 0.25 + unit: s + - itemno: I011/290-7 + itemdesc: System Track Update Ages + frn: 1407 + definition: ADB Age. + format: fixed + octet: 1 + structure: + - name: ADB + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last ADS-B Report Used to Update the Track + resolution: 0.25 + unit: s + - itemno: I011/290-8 + itemdesc: System Track Update Ages + frn: 1408 + definition: MD1 Age. + format: fixed + octet: 1 + structure: + - name: MD1 + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last Valid Mode 1 Used to Update the Track + resolution: 0.25 + unit: s + - itemno: I011/290-9 + itemdesc: System Track Update Ages + frn: 1409 + definition: MD2 Age. + format: fixed + octet: 1 + structure: + - name: MD2 + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last Valid Mode 2 Used to Update the Track + resolution: 0.25 + unit: s + - itemno: I011/290-10 + itemdesc: System Track Update Ages + frn: 1410 + definition: LOP Age. + format: fixed + octet: 1 + structure: + - name: LOP + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last Magentic Loop Detection + resolution: 0.25 + unit: s + - itemno: I011/290-11 + itemdesc: System Track Update Ages + frn: 1411 + definition: TRK Age. + format: fixed + octet: 1 + structure: + - name: TRK + frombit: 8 + tobit: 1 + datatype: uint + desc: Actual Track Age Since First Occurrence + resolution: 0.25 + unit: s + - itemno: I011/290-12 + itemdesc: System Track Update Ages + frn: 1412 + definition: MUL Age. + format: fixed + octet: 1 + structure: + - name: MUL + frombit: 8 + tobit: 1 + datatype: uint + desc: Age of the Last Multilateration Detection + resolution: 0.25 + unit: s + dataItemNote: "Note: The ages are counted from Data Item I011/140, Time Of Track Information, \n + using the following formula: Age = Time of track information - Time of last (valid) \n + update If the computed age is greater than the maximum value \n + or if the data has never been received, then the corresponding subfield is not sent." + - itemno: I011/430 + itemdesc: Phase of Flight + frn: 15 + definition: "Current phase of the flight." + format: fixed + octet: 1 + structure: + - name: PoF + frombit: 8 + tobit: 1 + desc: Phase of Flight + codes: + 0: Unknown + 1: On stand + 2: Taxiing for departure + 3: Taxiing for arrival + 4: Runway for departure + 5: Runway for arrival + 6: Hold for departure + 7: Hold for arrival + 8: Push back + 9: On finals + - itemno: I011/090 + itemdesc: Measured Flight Level + frn: 16 + definition: "Last valid and credible flight level used to update the track, in twos complement representation." + format: fixed + octet: 2 + structure: + - name: MFL + frombit: 16 + tobit: 1 + datatype: int + desc: Measured Flight Level + resolution: 0.25 + min: "-12" + max: 1500 + unit: FL + dataItemNote: "Note: The criteria to determine + the credibility of the flight level are Tracker dependent. Credible + means: within reasonable range of change with respect to the previous detection." + - itemno: I011/093 + itemdesc: Calculated Track Barometric Altitude + frn: 17 + definition: "Calculated Barometric Altitude of the track." + format: fixed + octet: 2 + structure: + - name: QNH + frombit: 16 + desc: QNH Correction Applied + codes: + 0: No QNH Correction Applied + 1: QNH Correction Applied + - name: CTBA + serviceFieldName: alt + frombit: 15 + tobit: 1 + datatype: int + desc: Calculated Track Barometric Altitude + resolution: 0.25 + min: "-15" + max: 1500 + unit: FL + - itemno: I011/092 + itemdesc: Calculated Track Geometric Altitude + frn: 18 + definition: "Calculated geometric vertical distance above mean sea level, not related to barometric pressure." + format: fixed + octet: 2 + structure: + - name: CTGA + frombit: 16 + tobit: 1 + desc: Calculated Track Geometric Altitude + resolution: 6.25 + min: "-1500" + max: 150000 + unit: ft + dataItemNote: "Note: The source of altitude is identified in bits (SRC) of item I011/170 Track Status." + - itemno: I011/215 + itemdesc: Calculated Rate Of Climb/Descent + frn: 19 + definition: "Calculated rate of Climb/Descent of an aircraft, in twos complement form." + format: fixed + octet: 2 + structure: + - name: CROC + frombit: 16 + tobit: 1 + datatype: int + desc: Calculated Rate Of Climb/Descent + resolution: 6.25 + min: "-204800" + max: 204800 + unit: ft/min + - itemno: I011/270 + itemdesc: Target Size and Orientation + frn: 20 + definition: "Target size defined as length and with of the detected target, and orientation." + format: variable + octet: 1 + - itemno: I011/270-1 + itemdesc: Target Size and Orientation + frn: 2001 + definition: First Part + format: fixed + octet: 1 + structure: + - name: LENGTH + frombit: 8 + tobit: 2 + datatype: uint + desc: Length + resolution: 1.0 + unit: m + - name: FX + frombit: 1 + tobit: 1 + desc: Extension Indicator + codes: + 0: End of Data Item + 1: Extension + - itemno: I011/270-2 + itemdesc: Target Size and Orientation + frn: 2002 + definition: First Part + format: fixed + octet: 1 + structure: + - name: ORIENTATION + serviceFieldName: cos + frombit: 8 + tobit: 2 + datatype: uint + desc: Orientation + resolution: 2.8125 + unit: deg + - name: FX + frombit: 1 + fx: 1 + desc: Extension Indicator + codes: + 0: End of Data Item + 1: Extension + - itemno: I011/270-3 + itemdesc: Target Size and Orientation + frn: 2003 + definition: Second Extent + format: fixed + octet: 1 + structure: + - name: WIDTH + frombit: 8 + tobit: 2 + datatype: uint + desc: Width + resolution: 1.0 + unit: m + - name: FX + frombit: 1 + tobit: 1 + desc: Extension Indicator + codes: + 0: End of Data Item + 1: Extension + dataItemNote: "Note: The orientation gives the direction to which the aircraft nose is pointing, relative to the Geographical North." + - itemno: I011/390 + itemdesc: Flight Plan Related Data + frn: 21 + definition: "All flight plan related information." + format: compound + octet: 2 + - itemno: I011/390-1 + itemdesc: Flight Plan Related Data + frn: 2101 + definition: FPPS Identification Tag + format: fixed + octet: 1 + structure: + - name: SAC + frombit: 16 + tobit: 9 + desc: System Area Code + - name: SIC + frombit: 8 + tobit: 1 + desc: System Identity Code + - itemno: I011/390-2 + itemdesc: Flight Plan Related Data + frn: 2102 + definition: Callsign + format: fixed + octet: 7 + structure: + - name: CSN + serviceFieldName: clsgn + frombit: 56 + tobit: 1 + datatype: ascii + desc: Callsign + dataItemNote: "note: Each of the seven Octets contains an ASCII Character. The Callsign is always left adjusted. It contains up to seven upper-case alphanumeric characters, the remaining character positions (if any) are padded with space characters." + - itemno: I011/390-3 + itemdesc: Flight Plan Related Data + frn: 2103 + definition: IFPS_FLIGHT_ID + format: fixed + octet: 4 + structure: + - name: TYP + frombit: 32 + tobit: 31 + desc: IFPS Flight ID Type + codes: + 0: Plan number + 1: Unit 1 internal flight number + 2: Unit 2 internal flight number + 3: Unit 3 internal flight number +# - name: spare +# frombit: 30 +# tobit: 28 +# desc: Spare bit(s) set to 0 + - name: NBR + frombit: 27 + tobit: 1 + desc: IFPS Flight ID Number + - itemno: I011/390-4 + itemdesc: Flight Plan Related Data + frn: 2104 + definition: Flight Category + format: fixed + octet: 1 + structure: + - name: GATOAT + frombit: 8 + tobit: 7 + desc: Flight Type + codes: + 0: Unknown + 1: General Air Traffic + 2: Operational Air Traffic + 3: Not applicable + - name: FR1FR2 + frombit: 6 + tobit: 5 + desc: Flight Rules + codes: + 0: Instrument Flight Rules + 1: Visual Flight Rules + 2: Not applicable + 3: Controlled Visual Flight Rules + - name: RVSM + frombit: 4 + tobit: 3 + desc: RVSM + codes: + 0: Unknown + 1: Approved + 2: Exempt + 3: Not Approved + - name: HPR + frombit: 2 + desc: Flight Priority + codes: + 0: Normal Priority Flight + 1: High Priority Flight +# - name: spare +# frombit: 1 +# desc: Spare bit(s) set to 0 + - itemno: I011/390-5 + itemdesc: Flight Plan Related Data + frn: 2105 + definition: Type of Aircraft + format: fixed + octet: 4 + structure: + - name: TOA + frombit: 32 + tobit: 1 + datatype: ascii + desc: Type of Aircraft + - itemno: I011/390-6 + itemdesc: Flight Plan Related Data + frn: 2106 + definition: Wake Turbulence Category + format: fixed + octet: 1 + structure: + - name: WTC + frombit: 8 + tobit: 1 + desc: Wake Turbulence Category + codes: + 72: Heavy # H + 74: Super # J + 76: Light # L + 77: Medium # M + - itemno: I011/390-7 + itemdesc: Flight Plan Related Data + frn: 2107 + definition: Departure Airport + format: fixed + octet: 4 + structure: + - name: ADEP + frombit: 32 + tobit: 1 + datatype: ascii + desc: Departure Airport + - itemno: I011/390-8 + itemdesc: Flight Plan Related Data + frn: 2108 + definition: Destination Airport + format: fixed + octet: 4 + structure: + - name: ADES + frombit: 32 + tobit: 1 + datatype: ascii + desc: Destination Airport + - itemno: I011/390-9 + itemdesc: Flight Plan Related Data + frn: 2109 + definition: Runway Designation + format: fixed + octet: 3 + structure: + - name: RWY + frombit: 24 + tobit: 1 + datatype: ascii + desc: Runway Designation + - itemno: I011/390-10 + itemdesc: Flight Plan Related Data + frn: 2110 + definition: Current Cleared Flight Level + format: fixed + octet: 2 + structure: + - name: CFL + frombit: 16 + tobit: 1 + datatype: uint + desc: Current Cleared Flight Level + resolution: 0.25 + unit: FL + - itemno: I011/390-11 + itemdesc: Flight Plan Related Data + frn: 2111 + definition: Current Cleared Flight Level + format: fixed + octet: 2 + structure: + - name: CENTRE + frombit: 16 + tobit: 9 + desc: 8-bit Group Identification Code + - name: POSITION + frombit: 8 + tobit: 1 + desc: 8-bit Control Position Identification Code + - itemno: I011/390-12 + itemdesc: Flight Plan Related Data + frn: 2112 + definition: Time of Departure + format: repetitive + octet: 5 + structure: + - name: REP + frombit: 40 + tobit: 33 + desc: Repetition Factor + - name: TYP + frombit: 32 + tobit: 28 + desc: Time Type + codes: + 0: Scheduled off-block time + 1: Estimated off-block time + 2: Estimated take-off time + 3: Actual off-block time + 4: Predicted time at runway hold + 5: Actual time at runway hold + 6: Actual line-up time + 7: Actual take-off time + 8: Estimated time of arrival + 9: Predicted landing time + 10: Actual landing time + 11: Actual time off runway + 12: Predicted time to gate + 13: Actual on-block time + - name: DAY + frombit: 27 + tobit: 26 + desc: Day + codes: + 0: Today + 1: Yesterday + 2: Tomorrow +# - name: spare +# frombit: 25 +# tobit: 22 +# desc: spare bits set to zero + - name: HOR + frombit: 21 + tobit: 17 + datatype: uint + desc: Hours, from 0 to 23 + min: 0 + max: 23 +# - name: spare +# frombit: 16 +# tobit: 15 +# desc: Spare bit(s) set to 0 + - name: MIN + frombit: 14 + tobit: 9 + datatype: uint + desc: Minutes, from 0 to 59 + min: 0 + max: 59 + - name: AVS + frombit: 8 + desc: Seconds Available + codes: + 0: Seconds available + 1: Seconds not available +# - name: spare +# frombit: 7 +# desc: Spare bit(s) set to 0 + - name: SEC + frombit: 6 + tobit: 1 + datatype: uint + desc: Seconds, from 0 to 59 + min: 0 + max: 59 + - itemno: I011/390-13 + itemdesc: Flight Plan Related Data + frn: 2113 + definition: Aircraft Stand + format: fixed + octet: 6 + structure: + - name: AST + frombit: 48 + tobit: 1 + datatype: ascii + desc: Aircraft Stand + - itemno: I011/390-14 + itemdesc: Flight Plan Related Data + frn: 2114 + definition: Stand Status + format: fixed + octet: 1 + structure: + - name: EMP + frombit: 8 + tobit: 7 + desc: Stand Empty + codes: + 0: Empty + 1: Occupied + 2: Unknown + - name: AVL + frombit: 6 + tobit: 5 + desc: Stand Available + codes: + 0: Available + 1: Not available + 2: Unknown +# - name: spare +# frombit: 4 +# tobit: 1 + - itemno: I011/300 + itemdesc: Vehicle Fleet Identification + frn: 22 + definition: "Vehicle fleet identification number." + format: fixed + octet: 1 + structure: + - name: VFI + frombit: 8 + tobit: 1 + desc: Vehicle Fleet Identification + codes: + 0: Flyco (follow me) + 1: ATC equipment maintenance + 2: Airport maintenance + 3: Fire + 4: Bird scarer + 5: Snow plough + 6: Runway sweeper + 7: Emergency + 8: Police + 9: Bus + 10: Tug (push/tow) + 11: Grass cutter + 12: Fuel + 13: Baggage + 14: Catering + 15: Aircraft maintenance + 16: Unknown + - itemno: I011/310 + itemdesc: Pre-programmed Message + frn: 23 + definition: "Number related to a pre-programmed message that can be transmitted by a vehicle." + format: fixed + octet: 1 + structure: + - name: TRB + frombit: 8 + tobit: 8 + desc: In Trouble + codes: + 0: Default + 1: In Trouble + - name: MSG + frombit: 7 + tobit: 1 + desc: Message + codes: + 1: Towing aircraft + 2: FOLLOW-ME operation + 3: Runway check + 4: Emergency operation (fire, medical...) + 5: Work in progress (maintenance, birds scarer, sweepers...) + - itemno: I011/500 + itemdesc: Estimated Accuracies + frn: 24 + definition: "Overview of all important accuracies (standard deviations)." + octet: 1 + format: compound + - itemno: I011/500-1 + itemdesc: Estimated Accuracies + frn: 2401 + definition: Estimated Accuracy Of Track Position (Cartesian) + octet: 2 + format: fixed + structure: + - name: APC-X + frombit: 16 + tobit: 9 + datatype: uint + desc: Estimated Accuracy of the Calculated Position of X Component + resolution: 0.25 + unit: m + - name: APC-Y + frombit: 8 + tobit: 1 + datatype: uint + desc: Estimated Accuracy of the Calculated Position of Y Component + resolution: 0.25 + unit: m + - itemno: I011/500-2 + itemdesc: Estimated Accuracies + frn: 2402 + definition: Estimated Accuracy Of Track Position (WGS84) + octet: 4 + format: fixed + structure: + - name: APW-LAT + frombit: 32 + tobit: 17 + datatype: int + desc: APW Latitude Component Accuracy + resolution: 0.00000008381903171539306640625 + unit: deg + - name: APW-LON + frombit: 16 + tobit: 1 + datatype: int + desc: APW Longitude Component Accuracy + resolution: 0.00000008381903171539306640625 + unit: deg + - itemno: I011/500-3 + itemdesc: Estimated Accuracies + frn: 2403 + definition: Estimated Accuracy Of Height + octet: 2 + format: fixed + structure: + - name: ATH + frombit: 16 + tobit: 1 + datatype: int + desc: Estimated Accuracy Of the calculated altitude of an aircraft. + resolution: 0.5 + unit: m + - itemno: I011/500-4 + itemdesc: Estimated Accuracies + frn: 2404 + definition: Estimated Accuracy Of Track Velocity (Cartesian) + octet: 2 + format: fixed + structure: + - name: AVC-X + frombit: 16 + tobit: 9 + datatype: uint + desc: Estimated Accuracy of the Calculated Velocity of X Component + resolution: 0.1 + unit: m/s + - name: Y + frombit: 8 + tobit: 1 + datatype: uint + desc: Estimated Accuracy of the Calculated Velocity of Y Component + resolution: 0.1 + unit: m/s + - itemno: I011/500-5 + itemdesc: Estimated Accuracies + frn: 2405 + definition: Estimated Accuracy Of Rate Of Climb / Descent + octet: 2 + format: fixed + structure: + - name: ARC + frombit: 16 + tobit: 1 + datatype: int + desc: Estimated Accuracy Of Rate Of Climb / Descent + resolution: 0.1 + unit: m/s + - itemno: I011/500-6 + itemdesc: Estimated Accuracies + frn: 2406 + definition: Estimated Accuracy Of Acceleration (Cartesian) + octet: 2 + format: fixed + structure: + - name: AAC-X + frombit: 16 + tobit: 9 + datatype: uint + desc: Estimated Accuracy Of Acceleration of X Component + resolution: 0.01 + unit: m/s2 + - name: AAC-Y + frombit: 8 + tobit: 1 + datatype: uint + desc: Estimated Accuracy Of Acceleration of Y Component + resolution: 0.01 + unit: m/s2 + - itemno: I011/600 + itemdesc: Alert Messages + frn: 25 + definition: "Alert involving the targets indicated in I011/605." + format: fixed + octet: 3 + structure: + - name: ACK + frombit: 24 + desc: Alert Acknowleged + codes: + 0: Alert acknowledged + 1: Alert not acknowledged + - name: SVR + frombit: 23 + tobit: 22 + desc: Alert Severity + codes: + 0: End fo alert + 1: Pre-alarm + 2: Severe alert +# - name: spare +# frombit: 21 +# tobit: 17 +# desc: Spare bit(s) set to 0 + - name: AT + frombit: 16 + tobit: 9 + desc: Alert Type + - name: AN + frombit: 8 + tobit: 1 + desc: Alert Number + - itemno: I011/605 + itemdesc: Tracks in Alert + frn: 26 + definition: "List of track numbers of the targets concerned by the alert described in I011/600." + format: repetitive + octet: 2 + structure: + - name: Rep + frombit: 24 + tobit: 17 + desc: Repetition Factor +# - name: spare +# frombit: 16 +# tobit: 13 +# desc: Spare bit(s) set to 0 + - name: FTN + frombit: 12 + tobit: 1 + desc: Fusion Track Number + - itemno: I011/610 + itemdesc: Holdbar Status + frn: 27 + definition: "Status of up to sixteen banks of twelve indicators." + format: repetitive + octet: 2 + structure: + - name: Rep + frombit: 24 + tobit: 17 + desc: Repetition Factor + - name: BKN + frombit: 16 + tobit: 13 + desc: Bank Number + - name: I1 + frombit: 12 + desc: Indicator 1 + codes: + 0: Indicator on + 1: Indicator off + - name: I2 + frombit: 11 + desc: Indicator 2 + codes: + 0: Indicator on + 1: Indicator off + - name: I3 + frombit: 10 + desc: Indicator 3 + codes: + 0: Indicator on + 1: Indicator off + - name: I4 + frombit: 9 + desc: Indicator 4 + codes: + 0: Indicator on + 1: Indicator off + - name: I5 + frombit: 8 + desc: Indicator 5 + codes: + 0: Indicator on + 1: Indicator off + - name: I6 + frombit: 7 + desc: Indicator 6 + codes: + 0: Indicator on + 1: Indicator off + - name: I7 + frombit: 6 + desc: Indicator 7 + codes: + 0: Indicator on + 1: Indicator off + - name: I8 + frombit: 5 + desc: Indicator 8 + codes: + 0: Indicator on + 1: Indicator off + - name: I9 + frombit: 4 + desc: Indicator 9 + codes: + 0: Indicator on + 1: Indicator off + - name: I10 + frombit: 3 + desc: Indicator 10 + codes: + 0: Indicator on + 1: Indicator off + - name: I11 + frombit: 2 + desc: Indicator 11 + codes: + 0: Indicator on + 1: Indicator off + - name: I12 + frombit: 1 + desc: Indicator 12 + codes: + 0: Indicator on + 1: Indicator off + - itemno: SPF + itemdesc: Special Purpose Field + frn: 28 + definition: Special Purpose Field. + format: fixed + octet: 1 + structure: + - name: SPF + frombit: 8 + tobit: 1 + desc: SPF + - itemno: RE + itemdesc: Reserved Expansion Field + frn: 29 + definition: Reserved Expansion Field + format: repetitive + octet: 1 + structure: + - name: Rep + frombit: 8 + tobit: 1 desc: SPF \ No newline at end of file