- Timestamp:
- 07/23/13 13:31:41 (11 years ago)
- Location:
- trunk/FACT++/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/HeadersGCN.h
r16954 r16981 10 10 kDisconnected = 1, 11 11 kConnected = 2, 12 kValid = 3, 12 13 }; 14 13 15 } 16 17 struct PaketType_t 18 { 19 int16_t type; 20 string name; 21 string description; 22 }; 23 24 static const PaketType_t kTypes[] = 25 { // inactive, ACTIVE[1], T-Only[-], in-work[+] 26 { 1, /* */ "GRB_COORDS", "BATSE Trigger coords (the first GCN Notice Type)" }, 27 { 2, /* 1 */ "TEST_COORDS", "Test coords" }, 28 { 3, /* 1 */ "IM_ALIVE", "I'm alive socket packet every 60 sec" }, 29 { 4, /* 1 */ "KILL_SOCKET", "Kill a socket connection" }, 30 { 11, /* */ "MAXBC", "MAXC1/BC" }, 31 { 21, /* */ "BRAD_COORDS", "Special Test coords packet for BRADFORD" }, 32 { 22, /* */ "GRB_FINAL", "Final BATSE coords" }, 33 { 24, /* */ "HUNTS_SRC", "Huntsville LOCBURST GRB coords (HitL)" }, 34 { 25, /* */ "ALEXIS_SRC", "ALEXIS Transient coords" }, 35 { 26, /* */ "XTE_PCA_ALERT", "XTE-PCA ToO Observation Scheduled" }, 36 { 27, /* */ "XTE_PCA_SRC", "XTE-PCA GRB coords" }, 37 { 28, /* */ "XTE_ASM_ALERT", "XTE-ASM Alert" }, 38 { 29, /* */ "XTE_ASM_SRC", "XTE-ASM GRB coords" }, 39 { 30, /* */ "COMPTEL_SRC", "COMPTEL GRB coords" }, 40 { 31, /* */ "IPN_RAW", "IPN_RAW GRB annulus coords (position is center of Annulus)" }, 41 { 32, /* */ "IPN_SEG", "IPN+POS GRB annulus seg (kind of a cheat to allow error filter)" }, 42 { 33, /* */ "SAX_WFC_ALERT", "SAX-WFC Alert" }, 43 { 34, /* */ "SAX_WFC_SRC", "SAX-WFC GRB coords" }, 44 { 35, /* */ "SAX_NFI_ALERT", "SAX-NFI Alert" }, 45 { 36, /* */ "SAX_NFI_SRC", "SAX-NFI GRB coords" }, 46 { 37, /* */ "XTE_ASM_TRANS", "XTE-ASM TRANSIENT coords" }, 47 { 38, /* 1 */ "spare38", "(spare; used for s/w development testing)" }, 48 { 39, /* 1 */ "IPN_POS", "IPN Position coords" }, 49 { 40, /* */ "HETE_ALERT_SRC", "HETE Trigger Alert" }, 50 { 41, /* */ "HETE_UPDATE_SRC", "HETE Update position (multiples)" }, 51 { 42, /* */ "HETE_FINAL_SRC", "HETE Last/Final position" }, 52 { 43, /* */ "HETE_GNDANA_SRC", "HETE position from Ground Analysis (HitL)" }, 53 { 44, /* 1 */ "HETE_TEST", "HETE TEST" }, 54 { 45, /* 1 */ "GRB_CNTRPART", "GRB Counterpart coordinates" }, 55 { 46, /* 1 */ "SWIFT_TOO_FOM", "SWIFT TOO-form of the FOM" }, 56 { 47, /* 1 */ "SWIFT_TOO_SC_SLEW", "SWIFT TOO-form of the SC_SLEW" }, 57 { 48, /* - */ "DOW_TOD", "Day-of-Week Time-of-Day end2end testing" }, 58 { 50, /* 1 */ "spare50", "(spare; not yet assigned)" }, 59 { 51, /* 1 */ "INTEGRAL_POINTDIR", "INTEGRAL Pointing Direction" }, 60 { 52, /* 1 */ "INTEGRAL_SPIACS", "INTEGRAL SPIACS" }, 61 { 53, /* 1 */ "INTEGRAL_WAKEUP", "INTEGRAL Wakeup" }, 62 { 54, /* 1 */ "INTEGRAL_REFINED", "INTEGRAL Refined" }, 63 { 55, /* 1 */ "INTEGRAL_OFFLINE", "INTEGRAL Offline (HitL)" }, 64 { 56, /* 1 */ "INTEGRAL_WEAK", "INTEGRAL Weak" }, 65 { 57, /* + */ "AAVSO", "AAVSO" }, 66 { 58, /* */ "MILAGRO_POS", "MILAGRO Position" }, 67 { 59, /* 1 */ "KONUS_LC", "KONUS Lightcurve" }, 68 { 60, /* 1 */ "SWIFT_BAT_GRB_ALERT", "BAT ALERT. Never transmitted by the s/c." }, 69 { 61, /* 1 */ "SWIFT_BAT_GRB_POS_ACK", "BAT GRB Position Acknowledge" }, 70 { 62, /* 1 */ "SWIFT_BAT_GRB_POS_NACK", "BAT GRB Position NOT_Ack (pos not found)." }, 71 { 63, /* 1 */ "SWIFT_BAT_GRB_LC", "BAT GRB Lightcurve" }, 72 { 64, /* - */ "SWIFT_BAT_SCALEDMAP", "BAT Scaled Map" }, 73 { 65, /* 1 */ "SWIFT_FOM_OBS", "BAT FOM to Observe (FOM_2OBSAT)" }, 74 { 66, /* 1 */ "SWIFT_SC_SLEW", "BAT S/C to Slew (FOSC_2OBSAT)" }, 75 { 67, /* 1 */ "SWIFT_XRT_POSITION", "XRT Position" }, 76 { 68, /* - */ "SWIFT_XRT_SPECTRUM", "XRT Spectrum" }, 77 { 69, /* 1 */ "SWIFT_XRT_IMAGE", "XRT Image (aka postage stamp)" }, 78 { 70, /* - */ "SWIFT_XRT_LC", "XRT Lightcurve (aka Prompt)" }, 79 { 71, /* 1 */ "SWIFT_XRT_CENTROID", "XRT Centroid Error (Pos Nack)" }, 80 { 72, /* 1 */ "SWIFT_UVOT_DBURST", "UVOT DarkBurst (aka Neighbor, aka GeNie)" }, 81 { 73, /* 1 */ "SWIFT_UVOT_FCHART", "UVOT Finding Chart" }, 82 { 76, /* + */ "SWIFT_BAT_GRB_LC_PROC", "BAT GRB Lightcurve processed" }, 83 { 77, /* - */ "SWIFT_XRT_SPECTRUM_PROC", "XRT Spectrum processed" }, 84 { 78, /* 1 */ "SWIFT_XRT_IMAGE_PROC", "XRT Image processed" }, 85 { 79, /* 1 */ "SWIFT_UVOT_DBURST_PROC", "UVOT DarkBurst proc mesg (aka Neighbor)" }, 86 { 80, /* 1 */ "SWIFT_UVOT_FCHART_PROC", "UVOT Finding Chart processed" }, 87 { 81, /* 1 */ "SWIFT_UVOT_POS", "UVOT Position" }, 88 { 82, /* 1 */ "SWIFT_BAT_GRB_POS_TEST", "BAT GRB Position Test" }, 89 { 83, /* 1 */ "SWIFT_POINTDIR", "Pointing Direction" }, 90 { 84, /* 1 */ "SWIFT_BAT_TRANS", "BAT Hard X-ray Transient coords" }, 91 { 85, /* - */ "SWIFT_XRT_THRESHPIX", "XRT Thresholded-Pixel-list" }, 92 { 86, /* - */ "SWIFT_XRT_THRESHPIX_PROC", "XRT Thresholded-Pixel-list processed" }, 93 { 87, /* - */ "SWIFT_XRT_SPER", "XRT Single-Pixel-Event-Report" }, 94 { 88, /* - */ "SWIFT_XRT_SPER_PROC", "XRT Single-Pixel-Event-Report processed" }, 95 { 89, /* 1 */ "SWIFT_UVOT_POS_NACK", "UVOT Position Nack (contains BATs/XRTs position)" }, 96 { 90, /* - */ "SWIFT_BAT_ALARM_SHORT", "SWIFT Appendix_C non-public (Team Ops)" }, 97 { 91, /* - */ "SWIFT_BAT_ALARM_LONG", "SWIFT Appendix_C non-public (Team Ops)" }, 98 { 92, /* - */ "SWIFT_UVOT_EMERGENCY", "SWIFT Appendix_C non-public (Team Ops)" }, 99 { 93, /* - */ "SWIFT_XRT_EMERGENCY", "SWIFT Appendix_C non-public (Team Ops)" }, 100 { 94, /* - */ "SWIFT_FOM_PPT_ARG_ERR", "SWIFT Appendix_C non-public (Team Ops)" }, 101 { 95, /* - */ "SWIFT_FOM_SAFE_POINT", "SWIFT Appendix_C non-public (Team Ops)" }, 102 { 96, /* - */ "SWIFT_FOM_SLEW_ABORT", "SWIFT Appendix_C non-public (Team Ops)" }, 103 { 97, /* 1 */ "SWIFT_BAT_QL_POS", "BAT Quick Look Position (1-6 sec sooner)" }, 104 { 98, /* 1 */ "SWIFT_BAT_SUB_THRESHOLD", "BAT Sub-Threshold Position" }, 105 { 99, /* 1 */ "SWIFT_BAT_SLEW_POS", "BAT Burst/Trans Pos during slewing" }, 106 { 100, /* 1 */ "AGILE_GRB_WAKEUP", "AGILE GRB Wake-Up Position" }, 107 { 101, /* 1 */ "AGILE_GRB_GROUND", "AGILE GRB Prompt Position" }, 108 { 102, /* 1 */ "AGILE_GRB_REFINED", "AGILE GRB Refined Position" }, 109 { 107, /* 1 */ "AGILE_POINTDIR", "AGILE Pointing Direction" }, 110 { 108, /* + */ "AGILE_TRANS", "AGILE Transient Position" }, 111 { 109, /* 1 */ "AGILE_GRB_POS_TEST", "AGILE GRB Position Test" }, 112 { 110, /* 1 */ "FERMI_GBM_ALERT", "GBM Alert" }, 113 { 111, /* 1 */ "FERMI_GBM_FLT_POS", "GBM Flightt-calculated Position" }, 114 { 112, /* 1 */ "FERMI_GBM_GND_POS", "GBM Ground-calculated Position" }, 115 { 113, /* + */ "FERMI_GBM_LC", "GBM Lightcurve" }, 116 { 114, /* - */ "FERMI_GBM_GND_INTERNAL", "GBM Gnd-calc Internal (beyond 112)" }, 117 { 115, /* 1 */ "FERMI_GBM_FIN_POS", "GBM Final Position HitL or Offline" }, 118 { 118, /* + */ "FERMI_GBM_TRANS", "GBM Transient Position" }, 119 { 119, /* 1 */ "FERMI_GBM_POS_TEST", "GBM Position Test" }, 120 { 120, /* - */ "FERMI_LAT_POS_INI", "LAT Position Initial" }, 121 { 121, /* 1 */ "FERMI_LAT_POS_UPD", "LAT Position Update" }, 122 { 122, /* - */ "FERMI_LAT_POS_DIAG", "LAT Position Diagnostic" }, 123 { 123, /* + */ "FERMI_LAT_TRANS", "LAT Transient Position (previously unknown source)" }, 124 { 124, /* 1 */ "FERMI_LAT_POS_TEST", "LAT Position Test (like UPD only)" }, 125 { 125, /* + */ "FERMI_LAT_MONITOR", "LAT Monitor (eg Blazar, AGN, etc)" }, 126 { 126, /* 1 */ "FERMI_SC_SLEW", "Spcecraft Slew" }, 127 { 127, /* 1 */ "FERMI_LAT_GND", "LAT Ground-analysis refined Pos" }, 128 { 128, /* + */ "FERMI_LAT_OFFLINE", "LAT Ground-analysis Trigger Pos, Offline" }, 129 { 129, /* 1 */ "FERMI_POINTDIR", "Pointing Direction" }, 130 { 130, /* 1 */ "SIMBADNED", "SIMBAD/NED Search Results" }, 131 { 131, /* + */ "PIOTS_OT_POS", "Pi-Of-The-Sky Optical Transient Pos" }, 132 { 132, /* + */ "KAIT_SN", "KAIT SuperNova" }, 133 { 133, /* 1 */ "SWIFT_BAT_MONITOR", "Swift BAT Transient Monitor LC page event" }, 134 { 134, /* 1 */ "MAXI_UNKNOWN", "MAXI previously Unknown source transient (GRBs or other x-ray trans)" }, 135 { 135, /* 1 */ "MAXI_KNOWN", "MAXI previously Known source transient (already in some catalog)" }, 136 { 136, /* 1 */ "MAXI_TEST", "MAXI Test notice (for the Unknown type)" }, 137 { 137, /* + */ "OGLE", "OGLE lensing event (Inten, yes; but not Signif)" }, 138 { 138, /* + */ "CBAT", "CBAT" }, 139 { 139, /* + */ "MOA", "MOA lensing event (turn off inten for now!!!)" }, 140 { 140, /* 1 */ "SWIFT_BAT_SUBSUB", "BAT SubSubThreshold trigger" }, 141 { 141, /* 1 */ "SWIFT_BAT_KNOWN_SRC", "Known source detected in ach BAT image" }, 142 { 142, /* 1 */ "VOE_1.1_IM_ALIVE", "I'm alive socket packet sent every 60 sec" }, 143 { 143, /* 1 */ "VOE_2.0_IM_ALIVE", "I'm alive socket packet sent every 60 sec" }, 144 { 148, /* 1 */ "SUZAKU_LC", "SUZAKU-WAM Lightcurve" }, 145 { -1, "", "" }, 146 }; 14 147 } 15 148 -
trunk/FACT++/src/gcn.cc
r16977 r16981 31 31 { 32 32 private: 33 map<uint16_t, GCN::PaketType_t> fTypes; 34 33 35 vector<string> fEndPoints; 34 36 int fEndPoint; … … 42 44 Time fLastKeepAlive; 43 45 46 GCN::PaketType_t GetType(const QDomElement &what) 47 { 48 const QDomNodeList param = what.elementsByTagName("Param"); 49 for (int i=0; i<param.count(); i++) 50 { 51 const QDomElement elem = param.at(i).toElement(); 52 if (elem.attribute("name").toStdString()!="Packet_Type") 53 continue; 54 55 const uint16_t val = elem.attribute("value").toUInt(); 56 const auto it = fTypes.find(val); 57 if (it!=fTypes.end()) 58 return it->second; 59 60 Warn("Unknown paket type "+to_string(val)+"."); 61 } 62 63 return { -1, "", "" }; 64 } 65 66 44 67 int ProcessXml(const QDomElement &root) 45 68 { … … 49 72 const string role = root.attribute("role", "").toStdString(); 50 73 const string name = root.tagName().toStdString(); 51 52 Out() << Time().GetAsStr() << " ----- " << name << " [" << role << "] -----" << endl;53 74 54 75 // A full description can be found at http://voevent.dc3.com/schema/default.html … … 65 86 fLastKeepAlive = Time(time.text().toStdString()); 66 87 67 Out() << " " << time.tagName().toStdString() << " = " << fLastKeepAlive.GetAsStr() << '\n'; 68 Out() << " " << orig.tagName().toStdString() << " = " << orig.text().toStdString() << '\n'; 69 Out() << endl; 88 if (fIsVerbose) 89 { 90 Out() << Time().GetAsStr() << " ----- " << name << " [" << role << "] -----" << endl; 91 Out() << " " << time.tagName().toStdString() << " = " << fLastKeepAlive.GetAsStr() << '\n'; 92 Out() << " " << orig.tagName().toStdString() << " = " << orig.text().toStdString() << '\n'; 93 Out() << endl; 94 } 70 95 71 96 return true; … … 80 105 if (name=="voe:VOEvent") 81 106 { 107 // WHAT: http://gcn.gsfc.nasa.gov/tech_describe.html 82 108 const QDomElement who = root.firstChildElement("Who"); 83 109 const QDomElement what = root.firstChildElement("What"); … … 115 141 return -1; 116 142 117 const string unit = pos2d.attribute("unit", "").toStdString(); 143 const GCN::PaketType_t ptype = GetType(what); 144 145 // 59/31: Konus LC / IPN raw [observation] 146 // 110: Fermi GBM (ART) [observation] (Initial) // Stop data taking 147 // 111: Fermi GBM (FLT) [observation] (after ~2s) // Start pointing/run 148 // 112: Fermi GBM (GND) [observation] (after 2-20s) // Refine pointing 149 // 115: Fermi GBM position [observation] (final ~hours) 150 // 151 // 51: Intergal pointdir [utility] 152 // 83: Swift pointdir [utility] 153 // 129: Fermi pointdir [utility] 154 // 155 // 2: Test coord ( 1) [test] 156 // 44: HETE test ( 41- 43) [test] 157 // 52: Integral SPIACS [test] 158 // 53: Integral Wakeup [test] 159 // 54: Integral refined [test] 160 // 55: Integral Offline [test] 161 // 56: Integral Weak [test] 162 // 82: BAT GRB pos test ( 61) [test] 163 // 109: AGILE GRB pos test (100-103) [test] 164 // 119: Fermi GRB pos test (111-113) [test] 165 // 124: Fermi LAT pos upd test (120-122) [test] 166 // 136: MAXI coord test ( 134) [test] 167 // 168 // Integral: RA=1.2343, Dec=2.3456 169 // 170 171 /* 172 54 173 == 174 <Group name="Test_mpos" > 175 <Param name="Test_Notice" value="true" /> 176 </Group> 177 178 179 82 180 == 181 <Group name="Solution_Status" > 182 <Param name="Test_Submission" value="false" /> 183 </Group> 184 185 186 115 187 === 188 2013-07-20 19:04:13: TIME = 2013-07-20 02:46:40 189 190 <Group name="Trigger_ID" > 191 <Param name="Test_Submission" value="false" /> 192 </Group> 193 */ 194 195 const string unit = pos2d.attribute("unit").toStdString(); 118 196 119 197 const double ra = c1.text().toDouble(); … … 124 202 const string n2 = name2.text().toStdString(); 125 203 126 Out() << Time(date.text().toStdString()).GetAsStr() << " ----- " << sname.text().toStdString() << '\n';204 Out() << Time(date.text().toStdString()).GetAsStr() << " ----- " << sname.text().toStdString() << " [" << role << "]\n"; 127 205 Out() << "[" << desc.text().toStdString() << "]\n"; 206 Out() << ptype.name << "[" << ptype.type << "]: " << ptype.description << endl; 128 207 Out() << left; 129 208 Out() << " " << setw(5) << "TIME" << "= " << Time(time.text().toStdString()).GetAsStr() << '\n'; … … 138 217 Nova::EquPosn equ; 139 218 equ.ra = ra; 140 equ.dec = dec; 141 142 /* 143 <Group name="Obs_Support_Info" > 144 <Description>The Sun and Moon values are valid at the time the VOEvent XML message was created.</Description> 145 <Param name="Sun_RA" value="117.44" unit="deg" ucd="pos.eq.ra" /> 146 <Param name="Sun_Dec" value="21.04" unit="deg" ucd="pos.eq.dec" /> 147 <Param name="Sun_Distance" value="105.22" unit="deg" ucd="pos.angDistance" /> 148 <Param name="Sun_Hr_Angle" value="-3.70" unit="hr" /> 149 <Param name="Moon_RA" value="225.90" unit="deg" ucd="pos.eq.ra" /> 150 <Param name="Moon_Dec" value="-16.75" unit="deg" ucd="pos.eq.dec" /> 151 <Param name="MOON_Distance" value="67.47" unit="deg" ucd="pos.angDistance" /> 152 <Param name="Moon_Illum" value="69.44" unit="%" ucd="arith.ratio" /> 153 </Group> 154 */ 219 equ.dec = dec; 155 220 156 221 const Nova::ZdAzPosn pos = Nova::GetHrzFromEqu(equ, jd); … … 205 270 } 206 271 272 Out() << Time().GetAsStr() << " ----- " << name << " [" << role << "] -----" << endl; 273 207 274 return false; 208 275 } … … 279 346 { 280 347 ba::async_read(*this, ba::buffer(&fRxSize, 4), 281 282 348 boost::bind(&ConnectionGCN::HandleReceivedData, this, 349 dummy::error, dummy::bytes_transferred, 0)); 283 350 } 284 351 … … 291 358 public: 292 359 ConnectionGCN(ba::io_service& ioservice, MessageImp &imp) : Connection(ioservice, imp()), 293 fIsVerbose(false), fDebugRx(false) 360 fIsVerbose(false), fDebugRx(false), fLastKeepAlive(Time::none) 294 361 { 295 362 SetLogStream(&imp); 363 364 for (auto it=GCN::kTypes; it->type>0; it++) 365 fTypes[it->type] = *it; 296 366 } 297 367 … … 319 389 Connection::StartConnect(); 320 390 } 391 392 bool IsValid() 393 { 394 return fLastKeepAlive.IsValid() ? Time()-fLastKeepAlive<boost::posix_time::minutes(2) : false; 395 } 321 396 }; 322 397 … … 371 446 int Execute() 372 447 { 373 return fGCN.IsConnected() ? State::kConnected : State::kDisconnected; 448 if (!fGCN.IsConnected()) 449 return State::kDisconnected; 450 451 return fGCN.IsValid() ? State::kValid : State::kConnected; 374 452 } 375 453 … … 412 490 T::AddStateName(State::kDisconnected, "Disconnected", 413 491 "No connection to GCN."); 414 415 492 T::AddStateName(State::kConnected, "Connected", 416 493 "Connection to GCN established."); 494 T::AddStateName(State::kValid, "Valid", 495 "Connection valid (keep alive received within past 2min)"); 417 496 418 497 // Verbosity commands … … 421 500 ("set verbosity state" 422 501 "|verbosity[bool]:disable or enable verbosity for received data (yes/no), except dynamic data"); 423 424 502 T::AddEvent("SET_DEBUG_RX", "B:1") 425 503 (bind(&StateMachineGCN::SetDebugRx, this, placeholders::_1)) … … 432 510 (bind(&StateMachineGCN::Disconnect, this)) 433 511 ("disconnect from ethernet"); 434 435 512 T::AddEvent("RECONNECT", "O", State::kDisconnected, State::kConnected) 436 513 (bind(&StateMachineGCN::Reconnect, this, placeholders::_1))
Note:
See TracChangeset
for help on using the changeset viewer.