adcs_dissector.lua 103 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276
  1. function adcs_dissector(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance, queue_id)
  2. if queue_id == 0 then
  3. require("adcs_dissector")
  4. adcs_dissector_0(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  5. elseif queue_id == 1 then
  6. require("adcs_dissector")
  7. adcs_dissector_1(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  8. elseif queue_id == 2 then
  9. require("adcs_dissector")
  10. adcs_dissector_2(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  11. elseif queue_id == 3 then
  12. require("adcs_dissector")
  13. adcs_dissector_3(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  14. elseif queue_id == 4 then
  15. require("adcs_dissector")
  16. adcs_dissector_4(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  17. elseif queue_id == 5 then
  18. require("adcs_dissector")
  19. adcs_dissector_5(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  20. elseif queue_id == 6 then
  21. require("adcs_dissector")
  22. adcs_dissector_6(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  23. elseif queue_id == 7 then
  24. require("adcs_dissector")
  25. adcs_dissector_7(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  26. elseif queue_id == 8 then
  27. require("adcs_dissector")
  28. adcs_dissector_8(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  29. elseif queue_id == 9 then
  30. require("adcs_dissector")
  31. adcs_dissector_9(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  32. elseif queue_id == 10 then
  33. require("adcs_dissector")
  34. adcs_dissector_10(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  35. elseif queue_id == 11 then
  36. require("adcs_dissector")
  37. adcs_dissector_11(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  38. elseif queue_id == 12 then
  39. require("adcs_dissector")
  40. adcs_dissector_12(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  41. elseif queue_id == 13 then
  42. require("adcs_dissector")
  43. adcs_dissector_13(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  44. elseif queue_id == 14 then
  45. require("adcs_dissector")
  46. adcs_dissector_14(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  47. elseif queue_id == 15 then
  48. require("adcs_dissector")
  49. adcs_dissector_15(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  50. elseif queue_id == 16 then
  51. require("adcs_dissector")
  52. adcs_dissector_16(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  53. elseif queue_id == 17 then
  54. require("adcs_dissector")
  55. adcs_dissector_17(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  56. elseif queue_id == 18 then
  57. require("adcs_dissector")
  58. adcs_dissector_18(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  59. elseif queue_id == 19 then
  60. require("adcs_dissector")
  61. adcs_dissector_19(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  62. elseif queue_id == 20 then
  63. require("adcs_dissector")
  64. adcs_dissector_20(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  65. elseif queue_id == 21 then
  66. require("adcs_dissector")
  67. adcs_dissector_21(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  68. elseif queue_id == 22 then
  69. require("adcs_dissector")
  70. adcs_dissector_22(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  71. elseif queue_id == 23 then
  72. require("adcs_dissector")
  73. adcs_dissector_23(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  74. elseif queue_id == 24 then
  75. require("adcs_dissector")
  76. adcs_dissector_24(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  77. elseif queue_id == 25 then
  78. require("adcs_dissector")
  79. adcs_dissector_25(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  80. elseif queue_id == 26 then
  81. require("adcs_dissector")
  82. adcs_dissector_26(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  83. elseif queue_id == 27 then
  84. require("adcs_dissector")
  85. adcs_dissector_27(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  86. elseif queue_id == 28 then
  87. require("adcs_dissector")
  88. adcs_dissector_28(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  89. elseif queue_id == 29 then
  90. require("adcs_dissector")
  91. adcs_dissector_29(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  92. elseif queue_id == 30 then
  93. require("adcs_dissector")
  94. adcs_dissector_30(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  95. elseif queue_id == 31 then
  96. require("adcs_dissector")
  97. adcs_dissector_31(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  98. elseif queue_id == 32 then
  99. require("adcs_dissector")
  100. adcs_dissector_32(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  101. end
  102. end
  103. function adcs_dissector_0(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  104. local status_field = ProtoField.uint32("adcs_protocol.status", "Status", base.DEC)
  105. local time_field = ProtoField.uint32("adcs_protocol.time", "Time", base.DEC)
  106. local nadir_3v3_current_field = ProtoField.uint32("adcs_protocol.nadir_3v3_current", "Nadir Sensor 3V3 Current", base.DEC)
  107. local fss_3v3_current_field = ProtoField.uint32("adcs_protocol.fss_3v3_current", "FSS 3V3 Current", base.DEC)
  108. local nadir_sram_current_field = ProtoField.uint32("adcs_protocol.nadir_sram_current", "Nadir SRAM Current", base.DEC)
  109. local fss_sram_current_field = ProtoField.uint32("adcs_protocol.fss_sram_current", "FSS SRAM Current", base.DEC)
  110. -- Add the fields to the protocol's 'fields' table
  111. adcs_protocol.fields = {
  112. status_field,
  113. time_field,
  114. nadir_3v3_current_field,
  115. fss_3v3_current_field,
  116. nadir_sram_current_field,
  117. fss_sram_current_field
  118. }
  119. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  120. for i = 0, num_of_instance - 1 do
  121. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  122. -- Dissect status
  123. local status = buffer(offset, 1):le_uint()
  124. subtree:add(status_field, status)
  125. offset = offset + 1
  126. -- Dissect time (4 bytes, little-endian)
  127. local time = buffer(offset, 4):le_uint()
  128. subtree:add(time_field, time)
  129. offset = offset + 4
  130. -- Dissect nadir 3V3 current (4 bytes, little-endian)
  131. local nadir_3v3_raw = buffer(offset, 2):le_uint()
  132. --local nadir_3v3_current = nadir_3v3_raw * 0.1 -- Apply multiplier
  133. subtree:add(nadir_3v3_current_field, nadir_3v3_raw)
  134. offset = offset + 2
  135. -- Dissect fss 3V3 current (4 bytes, little-endian)
  136. local fss_3v3_raw = buffer(offset, 2):le_uint()
  137. --local fss_3v3_current = fss_3v3_raw * 0.1 -- Apply multiplier
  138. subtree:add(fss_3v3_current_field, fss_3v3_raw)
  139. offset = offset + 2
  140. -- Dissect nadir SRAM current (4 bytes, little-endian)
  141. local nadir_sram_raw = buffer(offset, 2):le_uint()
  142. --local nadir_sram_current = nadir_sram_raw * 0.1 -- Apply multiplier
  143. subtree:add(nadir_sram_current_field, nadir_sram_raw)
  144. offset = offset + 2
  145. -- Dissect fss SRAM current (4 bytes, little-endian)
  146. local fss_sram_raw = buffer(offset, 2):le_uint()
  147. --local fss_sram_current = fss_sram_raw * 0.1 -- Apply multiplier
  148. subtree:add(fss_sram_current_field, fss_sram_raw)
  149. offset = offset + 2
  150. end
  151. end
  152. function adcs_dissector_1(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  153. local f_operation_status = ProtoField.uint32("adcs_dissector.operation_status", "Operation Status", base.DEC)
  154. local f_epoch_time = ProtoField.uint32("adcs_dissector.epoch_time", "Epoch Time", base.DEC)
  155. local f_3v_current = ProtoField.float("adcs_dissector.3v_current", "Current Value (3.3V)", base.DEC)
  156. local f_5v_current = ProtoField.float("adcs_dissector.5v_current", "Current Value (5V)", base.DEC)
  157. local f_vbat_current = ProtoField.float("adcs_dissector.vbat_current", "Vbat Current Value", base.DEC)
  158. -- Add fields to the protocol's 'fields' table
  159. adcs_protocol.fields = {
  160. f_operation_status,
  161. f_epoch_time,
  162. f_3v_current,
  163. f_5v_current,
  164. f_vbat_current
  165. }
  166. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  167. for i = 0, num_of_instance - 1 do
  168. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  169. local operation_status = buffer(offset, 1):le_uint()
  170. subtree:add(f_operation_status, operation_status)
  171. offset = offset + 1
  172. -- Dissect epoch time (4 bytes, little-endian)
  173. local epoch_time = buffer(offset, 4):le_uint()
  174. subtree:add(f_epoch_time, epoch_time)
  175. offset = offset + 4
  176. -- Dissect 3.3V current value (4 bytes, little-endian)
  177. local raw_3v_current = buffer(offset, 2):uint()
  178. --local formatted_3v_current = raw_3v_current * 0.1 -- Apply multiplier
  179. subtree:add(f_3v_current, raw_3v_current)
  180. offset = offset + 2
  181. -- Dissect 5V current value (4 bytes, little-endian)
  182. local raw_5v_current = buffer(offset, 2):uint()
  183. --local formatted_5v_current = raw_5v_current * 0.1 -- Apply multiplier
  184. subtree:add(f_5v_current, raw_5v_current)
  185. offset = offset + 2
  186. -- Dissect Vbat current value (4 bytes, little-endian)
  187. local raw_vbat_current = buffer(offset, 2):uint()
  188. --local formatted_vbat_current = raw_vbat_current * 0.1 -- Apply multiplier
  189. subtree:add(f_vbat_current, raw_vbat_current)
  190. offset = offset + 2
  191. end
  192. end
  193. function adcs_dissector_2(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  194. local f_operation_status = ProtoField.uint32("adcs_dissector.operation_status", "Operation Status", base.DEC)
  195. local f_epoch_time = ProtoField.uint32("adcs_dissector.epoch_time", "Epoch Time", base.DEC)
  196. local f_num_reaction_wheels = ProtoField.uint32("adcs_dissector.num_reaction_wheels", "Number of Reaction Wheel", base.DEC)
  197. local f_rw_current_1 = ProtoField.float("adcs_dissector.rw_current_1", "Reaction Wheel Current 1 (A)", base.DEC)
  198. local f_rw_current_2 = ProtoField.float("adcs_dissector.rw_current_2", "Reaction Wheel Current 2 (A)", base.DEC)
  199. local f_rw_current_3 = ProtoField.float("adcs_dissector.rw_current_3", "Reaction Wheel Current 3 (A)", base.DEC)
  200. adcs_protocol.fields = {
  201. f_operation_status,
  202. f_epoch_time,
  203. f_num_reaction_wheels,
  204. f_rw_current_1,
  205. f_rw_current_2,
  206. f_rw_current_3
  207. }
  208. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  209. for i = 0, num_of_instance - 1 do
  210. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  211. local operation_status = buffer(offset, 1):le_uint()
  212. subtree:add(f_operation_status, operation_status)
  213. offset = offset + 1
  214. -- Dissect epoch time (4 bytes, little-endian)
  215. local epoch_time = buffer(offset, 4):le_uint()
  216. subtree:add(f_epoch_time, epoch_time)
  217. offset = offset + 4
  218. -- Dissect number of reaction wheels (4 bytes, little-endian)
  219. local num_reaction_wheels = buffer(offset, 1):le_uint()
  220. subtree:add(f_num_reaction_wheels, num_reaction_wheels)
  221. offset = offset + 1
  222. -- Dissect Reaction Wheel Current 1 (4 bytes, little-endian)
  223. local rw_current_1_raw = buffer(offset, 2):le_uint()
  224. local rw_current_1 = rw_current_1_raw * 0.1 -- Apply multiplier
  225. subtree:add(f_rw_current_1, rw_current_1)
  226. offset = offset + 2
  227. -- Dissect Reaction Wheel Current 2 (4 bytes, little-endian)
  228. local rw_current_2_raw = buffer(offset, 2):le_uint()
  229. local rw_current_2 = rw_current_2_raw * 0.1 -- Apply multiplier
  230. subtree:add(f_rw_current_2, rw_current_2)
  231. offset = offset + 2
  232. -- Dissect Reaction Wheel Current 3 (4 bytes, little-endian)
  233. local rw_current_3_raw = buffer(offset, 2):le_uint()
  234. local rw_current_3 = rw_current_3_raw * 0.1 -- Apply multiplier
  235. subtree:add(f_rw_current_3, rw_current_3)
  236. offset = offset + 2
  237. end
  238. end
  239. function adcs_dissector_3(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  240. local f_operation_status = ProtoField.uint8("current_protocol.operation_status", "Operation Status", base.DEC)
  241. local f_epoch_time = ProtoField.uint32("current_protocol.epoch_time", "Epoch Time", base.DEC)
  242. local f_cube_star_current = ProtoField.uint16("current_protocol.cube_star_current", "Cube Star Current ", base.DEC)
  243. local f_magnetorquer_current = ProtoField.uint16("current_protocol.magnetorquer_current", "Magnetorquer Current ", base.DEC)
  244. local f_cube_star_mcu_temp = ProtoField.uint16("current_protocol.cube_star_mcu_temp", "Cube Star MCU Temperature ", base.DEC)
  245. adcs_protocol.fields = {
  246. f_operation_status,
  247. f_epoch_time,
  248. f_cube_star_current,
  249. f_magnetorquer_current,
  250. f_cube_star_mcu_temp }
  251. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  252. for i = 0, num_of_instance - 1 do
  253. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  254. subtree:add(f_operation_status, buffer(offset, 1):le_uint())
  255. offset = offset + 1 -- Update offset
  256. -- Epoch Time (4 bytes, UINT)
  257. subtree:add(f_epoch_time, buffer(offset, 4):le_uint())
  258. offset = offset + 4 -- Update offset
  259. -- Cube Star Current (2 bytes, UINT)
  260. local cube_star_current = buffer(offset, 2):le_uint() * 0.1 -- Apply the scaling factor (RAWVAL * 0.1)
  261. subtree:add(f_cube_star_current, cube_star_current)
  262. offset = offset + 2 -- Update offset
  263. -- Magnetorquer Current (2 bytes, UINT)
  264. local magnetorquer_current = buffer(offset, 2):le_uint() * 0.1 -- Apply the scaling factor (RAWVAL * 0.1)
  265. subtree:add(f_magnetorquer_current, magnetorquer_current)
  266. offset = offset + 2 -- Update offset
  267. -- Cube Star MCU Temperature (2 bytes, UINT)
  268. local cube_star_mcu_temp = buffer(offset, 2):le_uint() * 0.1 -- Apply the scaling factor (RAWVAL * 0.1)
  269. subtree:add(f_cube_star_mcu_temp, cube_star_mcu_temp)
  270. offset = offset + 2 -- Update offset
  271. end
  272. end
  273. function adcs_dissector_4(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  274. local f_operation_status = ProtoField.uint32("adcs_protocol.operation_status", "Operation Status", base.DEC)
  275. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  276. local f_mcu_temperature = ProtoField.int16("adcs_protocol.mcu_temperature", "MCU Temperature ", base.DEC)
  277. local f_magnetometer_temperature = ProtoField.int16("adcs_protocol.magnetometer_temperature", "Magnetometer Temperature ", base.DEC)
  278. local f_redundant_magnetometer_temperature = ProtoField.int16("adcs_protocol.redundant_magnetometer_temperature", "Redundant Magnetometer Temperature ", base.DEC)
  279. -- Add the fields to the protocol
  280. adcs_protocol.fields = { f_operation_status, f_epoch_time, f_mcu_temperature, f_magnetometer_temperature, f_redundant_magnetometer_temperature }
  281. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  282. for i = 0, num_of_instance - 1 do
  283. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  284. subtree:add(f_operation_status, buffer(offset, 1):le_uint()) -- 1 bytes for Operation Status (UINT)
  285. offset = offset + 1
  286. subtree:add(f_epoch_time, buffer(offset, 4):le_uint()) -- 4 bytes for Epoch Time (UINT)
  287. offset = offset + 4
  288. -- Extract raw values for the temperatures (2 bytes each for INT)
  289. local mcu_temp = buffer(offset, 2):le_uint() * 0.01
  290. offset = offset + 2
  291. local magnetometer_temp = buffer(offset, 2):le_uint() * 0.01
  292. offset = offset + 2
  293. local redundant_magnetometer_temp = buffer(offset, 2):le_uint() * 0.01
  294. offset = offset + 2
  295. -- Add the temperature values to the tree with scaling applied
  296. subtree:add(f_mcu_temperature, mcu_temp)
  297. subtree:add(f_magnetometer_temperature, magnetometer_temp)
  298. subtree:add(f_redundant_magnetometer_temperature, redundant_magnetometer_temp)
  299. end
  300. end
  301. function adcs_dissector_5(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  302. local f_operation_status = ProtoField.uint8("adcs_protocol.operation_status", "Operation Status", base.DEC)
  303. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  304. local f_raw_mag_x = ProtoField.uint16("adcs_protocol.raw_mag_x", "X Rate Sensor Temperature ", base.DEC)
  305. local f_raw_mag_y = ProtoField.uint16("adcs_protocol.raw_mag_y", "Y Rate Sensor Temperature ", base.DEC)
  306. local f_raw_mag_z = ProtoField.uint16("adcs_protocol.raw_mag_z", "Z Rate Sensor Temperature ", base.DEC)
  307. -- Add the fields to the protocol
  308. adcs_protocol.fields = { f_operation_status, f_epoch_time, f_raw_mag_x, f_raw_mag_y, f_raw_mag_z }
  309. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  310. for i = 0, num_of_instance - 1 do
  311. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  312. -- Operation Status (1 bytes, unsigned)
  313. subtree:add(f_operation_status, buffer(offset, 1):le_uint())
  314. offset = offset + 1
  315. -- Epoch Time (4 bytes, unsigned)
  316. subtree:add(f_epoch_time, buffer(offset, 4):le_uint())
  317. offset = offset + 4
  318. -- Raw Magnetometer X (2 bytes, signed)
  319. local raw_mag_x = buffer(offset, 2):le_int()
  320. subtree:add(f_raw_mag_x, raw_mag_x)
  321. offset = offset + 2
  322. -- Raw Magnetometer Y (4 bytes, signed)
  323. local raw_mag_y = buffer(offset, 2):le_int()
  324. subtree:add(f_raw_mag_y, raw_mag_y)
  325. offset = offset + 2
  326. -- Raw Magnetometer Z (4 bytes, signed)
  327. local raw_mag_z = buffer(offset, 2):le_int()
  328. subtree:add(f_raw_mag_z, raw_mag_z)
  329. offset = offset + 2
  330. end
  331. end
  332. function adcs_dissector_6(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  333. local f_operation_status = ProtoField.uint8("adcs_protocol.operation_status", "Operation Status", base.HEX)
  334. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  335. local f_attitude_estimation_mode = ProtoField.uint8("adcs_protocol.attitude_estimation_mode", "Attitude Estimation Mode", base.DEC)
  336. local f_control_mode = ProtoField.uint8("adcs_protocol.control_mode", "Control Mode", base.DEC)
  337. local f_adcs_run_mode = ProtoField.uint8("adcs_protocol.adcs_run_mode", "ADCS Run Mode", base.DEC)
  338. local f_asgp4_mode = ProtoField.uint8("adcs_protocol.asgp4_mode", "ASGP4 Mode", base.DEC)
  339. -- Define boolean fields for enabled flags
  340. local f_cube_control_signal_enabled = ProtoField.bool("adcs_protocol.cube_control_signal_enabled", "Cube Control Signal Enabled")
  341. local f_cube_control_motor_enabled = ProtoField.bool("adcs_protocol.cube_control_motor_enabled", "Cube Control Motor Enabled")
  342. local f_cubesense1_enabled = ProtoField.bool("adcs_protocol.cubesense1_enabled", "Cubesense1 Enabled")
  343. local f_cubesense2_enabled = ProtoField.bool("adcs_protocol.cubesense2_enabled", "Cubesense2 Enabled")
  344. local f_cube_wheel1_enabled = ProtoField.bool("adcs_protocol.cube_wheel1_enabled", "Cube Wheel 1 Enabled")
  345. local f_cube_wheel2_enabled = ProtoField.bool("adcs_protocol.cube_wheel2_enabled", "Cube Wheel 2 Enabled")
  346. local f_cube_wheel3_enabled = ProtoField.bool("adcs_protocol.cube_wheel3_enabled", "Cube Wheel 3 Enabled")
  347. local f_cube_star_enabled = ProtoField.bool("adcs_protocol.cube_star_enabled", "Cube Star Enabled")
  348. local f_gps_receiver_enabled = ProtoField.bool("adcs_protocol.gps_receiver_enabled", "GPS Receiver Enabled")
  349. local f_gps_lna_power_enabled = ProtoField.bool("adcs_protocol.gps_lna_power_enabled", "GPS LNA Power Enabled")
  350. local f_motor_driver_enabled = ProtoField.bool("adcs_protocol.motor_driver_enabled", "Motor Driver Enabled")
  351. local f_sun_is_above_local_horizon = ProtoField.bool("adcs_protocol.sun_is_above_local_horizon", "Sun is Above Local Horizon")
  352. -- Communication error fields
  353. local f_cubesense1_comm_error = ProtoField.bool("adcs_protocol.cubesense1_comm_error", "Cubesense1 Communications Error")
  354. local f_cubesense2_comm_error = ProtoField.bool("adcs_protocol.cubesense2_comm_error", "Cubesense2 Communications Error")
  355. local f_cubcontrol_signal_comm_error = ProtoField.bool("adcs_protocol.cubcontrol_signal_comm_error", "CubeControl Signal Communications Error")
  356. local f_cubcontrol_motor_comm_error = ProtoField.bool("adcs_protocol.cubcontrol_motor_comm_error", "CubeControl Motor Communications Error")
  357. local f_cubewheel1_comm_error = ProtoField.bool("adcs_protocol.cubewheel1_comm_error", "Cube Wheel 1 Communications Error")
  358. local f_cubewheel2_comm_error = ProtoField.bool("adcs_protocol.cubewheel2_comm_error", "Cube Wheel 2 Communications Error")
  359. local f_cubewheel3_comm_error = ProtoField.bool("adcs_protocol.cubewheel2_comm_error", "Cube Wheel 3 Communications Error")
  360. local f_cubestar_comm_error = ProtoField.bool("adcs_protocol.cubewheel2_comm_error", "Cube star communications Error")
  361. local f_magnetometer_range_error = ProtoField.bool("adcs_protocol.magnetometer_range_error", "Magnetometer Range Error")
  362. local f_cam1_sram_overcurrent = ProtoField.bool("adcs_protocol.cam1_sram_overcurrent", "Cam1 SRAM Overcurrent Detected")
  363. local f_cam1_3v3_overcurrent = ProtoField.bool("adcs_protocol.cam1_3v3_overcurrent", "Cam1 3v3 Overcurrent Detected")
  364. local f_cam1_sensor_busy = ProtoField.bool("adcs_protocol.cam1_sensor_busy", "Cam1 Sensor Busy Error")
  365. local f_cam1_sensor_detection_error = ProtoField.bool("adcs_protocol.cam1_sensor_detection_error", "Cam1 Sensor Detection Error")
  366. local f_sun_sensor_range_error = ProtoField.bool("adcs_protocol.sun_sensor_range_error", "Sun Sensor Range Error")
  367. local f_cam2_sram_overcurrent = ProtoField.bool("adcs_protocol.cam2_sram_overcurrent", "Cam2 SRAM Overcurrent Detected")
  368. local f_cam2_3v3_overcurrent = ProtoField.bool("adcs_protocol.cam2_3v3_overcurrent", "Cam2 3v3 Overcurrent Detected")
  369. local f_cam2_sensor_busy = ProtoField.bool("adcs_protocol.cam2_sensor_busy", "Cam2 Sensor Busy Error")
  370. local f_cam2_sensor_detection_error = ProtoField.bool("adcs_protocol.cam2_sensor_detection_error", "Cam2 Sensor Detection Error")
  371. local f_nadir_sensor_range_error = ProtoField.bool("adcs_protocol.nadir_sensor_range_error", "Nadir Sensor Range Error")
  372. local f_rate_sensor_range_error = ProtoField.bool("adcs_protocol.rate_sensor_range_error", "Rate Sensor Range Error")
  373. local f_wheel_speed_range_error = ProtoField.bool("adcs_protocol.wheel_speed_range_error", "Wheel Speed Range Error")
  374. local f_coarse_sun_sensor_error = ProtoField.bool("adcs_protocol.coarse_sun_sensor_error", "Coarse Sun Sensor Error")
  375. local f_star_tracker_match_error = ProtoField.bool("adcs_protocol.star_tracker_match_error", "Star Tracker Match Error")
  376. local f_star_tracker_overcurrent = ProtoField.bool("adcs_protocol.star_tracker_overcurrent", "Star Tracker Overcurrent Detected")
  377. local f_orbit_parameters_invalid = ProtoField.bool("adcs_protocol.orbit_parameters_invalid", "Orbit Parameters are Invalid")
  378. local f_configuration_invalid = ProtoField.bool("adcs_protocol.configuration_invalid", "Configuration is Invalid")
  379. local f_control_mode_change_not_allowed = ProtoField.bool("adcs_protocol.control_mode_change_not_allowed", "Control Mode Change is not allowed")
  380. local f_estimator_change_not_allowed = ProtoField.bool("adcs_protocol.estimator_change_not_allowed", "Estimator Change is not allowed")
  381. -- Define Magnetometer Sampling Mode field (2 bytes)
  382. local f_magnetometer_sampling_mode = ProtoField.uint8("adcs_protocol.magnetometer_sampling_mode", "Magnetometer Sampling Mode", base.DEC)
  383. -- Define runtime error fields
  384. local f_cubesense1_runtime_error = ProtoField.bool("adcs_protocol.cubesense1_runtime_error", "CubeSense1 Runtime Error")
  385. local f_cubesense2_runtime_error = ProtoField.bool("adcs_protocol.cubesense2_runtime_error", "CubeSense2 Runtime Error")
  386. local f_cubecontrol_signal_runtime_error = ProtoField.bool("adcs_protocol.cubecontrol_signal_runtime_error", "CubeControl Signal Runtime Error")
  387. local f_cubecontrol_motor_runtime_error = ProtoField.bool("adcs_protocol.cubecontrol_motor_runtime_error", "CubeControl Motor Runtime Error")
  388. local f_cubewheel1_runtime_error = ProtoField.bool("adcs_protocol.cubewheel1_runtime_error", "CubeWheel1 Runtime Error")
  389. local f_a = ProtoField.bool("adcs_protocol.cubewheel1_runtime_error", "CubeWheel1 Runtime Error")
  390. local f_b = ProtoField.bool("adcs_protocol.cubewheel1_runtime_error", "CubeWheel1 Runtime Error")
  391. local f_cubewheel2_runtime_error = ProtoField.bool("adcs_protocol.cubewheel2_runtime_error", "CubeWheel2 Runtime Error")
  392. local f_cubewheel3_runtime_error = ProtoField.bool("adcs_protocol.cubewheel3_runtime_error", "CubeWheel3 Runtime Error")
  393. local f_cubestar_runtime_error = ProtoField.bool("adcs_protocol.cubestar_runtime_error", "CubeStar Runtime Error")
  394. local f_magnetometer_error = ProtoField.bool("adcs_protocol.magnetometer_error", "Magnetometer Error")
  395. local f_rate_sensor_failure = ProtoField.bool("adcs_protocol.rate_sensor_failure", "Rate Sensor Failure")
  396. -- Add all fields to the protocol
  397. adcs_protocol.fields = {
  398. f_operation_status,
  399. f_epoch_time,
  400. f_attitude_estimation_mode,
  401. f_control_mode,
  402. f_adcs_run_mode,
  403. f_asgp4_mode,
  404. f_cube_control_signal_enabled,
  405. f_cube_control_motor_enabled,
  406. f_cubesense1_enabled,
  407. f_cubesense2_enabled,
  408. f_cube_wheel1_enabled,
  409. f_cube_wheel2_enabled,
  410. f_cube_wheel3_enabled,
  411. f_cube_star_enabled,
  412. f_gps_receiver_enabled,
  413. f_gps_lna_power_enabled,
  414. f_motor_driver_enabled,
  415. f_sun_is_above_local_horizon,
  416. f_cubesense1_comm_error,
  417. f_cubesense2_comm_error,
  418. f_cubcontrol_signal_comm_error,
  419. f_cubcontrol_motor_comm_error,
  420. f_cubewheel1_comm_error,
  421. f_cubewheel2_comm_error,
  422. f_cubewheel3_comm_error,
  423. f_cubestar_comm_error,
  424. f_magnetometer_range_error,
  425. f_cam1_sram_overcurrent,
  426. f_cam1_3v3_overcurrent,
  427. f_cam1_sensor_busy,
  428. f_cam1_sensor_detection_error,
  429. f_sun_sensor_range_error,
  430. f_cam2_sram_overcurrent,
  431. f_cam2_3v3_overcurrent,
  432. f_cam2_sensor_busy,
  433. f_cam2_sensor_detection_error,
  434. f_nadir_sensor_range_error,
  435. f_rate_sensor_range_error,
  436. f_wheel_speed_range_error,
  437. f_coarse_sun_sensor_error,
  438. f_star_tracker_match_error,
  439. f_star_tracker_overcurrent,
  440. f_orbit_parameters_invalid,
  441. f_a,
  442. f_b,
  443. f_configuration_invalid,
  444. f_control_mode_change_not_allowed,
  445. f_estimator_change_not_allowed,
  446. f_magnetometer_sampling_mode,
  447. f_cubesense1_runtime_error,
  448. f_cubesense2_runtime_error,
  449. f_cubecontrol_signal_runtime_error,
  450. f_cubecontrol_motor_runtime_error,
  451. f_cubewheel1_runtime_error,
  452. f_cubewheel2_runtime_error,
  453. f_cubewheel3_runtime_error,
  454. f_cubestar_runtime_error,
  455. f_magnetometer_error,
  456. f_rate_sensor_failure
  457. }
  458. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  459. for i = 0, num_of_instance - 1 do
  460. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  461. subtree:add(f_operation_status, buffer(offset, 1):le_uint())
  462. offset = offset + 1
  463. subtree:add(f_epoch_time, buffer(offset, 4):le_uint())
  464. offset = offset + 4
  465. -- Parse Attitude Estimation Mode (8 bits)
  466. subtree:add(f_attitude_estimation_mode, buffer(offset, 1):le_uint())
  467. offset = offset + 1
  468. -- Parse Control Mode (8 bits)
  469. subtree:add(f_control_mode, buffer(offset, 1):le_uint())
  470. offset = offset + 1
  471. -- Parse ADCS Run Mode (2 bits / 2 bytes)
  472. local a=buffer(offset, 1):le_uint()
  473. subtree:add(f_adcs_run_mode, a & 0x03)
  474. --offset = offset + 2
  475. -- Parse ASGP4 Mode (2 bits / 2 bytes)
  476. subtree:add(f_asgp4_mode, (a >> 2) & 0x03)
  477. subtree:add(f_cube_control_signal_enabled, (a >> 4) & 0x01)
  478. subtree:add(f_cube_control_motor_enabled,(a >> 5) & 0x01 )
  479. subtree:add(f_cubesense1_enabled,(a >> 6) & 0x01 )
  480. subtree:add(f_cubesense2_enabled,(a >> 7) & 0x01 )
  481. offset = offset + 1
  482. -- Parse CubeWheel Enabled Flags
  483. a=buffer(offset, 1):le_uint()
  484. subtree:add(f_cube_wheel1_enabled, (a >> 0) & 0x01)
  485. --offset = offset + 1
  486. a=buffer(offset, 1):le_uint()
  487. subtree:add(f_cube_wheel2_enabled, (a >> 1) & 0x01)
  488. a=buffer(offset, 1):le_uint()
  489. subtree:add(f_cube_wheel3_enabled, (a >> 2) & 0x01)
  490. --offset = offset + 1
  491. subtree:add(f_cube_star_enabled, (a >> 3) & 0x01)
  492. --offset = offset + 1
  493. -- Parse GPS and Motor Driver enabled flags
  494. subtree:add(f_gps_receiver_enabled, (a >> 4) & 0x01)
  495. --offset = offset + 1
  496. -- Continue adding each field to the subtree with the appropriate offsets and bitfields
  497. -- Define additional boolean fields for enabled flags and errors
  498. subtree:add(f_gps_lna_power_enabled, (a >> 5) & 0x01) -- GPS LNA Power Enabled
  499. subtree:add(f_motor_driver_enabled, (a >> 6) & 0x01) -- Motor Driver Enabled
  500. subtree:add(f_sun_is_above_local_horizon, (a >> 7) & 0x01) -- Sun is Above Local Horizon
  501. offset = offset + 1
  502. a = buffer(offset, 1):le_uint()
  503. -- Communication error flags
  504. subtree:add(f_cubesense1_comm_error, (a >> 0) & 0x01) -- Cubesense1 Communications Error
  505. subtree:add(f_cubesense2_comm_error, (a >> 1) & 0x01) -- Cubesense2 Communications Error
  506. a=buffer(offset, 1):le_uint()
  507. subtree:add(f_cubcontrol_signal_comm_error, (a >> 2) & 0x01) -- CubeControl Signal Communications Error
  508. subtree:add(f_cubcontrol_motor_comm_error, (a >> 3) & 0x01) -- CubeControl Motor Communications Error
  509. subtree:add(f_cubewheel1_comm_error, (a >> 4) & 0x01) -- Cube Wheel1 Communications Error
  510. subtree:add(f_cubewheel2_comm_error, (a >> 5) & 0x01) -- Cube Wheel2 Communications Error
  511. subtree:add(f_cubewheel3_comm_error, (a >> 6) & 0x01)
  512. subtree:add(f_cubestar_comm_error, (a >> 7) & 0x01)
  513. offset = offset + 1
  514. a=buffer(offset, 1):le_uint()
  515. subtree:add(f_magnetometer_range_error, (a >> 0) & 0x01) -- Magnetometer Range Error
  516. --offset = offset + 1
  517. -- Sensor errors
  518. subtree:add(f_cam1_sram_overcurrent, (a >> 1) & 0x01) -- Cam1 SRAM Overcurrent Detected
  519. --offset = offset + 1
  520. --offset = offset + 1
  521. --a=buffer(offset,1):le_uint()
  522. subtree:add(f_cam1_3v3_overcurrent, (a >> 2) & 0x01) -- Cam1 3v3 Overcurrent Detected
  523. subtree:add(f_cam1_sensor_busy, (a >> 3) & 0x01) -- Cam1 Sensor Busy Error
  524. subtree:add(f_cam1_sensor_detection_error, (a >> 4) & 0x01 ) -- Cam1 Sensor Detection Error
  525. subtree:add(f_sun_sensor_range_error, (a >> 5) & 0x01) -- Sun Sensor Range Error
  526. subtree:add(f_cam2_sram_overcurrent, (a >> 6) & 0x01) -- Cam2 SRAM Overcurrent Detected
  527. subtree:add(f_cam2_3v3_overcurrent, (a >> 7) & 0x01) -- Cam2 3v3 Overcurrent Detected
  528. offset=offset+1
  529. local data=buffer(offset, 1):le_uint()
  530. subtree:add(f_cam2_sensor_busy, (data >> 0) & 0x01) -- Cam2 Sensor Busy Error
  531. --offset = offset + 1
  532. subtree:add(f_cam2_sensor_detection_error, (data >> 1) & 0x01) -- Cam2 Sensor Detection Error
  533. --offset = offset + 1
  534. --local data = buffer(offset, 1):le_uint()
  535. subtree:add(f_nadir_sensor_range_error, (data >> 2) & 0x01) -- Nadir Sensor Range Error
  536. subtree:add(f_rate_sensor_range_error, (data >> 3) & 0x01) -- Rate Sensor Range Error
  537. subtree:add(f_wheel_speed_range_error,(data >> 4) & 0x01) -- Wheel Speed Range Error
  538. -- Error flags for sensors and system issues
  539. subtree:add(f_coarse_sun_sensor_error,(data >> 5) & 0x01) -- Coarse Sun Sensor Error
  540. subtree:add(f_star_tracker_match_error, (data >> 6) & 0x01) -- Star Tracker Match Error
  541. subtree:add(f_star_tracker_overcurrent, (data >> 7) & 0x01) -- Star Tracker Overcurrent Detected
  542. offset = offset + 1
  543. data = buffer(offset, 1):le_uint()
  544. subtree:add(f_orbit_parameters_invalid, (data >> 0) & 0x01) -- Orbit Parameters are Invalid
  545. subtree:add(f_configuration_invalid,(data >> 1) & 0x01) -- Configuration is Invalid
  546. --offset = offset + 1
  547. --data = buffer(offset, 1):le_uint()
  548. subtree:add(f_control_mode_change_not_allowed, (data >> 2) & 0x01) -- Control Mode Change is Not Allowed
  549. subtree:add(f_estimator_change_not_allowed, (data >> 3) & 0x01) -- Estimator Change is Not Allowed
  550. -- Magnetometer Sampling Mode (2 bits)
  551. subtree:add(f_magnetometer_sampling_mode, (data >> 4) & 0x03) -- Current Magnetometer Sampling Mode
  552. -- Runtime error flags for sensors and systems
  553. subtree:add(f_a, (data >> 6 ) & 0x01) -- CubeSense1 Runtime Error
  554. subtree:add(f_b, (data >> 7) & 0x01) -- CubeSense2 Runtime Error
  555. offset=offset+1
  556. data = buffer(offset, 1):le_uint()
  557. subtree:add(f_cubesense1_runtime_error, (data >> 0) & 0x01) -- CubeSense1 Runtime Error
  558. subtree:add(f_cubesense2_runtime_error, (data >> 1) & 0x01) -- CubeSense2 Runtime Error
  559. subtree:add(f_cubecontrol_signal_runtime_error, (data >> 2) & 0x01) -- CubeControl Signal Runtime Error
  560. subtree:add(f_cubecontrol_motor_runtime_error, (data >> 3) & 0x01) -- CubeControl Motor Runtime Error
  561. subtree:add(f_cubewheel1_runtime_error,(data >> 4) & 0x01) -- CubeWheel1 Runtime Error
  562. subtree:add(f_cubewheel2_runtime_error, (data >> 5) & 0x01) -- CubeWheel2 Runtime Error
  563. --offset = offset + 1
  564. --data = buffer(offset, 1):le_uint()
  565. subtree:add(f_cubewheel3_runtime_error, (data >> 6) & 0x01) -- CubeWheel3 Runtime Error
  566. subtree:add(f_cubestar_runtime_error, (data >> 7) & 0x01) -- CubeStar Runtime Error
  567. offset=offset+1
  568. data = buffer(offset, 1):le_uint()
  569. -- Magnetometer and sensor errors
  570. subtree:add(f_magnetometer_error, (data >> 0) & 0x01) -- Magnetometer Error
  571. subtree:add(f_rate_sensor_failure, (data >> 1) & 0x01) -- Rate Sensor Failure
  572. offset = offset + 1
  573. end
  574. end
  575. function adcs_dissector_7(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  576. local f_operation_status = ProtoField.uint8("adcs_protocol.operation_status", "Operation Status", base.DEC)
  577. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  578. local f_x_sun_vector = ProtoField.float("adcs_protocol.x_sun_vector", "X Sun Vector", base.DEC)
  579. local f_y_sun_vector = ProtoField.float("adcs_protocol.y_sun_vector", "Y Sun Vector", base.DEC)
  580. local f_z_sun_vector = ProtoField.float("adcs_protocol.z_sun_vector", "Z Sun Vector", base.DEC)
  581. -- Register fields to the protocol
  582. adcs_protocol.fields = { f_operation_status, f_epoch_time, f_x_sun_vector, f_y_sun_vector, f_z_sun_vector }
  583. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  584. for i = 0, num_of_instance - 1 do
  585. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  586. subtree:add(f_operation_status, buffer(offset, 1):le_uint()) -- 1 byte for Operation Status
  587. offset = offset + 1 -- Update offset
  588. -- Epoch Time (4 bytes, UINT)
  589. subtree:add(f_epoch_time, buffer(offset, 4):le_uint()) -- 4 bytes for Epoch Time
  590. offset = offset + 4 -- Update offset
  591. -- X-axis Sun Vector (2 bytes, INT) with scaling factor (RAWVAL * 0.001)
  592. local x_sun_vector_raw = buffer(offset, 2):le_int() -- Read the 2-byte INT value
  593. local x_sun_vector = x_sun_vector_raw * 0.001 -- Apply scaling factor
  594. subtree:add(f_x_sun_vector, x_sun_vector) -- Add to subtree with scaling
  595. offset = offset + 2 -- Update offset
  596. -- Y-axis Sun Vector (2 bytes, INT) with scaling factor (RAWVAL * 0.001)
  597. local y_sun_vector_raw = buffer(offset, 2):le_int() -- Read the 2-byte INT value
  598. local y_sun_vector = y_sun_vector_raw * 0.001 -- Apply scaling factor
  599. subtree:add(f_y_sun_vector, y_sun_vector) -- Add to subtree with scaling
  600. offset = offset + 2 -- Update offset
  601. -- Z-axis Sun Vector (2 bytes, INT) with scaling factor (RAWVAL * 0.001)
  602. local z_sun_vector_raw = buffer(offset, 2):le_int() -- Read the 2-byte INT value
  603. local z_sun_vector = z_sun_vector_raw * 0.001 -- Apply scaling factor
  604. subtree:add(f_z_sun_vector, z_sun_vector) -- Add to subtree with scaling
  605. offset = offset + 2 -- Update offset
  606. end
  607. end
  608. function adcs_dissector_8(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  609. local f_operation_status = ProtoField.uint8("adcs_protocol.operation_status", "Operation Status", base.DEC)
  610. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  611. local f_css_ad_value_1 = ProtoField.uint8("myprotocol.css_ad_value_1", "Raw css 1 ", base.DEC)
  612. local f_css_ad_value_2 = ProtoField.uint8("myprotocol.css_ad_value_2", "Raw css 2", base.DEC)
  613. local f_css_ad_value_3 = ProtoField.uint8("myprotocol.css_ad_value_3", "Raw css 3", base.DEC)
  614. local f_css_ad_value_4 = ProtoField.uint8("myprotocol.css_ad_value_4", "Raw css 4", base.DEC)
  615. local f_css_ad_value_5 = ProtoField.uint8("myprotocol.css_ad_value_5", "Raw css 5", base.DEC)
  616. local f_css_ad_value_6 = ProtoField.uint8("myprotocol.css_ad_value_6", "Raw css 6", base.DEC)
  617. local f_css_ad_value_7 = ProtoField.uint8("myprotocol.css_ad_value_7", "Raw css 7", base.DEC)
  618. local f_css_ad_value_8 = ProtoField.uint8("myprotocol.css_ad_value_8", "Raw css 8", base.DEC)
  619. local f_css_ad_value_9 = ProtoField.uint8("myprotocol.css_ad_value_9", "Raw css 9", base.DEC)
  620. local f_css_ad_value_10 = ProtoField.uint8("myprotocol.css_ad_value_10", "Raw css 10", base.DEC)
  621. adcs_protocol.fields = { f_operation_status,
  622. f_epoch_time, f_css_ad_value_1,
  623. f_css_ad_value_2,
  624. f_css_ad_value_3,
  625. f_css_ad_value_4,
  626. f_css_ad_value_5,
  627. f_css_ad_value_6,
  628. f_css_ad_value_7,
  629. f_css_ad_value_8,
  630. f_css_ad_value_9,
  631. f_css_ad_value_10
  632. }
  633. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  634. for i = 0, num_of_instance - 1 do
  635. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  636. subtree:add(f_operation_status, buffer(offset, 1):le_uint()) -- 1 byte for Operation Status
  637. offset = offset + 1 -- Update offset
  638. -- Epoch Time (4 bytes, UINT)
  639. subtree:add(f_epoch_time, buffer(offset, 4):le_uint()) -- 4 bytes for Epoch Time
  640. offset = offset + 4 -- Update offset
  641. -- CSS A/D Values (10 individual uint8 fields)
  642. subtree:add(f_css_ad_value_1, buffer(offset, 1))
  643. offset = offset + 1 -- Update offset
  644. subtree:add(f_css_ad_value_2, buffer(offset, 1))
  645. offset = offset + 1 -- Update offset
  646. subtree:add(f_css_ad_value_3, buffer(offset, 1))
  647. offset = offset + 1 -- Update offset
  648. subtree:add(f_css_ad_value_4, buffer(offset, 1))
  649. offset = offset + 1 -- Update offset
  650. subtree:add(f_css_ad_value_5, buffer(offset, 1))
  651. offset = offset + 1 -- Update offset
  652. subtree:add(f_css_ad_value_6, buffer(offset, 1))
  653. offset = offset + 1 -- Update offset
  654. subtree:add(f_css_ad_value_7, buffer(offset, 1))
  655. offset = offset + 1 -- Update offset
  656. subtree:add(f_css_ad_value_8, buffer(offset, 1))
  657. offset = offset + 1 -- Update offset
  658. subtree:add(f_css_ad_value_9, buffer(offset, 1))
  659. offset = offset + 1 -- Update offset
  660. subtree:add(f_css_ad_value_10, buffer(offset, 1))
  661. offset = offset + 1
  662. end
  663. end
  664. function adcs_dissector_9(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  665. -- Define the fields for the protocol
  666. local f_operation_status = ProtoField.uint8("adcs_protocol.operation_status", "Operation Status", base.DEC)
  667. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  668. local f_sun_x = ProtoField.float("adcs_protocol.sun_x", "FSS X axis vector ", base.DEC)
  669. local f_sun_y = ProtoField.float("adcs_protocol.sun_y", "FSS y axis vector", base.DEC)
  670. local f_sun_z = ProtoField.float("adcs_protocol.sun_z", "FSS z axis vector", base.DEC)
  671. adcs_protocol.fields = {
  672. f_operation_status, f_epoch_time,
  673. f_sun_x, f_sun_y, f_sun_z }
  674. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  675. for i = 0, num_of_instance - 1 do
  676. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  677. subtree:add(f_operation_status, buffer(offset, 1):le_uint())
  678. offset = offset + 1 -- Update offset
  679. -- Epoch Time (4 bytes, UINT)
  680. subtree:add(f_epoch_time, buffer(offset, 4):le_uint())
  681. offset = offset + 4 -- Update offset
  682. -- Sun X (2 bytes, INT, formatted as RAWVAL * 0.001)
  683. local raw_sun_x = buffer(offset, 2):le_int()
  684. local sun_x = raw_sun_x * 0.001
  685. subtree:add(f_sun_x, sun_x)
  686. offset = offset + 2 -- Update offset
  687. -- Sun Y (2 bytes, INT, formatted as RAWVAL * 0.001)
  688. local raw_sun_y = buffer(offset, 2):le_int()
  689. local sun_y = raw_sun_y * 0.001
  690. subtree:add(f_sun_y, sun_y)
  691. offset = offset + 2 -- Update offset
  692. -- Sun Z (2 bytes, INT, formatted as RAWVAL * 0.001)
  693. local raw_sun_z = buffer(offset, 2):le_int()
  694. local sun_z = raw_sun_z * 0.001
  695. subtree:add(f_sun_z, sun_z)
  696. offset = offset + 2 -- Update offs
  697. end
  698. end
  699. function adcs_dissector_10(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  700. local f_operation_status = ProtoField.uint8("adcs_protocol.operation_status", "Operation Status", base.DEC)
  701. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  702. local f_fss_raw_x_angle = ProtoField.int16("adcs_protocol.fss_raw_x_angle", "FSS Raw X Angle", base.DEC)
  703. local f_fss_raw_y_angle = ProtoField.int16("adcs_protocol.fss_raw_y_angle", "FSS Raw Y Angle", base.DEC)
  704. local f_fss_capture_status = ProtoField.uint8("adcs_protocol.fss_capture_status", "FSS Capture Status", base.DEC)
  705. local f_fss_detection_result = ProtoField.uint8("adcs_protocol.fss_detection_result", "FSS Detection Result", base.DEC)
  706. -- Add the protocol fields to the protocol
  707. adcs_protocol.fields = {
  708. f_operation_status,
  709. f_epoch_time,
  710. f_fss_raw_x_angle,
  711. f_fss_raw_y_angle,
  712. f_fss_capture_status,
  713. f_fss_detection_result
  714. }
  715. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  716. for i = 0, num_of_instance - 1 do
  717. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  718. subtree:add(f_operation_status, buffer(offset, 1):le_uint())
  719. offset = offset + 1 -- Update offset
  720. -- Epoch Time (4 bytes, UINT)
  721. subtree:add(f_epoch_time, buffer(offset, 4):le_uint())
  722. offset = offset + 4 -- Update offset
  723. -- FSS Raw X Angle (2 bytes, INT)
  724. subtree:add(f_fss_raw_x_angle, buffer(offset, 2):le_int())
  725. offset = offset + 2 -- Update offset
  726. -- FSS Raw Y Angle (2 bytes, INT)
  727. subtree:add(f_fss_raw_y_angle, buffer(offset, 2):le_int())
  728. offset = offset + 2 -- Update offset
  729. -- FSS Capture Status (1 byte, ENUM)
  730. local capture_status = buffer(offset, 1):le_uint()
  731. subtree:add(f_fss_capture_status, capture_status)
  732. --subtree:add_expert_info(PI_INFO, PI_WARN, "FSS Capture Status: " .. capture_status_enum[capture_status] or "Unknown")
  733. offset = offset + 1 -- Update offset
  734. -- FSS Detection Result (1 byte, ENUM)
  735. local detection_result = buffer(offset, 1):le_uint()
  736. subtree:add(f_fss_detection_result, detection_result)
  737. --subtree:add_expert_info(PI_INFO, PI_WARN, "FSS Detection Result: " .. detection_result_enum[detection_result] or "Unknown")
  738. offset = offset + 1 -- Update offset
  739. end
  740. end
  741. function adcs_dissector_11(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  742. local f_operation_status = ProtoField.uint8("adcs_protocol.operation_status", "Operation Status", base.DEC)
  743. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  744. local f_x_axis_nadir_vector = ProtoField.int16("adcs_protocol.x_axis_nadir_vector", "X axis Nadir Vector ", base.DEC)
  745. local f_y_axis_nadir_vector = ProtoField.int16("adcs_protocol.y_axis_nadir_vector", "Y axis Nadir Vector ", base.DEC)
  746. local f_z_axis_nadir_vector = ProtoField.int16("adcs_protocol.z_axis_nadir_vector", "Z axis Nadir Vector ", base.DEC)
  747. -- Add the protocol fields to the protocol
  748. adcs_protocol.fields = {
  749. f_operation_status,
  750. f_epoch_time,
  751. f_x_axis_nadir_vector,
  752. f_y_axis_nadir_vector,
  753. f_z_axis_nadir_vector
  754. }
  755. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  756. for i = 0, num_of_instance - 1 do
  757. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  758. subtree:add(f_operation_status, buffer(offset, 1):le_uint())
  759. offset = offset + 1 -- Update offset
  760. -- Epoch Time (4 bytes, UINT)
  761. subtree:add(f_epoch_time, buffer(offset, 4):le_uint())
  762. offset = offset + 4 -- Update offset
  763. -- X axis Nadir Vector (2 bytes, INT) *0.001 (formatted value)
  764. local x_axis_raw = buffer(offset, 2):le_int()
  765. local x_axis_nadir = x_axis_raw * 0.001 -- Apply the formatting to the raw value
  766. subtree:add(f_x_axis_nadir_vector, x_axis_raw)
  767. --subtree:add(PI_INFO, PI_WARN, string.format("X axis Nadir vector: %.3f", x_axis_nadir))
  768. offset = offset + 2 -- Update offset
  769. -- Y axis Nadir Vector (2 bytes, INT) *0.001 (formatted value)
  770. local y_axis_raw = buffer(offset, 2):le_int()
  771. local y_axis_nadir = y_axis_raw * 0.001 -- Apply the formatting to the raw value
  772. subtree:add(f_y_axis_nadir_vector, y_axis_raw)
  773. --subtree:add(PI_INFO, PI_WARN, string.format("Y axis Nadir vector: %.3f", y_axis_nadir))
  774. offset = offset + 2 -- Update offset
  775. -- Z axis Nadir Vector (2 bytes, INT) *0.001 (formatted value)
  776. local z_axis_raw = buffer(offset, 2):le_int()
  777. local z_axis_nadir = z_axis_raw * 0.001 -- Apply the formatting to the raw value
  778. subtree:add(f_z_axis_nadir_vector, z_axis_raw)
  779. --subtree:add(PI_INFO, PI_WARN, string.format("Z axis Nadir vector: %.3f", z_axis_nadir))
  780. offset = offset + 2 -- Update offset
  781. end
  782. end
  783. function adcs_dissector_12(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  784. local f_operation_status = ProtoField.uint8("adcs_protocol.operation_status", "Operation Status", base.DEC)
  785. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  786. local f_nadir_x_angle = ProtoField.int16("adcs_protocol.nadir_x_angle", "Nadir Sensor Raw X Angle", base.DEC)
  787. local f_nadir_y_angle = ProtoField.int16("adcs_protocol.nadir_y_angle", "Nadir Sensor Raw Y Angle", base.DEC)
  788. local f_nadir_capture_status = ProtoField.uint8("adcs_protocol.nadir_capture_status", "Nadir Sensor Capture Status", base.DEC)
  789. local f_nadir_detection_result = ProtoField.uint8("adcs_protocol.nadir_detection_result", "Nadir Sensor Detection Result", base.DEC)
  790. -- Add the protocol fields to the protocol
  791. adcs_protocol.fields = {
  792. f_operation_status,
  793. f_epoch_time,
  794. f_nadir_x_angle,
  795. f_nadir_y_angle,
  796. f_nadir_capture_status,
  797. f_nadir_detection_result
  798. }
  799. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  800. for i = 0, num_of_instance - 1 do
  801. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  802. subtree:add(f_operation_status, buffer(offset, 1):le_uint())
  803. offset = offset + 1 -- Update offset
  804. -- Epoch Time (4 bytes, UINT)
  805. subtree:add(f_epoch_time, buffer(offset, 4):le_uint())
  806. offset = offset + 4 -- Update offset
  807. -- Nadir Sensor Raw X Angle (2 bytes, INT)
  808. local x_raw = buffer(offset, 2):le_int()
  809. subtree:add(f_nadir_x_angle, x_raw)
  810. offset = offset + 2 -- Update offset
  811. -- Nadir Sensor Raw Y Angle (2 bytes, INT)
  812. local y_raw = buffer(offset, 2):le_int()
  813. subtree:add(f_nadir_y_angle, y_raw)
  814. offset = offset + 2 -- Update offset
  815. -- Nadir Sensor Capture Status (1 byte, ENUM)
  816. local capture_status = buffer(offset, 1):le_uint()
  817. subtree:add(f_nadir_capture_status, capture_status)
  818. offset = offset + 1 -- Update offset
  819. -- Nadir Sensor Detection Result (1 byte, ENUM)
  820. local detection_result = buffer(offset, 1):le_uint()
  821. subtree:add(f_nadir_detection_result, detection_result)
  822. offset = offset + 1
  823. end
  824. end
  825. function adcs_dissector_13(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  826. local f_operation_status = ProtoField.uint8("magnetic_field_protocol.operation_status", "Operation Status", base.DEC)
  827. local f_epoch_time = ProtoField.uint32("magnetic_field_protocol.epoch_time", "Epoch Time", base.DEC)
  828. local f_magnetic_field_x = ProtoField.float("adcs_protocol.magnetic_field_x", "X Axis Magnetic Field Vector", base.DEC)
  829. local f_magnetic_field_y = ProtoField.float("adcs_protocol.magnetic_field_y", "Y Axis Magnetic Field Vector", base.DEC)
  830. local f_magnetic_field_z = ProtoField.float("adcs_protocol.magnetic_field_z", "Z Axis Magnetic Field Vector", base.DEC)
  831. -- Add the protocol fields to the protocol
  832. adcs_protocol.fields = {
  833. f_operation_status,
  834. f_epoch_time,
  835. f_magnetic_field_x,
  836. f_magnetic_field_y,
  837. f_magnetic_field_z
  838. }
  839. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  840. for i = 0, num_of_instance - 1 do
  841. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  842. subtree:add(f_operation_status, buffer(offset, 1):le_uint())
  843. offset = offset + 1 -- Update offset
  844. -- Epoch Time (4 bytes, UINT)
  845. subtree:add(f_epoch_time, buffer(offset, 4):le_uint())
  846. offset = offset + 4 -- Update offset
  847. -- X Axis Magnetic Field Vector (2 bytes, INT)
  848. local x_field = buffer(offset, 2):le_int() -- Apply the scaling factor (RAWVAL * 0.01)
  849. local x_field1 = x_field * 0.01
  850. subtree:add(f_magnetic_field_x, x_field1)
  851. offset = offset + 2 -- Update offset
  852. -- Y Axis Magnetic Field Vector (2 bytes, INT)
  853. local y_field = buffer(offset, 2):le_int() -- Apply the scaling factor (RAWVAL * 0.01)
  854. local y_field1 = y_field * 0.01
  855. subtree:add(f_magnetic_field_y, y_field1)
  856. offset = offset + 2 -- Update offset
  857. -- Z Axis Magnetic Field Vector (2 bytes, INT)
  858. local z_field = buffer(offset, 2):le_int() -- Apply the scaling factor (RAWVAL * 0.01)
  859. local z_field1 = y_field * 0.01
  860. subtree:add(f_magnetic_field_z, z_field1)
  861. offset = offset + 2 -- Update offset
  862. end
  863. end
  864. function adcs_dissector_32(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  865. -- Define ProtoFields for each field in the structure
  866. local f_op_status = ProtoField.uint8("OperationData.op_status", "Operation Status", base.DEC)
  867. local f_epoch_time = ProtoField.uint32("OperationData.epoch_time", "Epoch Time", base.DEC)
  868. local f_eci_x_velocity = ProtoField.int16("OperationData.eci_x_velocity", "ECI Referenced X Velocity", base.DEC)
  869. local f_eci_y_velocity = ProtoField.int16("OperationData.eci_y_velocity", "ECI Referenced Y Velocity", base.DEC)
  870. local f_eci_z_velocity = ProtoField.int16("OperationData.eci_z_velocity", "ECI Referenced Z Velocity", base.DEC)
  871. -- Add the fields to the protocol
  872. adcs_protocol.fields = {
  873. f_op_status, f_epoch_time, f_eci_x_velocity, f_eci_y_velocity, f_eci_z_velocity
  874. }
  875. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  876. for i = 0, num_of_instance - 1 do
  877. -- Add the operation data subtree
  878. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  879. -- dissect operation status (1 byte, UINT)
  880. local op_status = buffer(offset, 1):le_uint()
  881. subtree:add(f_op_status, op_status)
  882. offset = offset + 1
  883. -- dissect epoch time (4 bytes, UINT)
  884. local epoch_time = buffer(offset, 4):le_uint()
  885. subtree:add(f_epoch_time, epoch_time)
  886. offset = offset + 4
  887. -- dissect ECI X velocity (2 bytes, INT)
  888. local eci_x_velocity = buffer(offset, 2):le_int()
  889. subtree:add(f_eci_x_velocity, eci_x_velocity)
  890. offset = offset + 2
  891. -- dissect ECI Y velocity (2 bytes, INT)
  892. local eci_y_velocity = buffer(offset, 2):le_int()
  893. subtree:add(f_eci_y_velocity, eci_y_velocity)
  894. offset = offset + 2
  895. -- dissect ECI Z velocity (2 bytes, INT)
  896. local eci_z_velocity = buffer(offset, 2):le_int()
  897. subtree:add(f_eci_z_velocity, eci_z_velocity)
  898. offset = offset + 2
  899. end
  900. end
  901. ----------------------------------------------------------------------------------------------------------------
  902. function adcs_dissector_31(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  903. -- Define ProtoFields for each field in the structure
  904. local f_op_status = ProtoField.uint8("OperationCoordinates.op_status", "Operation Status", base.DEC)
  905. local f_epoch_time = ProtoField.uint32("OperationCoordinates.epoch_time", "Epoch Time", base.DEC)
  906. local f_eci_x_coord = ProtoField.int16("OperationCoordinates.eci_x_coord", "ECI Referenced X Coordinate", base.DEC)
  907. local f_eci_y_coord = ProtoField.int16("OperationCoordinates.eci_y_coord", "ECI Referenced Y Coordinate", base.DEC)
  908. local f_eci_z_coord = ProtoField.int16("OperationCoordinates.eci_z_coord", "ECI Referenced Z Coordinate", base.DEC)
  909. -- Add the fields to the protocol
  910. adcs_protocol.fields = {
  911. f_op_status, f_epoch_time, f_eci_x_coord, f_eci_y_coord, f_eci_z_coord
  912. }
  913. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  914. for i = 0, num_of_instance - 1 do
  915. -- Add the operation data coordinates subtree
  916. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  917. -- dissect operation status (1 byte, UINT)
  918. local op_status = buffer(offset, 1):le_uint()
  919. subtree:add(f_op_status, op_status)
  920. offset = offset + 1
  921. -- dissect epoch time (4 bytes, UINT)
  922. local epoch_time = buffer(offset, 4):le_uint()
  923. subtree:add(f_epoch_time, epoch_time)
  924. offset = offset + 4
  925. -- dissect ECI X coordinate (2 bytes, INT)
  926. local eci_x_coord = buffer(offset, 2):le_int()
  927. subtree:add(f_eci_x_coord, eci_x_coord)
  928. offset = offset + 2
  929. -- dissect ECI Y coordinate (2 bytes, INT)
  930. local eci_y_coord = buffer(offset, 2):le_int()
  931. subtree:add(f_eci_y_coord, eci_y_coord)
  932. offset = offset + 2
  933. -- dissect ECI Z coordinate (2 bytes, INT)
  934. local eci_z_coord = buffer(offset, 2):le_int()
  935. subtree:add(f_eci_z_coord, eci_z_coord)
  936. offset = offset + 2
  937. end
  938. end
  939. -------------------------------------------------------------------------------------------------------------
  940. -- Define the dissector function for the new structure
  941. function adcs_dissector_30(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  942. -- Define ProtoFields for the new structure fields
  943. local f_op_status = ProtoField.uint8("PowerSystemData.op_status", "Operation Status", base.DES)
  944. local f_epoch_time = ProtoField.uint32("PowerSystemData.epoch_time", "Epoch Time", base.DES)
  945. local f_x_coord = ProtoField.int16("PowerSystemData.x_coord", "ECEF X Coordinate", base.DEC)
  946. local f_y_coord = ProtoField.int16("PowerSystemData.y_coord", "ECEF Y Coordinate", base.DEC)
  947. local f_z_coord = ProtoField.int16("PowerSystemData.z_coord", "ECEF Z Coordinate", base.DEC)
  948. -- Add the fields to the protocol
  949. adcs_protocol.fields = {
  950. f_op_status, f_epoch_time, f_x_coord, f_y_coord, f_z_coord
  951. }
  952. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  953. -- Loop through the data (data3 could represent the number of iterations or packets to dissect)
  954. for i = 0, num_of_instance - 1 do
  955. -- Add the new structure data as a subtree
  956. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  957. -- dissect operation status (1 byte)
  958. local op_status = buffer(offset, 1):le_uint()
  959. subtree:add(f_op_status, op_status)
  960. offset = offset + 1
  961. -- dissect epoch time (4 bytes)
  962. local epoch_time = buffer(offset, 4):le_uint()
  963. subtree:add(f_epoch_time, epoch_time)
  964. offset = offset + 4
  965. -- dissect ECEF X coordinate (2 bytes)
  966. local x_coord = buffer(offset, 2):le_int()
  967. subtree:add(f_x_coord, x_coord)
  968. offset = offset + 2
  969. -- dissect ECEF Y coordinate (2 bytes)
  970. local y_coord = buffer(offset, 2):le_int()
  971. subtree:add(f_y_coord, y_coord)
  972. offset = offset + 2
  973. -- dissect ECEF Z coordinate (2 bytes)
  974. local z_coord = buffer(offset, 2):le_int()
  975. subtree:add(f_z_coord, z_coord)
  976. offset = offset + 2
  977. end
  978. end
  979. ----------------------------------------------------------------------------------------------------------------------------------
  980. -- Define the dissector function for the new structure
  981. function adcs_dissector_22(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  982. -- Define ProtoFields for the new structure fields
  983. local f_op_status = ProtoField.uint8("PowerSystemData.op_status", "Operation Status", base.DES)
  984. local f_epoch_time = ProtoField.uint32("PowerSystemData.epoch_time", "Epoch Time", base.DES)
  985. local f_roll_angle = ProtoField.int16("PowerSystemData.roll_angle", "Commanded Roll Angle (degrees)", base.DEC)
  986. local f_pitch_angle = ProtoField.int16("PowerSystemData.pitch_angle", "Commanded Pitch Angle (degrees)", base.DEC)
  987. local f_yaw_angle = ProtoField.int16("PowerSystemData.yaw_angle", "Commanded Yaw Angle (degrees)", base.DEC)
  988. -- Add the fields to the protocol
  989. adcs_protocol.fields = {
  990. f_op_status, f_epoch_time, f_roll_angle, f_pitch_angle, f_yaw_angle
  991. }
  992. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  993. -- Loop through the data (data3 could represent the number of iterations or packets to dissect)
  994. for i = 0, num_of_instance - 1 do
  995. -- Add the new structure data as a subtree
  996. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  997. -- dissect operation status (1 byte)
  998. local op_status = buffer(offset, 1):le_uint()
  999. subtree:add(f_op_status, op_status)
  1000. offset = offset + 1
  1001. -- dissect epoch time (4 bytes)
  1002. local epoch_time = buffer(offset, 4):le_uint()
  1003. subtree:add(f_epoch_time, epoch_time)
  1004. offset = offset + 4
  1005. -- dissect commanded roll angle (2 bytes)
  1006. local roll_angle_raw = buffer(offset, 2):le_int()
  1007. local roll_angle = roll_angle_raw -- Apply scaling factor
  1008. subtree:add(f_roll_angle, roll_angle)
  1009. offset = offset + 2
  1010. -- dissect commanded pitch angle (2 bytes)
  1011. local pitch_angle_raw = buffer(offset, 2):le_int()
  1012. local pitch_angle = pitch_angle_raw -- Apply scaling factor
  1013. subtree:add(f_pitch_angle, pitch_angle)
  1014. offset = offset + 2
  1015. -- dissect commanded yaw angle (2 bytes)
  1016. local yaw_angle_raw = buffer(offset, 2):le_int()
  1017. local yaw_angle = yaw_angle_raw -- Apply scaling factor
  1018. subtree:add(f_yaw_angle, yaw_angle)
  1019. offset = offset + 2
  1020. end
  1021. end
  1022. ----------------------------------------------------------------------------------------------------------
  1023. -- Define the dissector function for the new structure
  1024. function adcs_dissector_29(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1025. -- Define ProtoFields for the new structure fields
  1026. local f_op_status = ProtoField.uint8("PowerSystemData.op_status", "Operation Status", base.DES)
  1027. local f_epoch_time = ProtoField.uint32("PowerSystemData.epoch_time", "Epoch Time", base.DES)
  1028. local f_innovation_x = ProtoField.int16("PowerSystemData.innovation_x", "Innovation Vector X", base.DEC)
  1029. local f_innovation_y = ProtoField.int16("PowerSystemData.innovation_y", "Innovation Vector Y", base.DEC)
  1030. local f_innovation_z = ProtoField.int16("PowerSystemData.innovation_z", "Innovation Vector Z", base.DEC)
  1031. -- Add the fields to the protocol
  1032. adcs_protocol.fields = {
  1033. f_op_status, f_epoch_time, f_innovation_x, f_innovation_y, f_innovation_z
  1034. }
  1035. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1036. -- Loop through the data (data3 could represent the number of iterations or packets to dissect)
  1037. for i = 0,num_of_instance - 1 do
  1038. -- Add the new structure data as a subtree
  1039. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1040. -- dissect operation status (1 byte)
  1041. local op_status = buffer(offset, 1):le_uint()
  1042. subtree:add(f_op_status, op_status)
  1043. offset = offset + 1
  1044. -- dissect epoch time (4 bytes)
  1045. local epoch_time = buffer(offset, 4):le_uint()
  1046. subtree:add(f_epoch_time, epoch_time)
  1047. offset = offset + 4
  1048. -- dissect innovation vector X (2 bytes)
  1049. local innovation_x_raw = buffer(offset, 2):le_int()
  1050. local innovation_x = innovation_x_raw -- Apply scaling factor
  1051. subtree:add(f_innovation_x, innovation_x)
  1052. offset = offset + 2
  1053. -- dissect innovation vector Y (2 bytes)
  1054. local innovation_y_raw = buffer(offset, 2):le_int()
  1055. local innovation_y = innovation_y_raw -- Apply scaling factor
  1056. subtree:add(f_innovation_y, innovation_y)
  1057. offset = offset + 2
  1058. -- dissect innovation vector Z (2 bytes)
  1059. local innovation_z_raw = buffer(offset, 2):le_int()
  1060. local innovation_z = innovation_z_raw -- Apply scaling factor
  1061. subtree:add(f_innovation_z, innovation_z)
  1062. offset = offset + 2
  1063. end
  1064. end
  1065. ---------------------------------------------------------------------------------------------------
  1066. -- Define the dissector function for the new structure
  1067. function adcs_dissector_28(buffer, pinfo, tree, adcs_protocol, offset,num_of_instance)
  1068. -- Define ProtoFields for the new structure fields
  1069. local f_op_status = ProtoField.uint8("PowerSystemData.op_status", "Operation Status", base.DES)
  1070. local f_epoch_time = ProtoField.uint32("PowerSystemData.epoch_time", "Epoch Time", base.DES)
  1071. local f_x_gyro_bias = ProtoField.int16("PowerSystemData.x_gyro_bias", "Estimated X-Gyro Bias", base.DEC)
  1072. local f_y_gyro_bias = ProtoField.int16("PowerSystemData.y_gyro_bias", "Estimated Y-Gyro Bias", base.DEC)
  1073. local f_z_gyro_bias = ProtoField.int16("PowerSystemData.z_gyro_bias", "Estimated Z-Gyro Bias", base.DEC)
  1074. -- Add the fields to the protocol
  1075. adcs_protocol.fields = {
  1076. f_op_status, f_epoch_time, f_x_gyro_bias, f_y_gyro_bias, f_z_gyro_bias
  1077. }
  1078. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1079. -- Loop through the data (data3 could represent the number of iterations or packets to dissect)
  1080. for i = 0, num_of_instance - 1 do
  1081. -- Add the new structure data as a subtree
  1082. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1083. -- dissect operation status (1 byte)
  1084. local op_status = buffer(offset, 1):le_uint()
  1085. subtree:add(f_op_status, op_status)
  1086. offset = offset + 1
  1087. -- dissect epoch time (4 bytes)
  1088. local epoch_time = buffer(offset, 4):le_uint()
  1089. subtree:add(f_epoch_time, epoch_time)
  1090. offset = offset + 4
  1091. -- dissect estimated x-gyro bias (2 bytes)
  1092. local x_gyro_bias_raw = buffer(offset, 2):le_int()
  1093. local x_gyro_bias = x_gyro_bias_raw -- Apply scaling factor
  1094. subtree:add(f_x_gyro_bias, x_gyro_bias)
  1095. offset = offset + 2
  1096. -- dissect estimated y-gyro bias (2 bytes)
  1097. local y_gyro_bias_raw = buffer(offset, 2):le_int()
  1098. local y_gyro_bias = y_gyro_bias_raw -- Apply scaling factor
  1099. subtree:add(f_y_gyro_bias, y_gyro_bias)
  1100. offset = offset + 2
  1101. -- dissect estimated z-gyro bias (2 bytes)
  1102. local z_gyro_bias_raw = buffer(offset, 2):le_int()
  1103. local z_gyro_bias = z_gyro_bias_raw -- Apply scaling factor
  1104. subtree:add(f_z_gyro_bias, z_gyro_bias)
  1105. offset = offset + 2
  1106. end
  1107. end
  1108. ----------------------------------------------------------------------------------------------------------------------
  1109. --2.2.1.2.27 ADCS_HM_QUAT_ERR_VEC 26-27
  1110. -- Define the dissector function for the new structure
  1111. function adcs_dissector_27(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1112. -- Define ProtoFields for the new structure fields
  1113. local f_op_status = ProtoField.uint8("PowerSystemData.op_status", "Operation Status", base.DES)
  1114. local f_epoch_time = ProtoField.uint32("PowerSystemData.epoch_time", "Epoch Time", base.DES)
  1115. local f_q1_error = ProtoField.int16("PowerSystemData.q1_error", "Quaternion Error - Q1", base.DEC)
  1116. local f_q2_error = ProtoField.int16("PowerSystemData.q2_error", "Quaternion Error - Q2", base.DEC)
  1117. local f_q3_error = ProtoField.int16("PowerSystemData.q3_error", "Quaternion Error - Q3", base.DEC)
  1118. -- Add the fields to the protocol
  1119. adcs_protocol.fields = {
  1120. f_op_status, f_epoch_time, f_q1_error, f_q2_error, f_q3_error
  1121. }
  1122. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1123. -- Loop through the data (data3 could represent the number of iterations or packets to dissect)
  1124. for i = 0, num_of_instance - 1 do
  1125. -- Add the new structure data as a subtree
  1126. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1127. -- dissect operation status (1 byte)
  1128. local op_status = buffer(offset, 1):le_uint()
  1129. subtree:add(f_op_status, op_status)
  1130. offset = offset + 1
  1131. -- dissect epoch time (4 bytes)
  1132. local epoch_time = buffer(offset, 4):le_uint()
  1133. subtree:add(f_epoch_time, epoch_time)
  1134. offset = offset + 4
  1135. -- dissect quaternion error Q1 (2 bytes)
  1136. local q1_error_raw = buffer(offset, 2):le_int()
  1137. local q1_error = q1_error_raw -- Apply scaling factor
  1138. subtree:add(f_q1_error, q1_error)
  1139. offset = offset + 2
  1140. -- dissect quaternion error Q2 (2 bytes)
  1141. local q2_error_raw = buffer(offset, 2):le_int()
  1142. local q2_error = q2_error_raw -- Apply scaling factor
  1143. subtree:add(f_q2_error, q2_error)
  1144. offset = offset + 2
  1145. -- dissect quaternion error Q3 (2 bytes)
  1146. local q3_error_raw = buffer(offset, 2):le_int()
  1147. local q3_error = q3_error_raw -- Apply scaling factor
  1148. subtree:add(f_q3_error, q3_error)
  1149. offset = offset + 2
  1150. end
  1151. end
  1152. -----------------------------------------------------------------------------------------------------------------------------
  1153. --2.2.1.2.26 ADCS_HM_IGRF_MOD_VEC 25-14
  1154. -- Define the dissector function for the new structure
  1155. function adcs_dissector_14(buffer, pinfo, tree, adcs_protocol, offset,num_of_instance)
  1156. -- Define ProtoFields for the new structure fields
  1157. local f_op_status = ProtoField.uint8("PowerSystemData.op_status", "Operation Status", base.DES)
  1158. local f_epoch_time = ProtoField.uint32("PowerSystemData.epoch_time", "Epoch Time", base.DES)
  1159. local f_x_magnetic_field = ProtoField.int16("PowerSystemData.x_magnetic_field", "X axis Modelled Magnetic Field Vector", base.DEC)
  1160. local f_y_magnetic_field = ProtoField.int16("PowerSystemData.y_magnetic_field", "Y axis Modelled Magnetic Field Vector", base.DEC)
  1161. local f_z_magnetic_field = ProtoField.int16("PowerSystemData.z_magnetic_field", "Z axis Modelled Magnetic Field Vector", base.DEC)
  1162. -- Add the fields to the protocol
  1163. adcs_protocol.fields = {
  1164. f_op_status, f_epoch_time, f_x_magnetic_field, f_y_magnetic_field, f_z_magnetic_field
  1165. }
  1166. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1167. -- Loop through the data (data3 could represent the number of iterations or packets to dissect)
  1168. for i = 0, num_of_instance - 1 do
  1169. -- Add the new structure data as a subtree
  1170. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1171. -- dissect operation status (1 byte)
  1172. local op_status = buffer(offset, 1):le_uint()
  1173. subtree:add(f_op_status, op_status)
  1174. offset = offset + 1
  1175. -- dissect epoch time (4 bytes)
  1176. local epoch_time = buffer(offset, 4):le_uint()
  1177. subtree:add(f_epoch_time, epoch_time)
  1178. offset = offset + 4
  1179. -- dissect x-axis magnetic field vector (2 bytes)
  1180. local x_magnetic_field_raw = buffer(offset, 2):le_int()
  1181. local x_magnetic_field = x_magnetic_field_raw -- Apply scaling factor
  1182. subtree:add(f_x_magnetic_field, x_magnetic_field)
  1183. offset = offset + 2
  1184. -- dissect y-axis magnetic field vector (2 bytes)
  1185. local y_magnetic_field_raw = buffer(offset, 2):le_int()
  1186. local y_magnetic_field = y_magnetic_field_raw -- Apply scaling factor
  1187. subtree:add(f_y_magnetic_field, y_magnetic_field)
  1188. offset = offset + 2
  1189. -- dissect z-axis magnetic field vector (2 bytes)
  1190. local z_magnetic_field_raw = buffer(offset, 2):le_int()
  1191. local z_magnetic_field = z_magnetic_field_raw -- Apply scaling factor
  1192. subtree:add(f_z_magnetic_field, z_magnetic_field)
  1193. offset = offset + 2
  1194. end
  1195. end
  1196. ---------------------------------------------------------------------------------------------------------------------
  1197. --2.2.1.2.25 ADCS_HM_POS_LLH 24-26
  1198. -- Define the dissector function for the new structure
  1199. function adcs_dissector_26(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1200. -- Define ProtoFields for the new structure fields
  1201. local f_op_status = ProtoField.uint8("PowerSystemData.op_status", "Operation Status", base.DES)
  1202. local f_epoch_time = ProtoField.uint32("PowerSystemData.epoch_time", "Epoch Time", base.DES)
  1203. local f_geo_longitude = ProtoField.int16("PowerSystemData.geo_longitude", "Geocentric Longitude", base.DEC)
  1204. local f_geo_latitude = ProtoField.int16("PowerSystemData.geo_latitude", "Geocentric Latitude", base.DEC)
  1205. local f_geo_altitude = ProtoField.int16("PowerSystemData.geo_altitude", "Geocentric Altitude", base.DEC)
  1206. -- Add the fields to the protocol
  1207. adcs_protocol.fields = {
  1208. f_op_status, f_epoch_time, f_geo_longitude, f_geo_latitude, f_geo_altitude
  1209. }
  1210. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1211. -- Loop through the data (data3 could represent the number of iterations or packets to dissect)
  1212. for i = 0, num_of_instance - 1 do
  1213. -- Add the new structure data as a subtree
  1214. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1215. -- dissect operation status (1 byte)
  1216. local op_status = buffer(offset, 1):le_uint()
  1217. subtree:add(f_op_status, op_status)
  1218. offset = offset + 1
  1219. -- dissect epoch time (4 bytes)
  1220. local epoch_time = buffer(offset, 4):le_uint()
  1221. subtree:add(f_epoch_time, epoch_time)
  1222. offset = offset + 4
  1223. -- dissect geocentric longitude (2 bytes)
  1224. local geo_longitude_raw = buffer(offset, 2):le_int()
  1225. local geo_longitude = geo_longitude_raw -- Apply scaling factor
  1226. subtree:add(f_geo_longitude, geo_longitude)
  1227. offset = offset + 2
  1228. -- dissect geocentric latitude (2 bytes)
  1229. local geo_latitude_raw = buffer(offset, 2):le_int()
  1230. local geo_latitude = geo_latitude_raw -- Apply scaling factor
  1231. subtree:add(f_geo_latitude, geo_latitude)
  1232. offset = offset + 2
  1233. -- dissect geocentric altitude (2 bytes)
  1234. local geo_altitude_raw = buffer(offset, 2):le_int()
  1235. local geo_altitude = geo_altitude_raw -- Apply scaling factor
  1236. subtree:add(f_geo_altitude, geo_altitude)
  1237. offset = offset + 2
  1238. end
  1239. end
  1240. ----------------------------------------------------------------------------------------------------------
  1241. --2.2.1.2.24 ADCS_HM_RAW_STAR_TRKR_MEAS 23-20
  1242. function adcs_dissector_20(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1243. -- Define ProtoFields for the updated structure fields
  1244. local f_op_status = ProtoField.uint8("StarTrackerData.op_status", "Operation Status", base.DES)
  1245. local f_epoch_time = ProtoField.uint32("StarTrackerData.epoch_time", "Epoch Time", base.DES)
  1246. local f_num_stars_detected = ProtoField.uint8("StarTrackerData.num_stars_detected", "Number of Stars Detected", base.DES)
  1247. local f_star_image_noise = ProtoField.uint8("StarTrackerData.star_image_noise", "Star Image Noise", base.DES)
  1248. local f_invalid_star = ProtoField.uint8("StarTrackerData.invalid_star", "Invalid Star", base.DES)
  1249. local f_num_stars_identified = ProtoField.uint8("StarTrackerData.num_stars_identified", "Number of Stars Identified", base.DES)
  1250. local f_ident_mode = ProtoField.uint8("StarTrackerData.ident_mode", "Identification Mode", base.ENUM)
  1251. local f_image_dark_value = ProtoField.uint8("StarTrackerData.image_dark_value", "Image Dark Value", base.DES)
  1252. -- Define ProtoFields for flags (1 byte with individual boolean flags)
  1253. local f_flags = ProtoField.uint8("StarTrackerData.flags", "Flags", base.HEX)
  1254. -- Define ProtoFields for star confidence and magnitudes
  1255. local f_star_conf_1 = ProtoField.uint8("StarTrackerData.star_conf_1", "Star 1 Confidence", base.PERCENT)
  1256. local f_star_conf_2 = ProtoField.uint8("StarTrackerData.star_conf_2", "Star 2 Confidence", base.PERCENT)
  1257. local f_star_conf_3 = ProtoField.uint8("StarTrackerData.star_conf_3", "Star 3 Confidence", base.PERCENT)
  1258. -- Define ProtoFields for instrument magnitudes
  1259. local f_instrument_mag_1 = ProtoField.uint16("StarTrackerData.instrument_mag_1", "Instrument Magnitude Star 1", base.DEC)
  1260. local f_instrument_mag_2 = ProtoField.uint16("StarTrackerData.instrument_mag_2", "Instrument Magnitude Star 2", base.DEC)
  1261. local f_instrument_mag_3 = ProtoField.uint16("StarTrackerData.instrument_mag_3", "Instrument Magnitude Star 3", base.DEC)
  1262. -- Define ProtoFields for capture, detection, and identification
  1263. local f_capture = ProtoField.uint16("StarTrackerData.capture", "Capture", base.DEC)
  1264. local f_detection = ProtoField.uint16("StarTrackerData.detection", "Detection", base.DEC)
  1265. local f_identification = ProtoField.uint16("StarTrackerData.identification", "Identification", base.DEC)
  1266. -- Define ProtoFields for the estimated rates and attitudes (X, Y, Z axes, Q1, Q2, Q3)
  1267. local f_est_rate_x = ProtoField.int16("StarTrackerData.est_rate_x", "Estimated Rate X-axis", base.DEC)
  1268. local f_est_rate_y = ProtoField.int16("StarTrackerData.est_rate_y", "Estimated Rate Y-axis", base.DEC)
  1269. local f_est_rate_z = ProtoField.int16("StarTrackerData.est_rate_z", "Estimated Rate Z-axis", base.DEC)
  1270. local f_est_attitude_q1 = ProtoField.int16("StarTrackerData.est_attitude_q1", "Estimated Attitude Q1", base.DEC)
  1271. local f_est_attitude_q2 = ProtoField.int16("StarTrackerData.est_attitude_q2", "Estimated Attitude Q2", base.DEC)
  1272. local f_est_attitude_q3 = ProtoField.int16("StarTrackerData.est_attitude_q3", "Estimated Attitude Q3", base.DEC)
  1273. -- Define ProtoFields for star catalog and centroid information
  1274. local f_catalogue_number = ProtoField.uint16("StarTrackerData.catalogue_number", "Catalogue Number of Star", base.DEC)
  1275. local f_x_centroid = ProtoField.int16("StarTrackerData.x_centroid", "X Centroid of Star", base.DEC)
  1276. local f_y_centroid = ProtoField.int16("StarTrackerData.y_centroid", "Y Centroid of Star", base.DEC)
  1277. -- Define ProtoField for sample period
  1278. local f_sample_period = ProtoField.uint16("StarTrackerData.sample_period", "Sample Period", base.DEC)
  1279. -- Add the fields to the protocol
  1280. adcs_protocol.fields = {
  1281. f_op_status, f_epoch_time, f_num_stars_detected, f_star_image_noise, f_invalid_star,
  1282. f_num_stars_identified, f_ident_mode, f_image_dark_value, f_flags,
  1283. f_star_conf_1, f_star_conf_2, f_star_conf_3,
  1284. f_instrument_mag_1, f_instrument_mag_2, f_instrument_mag_3,
  1285. f_capture, f_detection, f_identification,
  1286. f_est_rate_x, f_est_rate_y, f_est_rate_z,
  1287. f_est_attitude_q1, f_est_attitude_q2, f_est_attitude_q3,
  1288. f_catalogue_number, f_x_centroid, f_y_centroid, f_sample_period
  1289. }
  1290. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1291. -- Loop through the data (data3 could represent the number of iterations or packets to dissect)
  1292. for i = 0, num_of_instance - 1 do
  1293. -- Add the new structure data as a subtree
  1294. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1295. -- dissect operation status (1 byte)
  1296. local op_status = buffer(offset, 1):le_uint()
  1297. subtree:add(f_op_status, op_status)
  1298. offset = offset + 1
  1299. -- dissect epoch time (4 bytes)
  1300. local epoch_time = buffer(offset, 4):le_uint()
  1301. subtree:add(f_epoch_time, epoch_time)
  1302. offset = offset + 4
  1303. -- dissect number of stars detected (1 byte)
  1304. local num_stars_detected = buffer(offset, 1):le_uint()
  1305. subtree:add(f_num_stars_detected, num_stars_detected)
  1306. offset = offset + 1
  1307. -- dissect star image noise (1 byte)
  1308. local star_image_noise = buffer(offset, 1):le_uint()
  1309. subtree:add(f_star_image_noise, star_image_noise)
  1310. offset = offset + 1
  1311. -- dissect invalid star (1 byte)
  1312. local invalid_star = buffer(offset, 1):le_uint()
  1313. subtree:add(f_invalid_star, invalid_star)
  1314. offset = offset + 1
  1315. -- dissect number of stars identified (1 byte)
  1316. local num_stars_identified = buffer(offset, 1):le_uint()
  1317. subtree:add(f_num_stars_identified, num_stars_identified)
  1318. offset = offset + 1
  1319. -- dissect identification mode (1 byte, enum)
  1320. local ident_mode = buffer(offset, 1):le_uint()
  1321. subtree:add(f_ident_mode, ident_mode)
  1322. offset = offset + 1
  1323. -- dissect image dark value (1 byte)
  1324. local image_dark_value = buffer(offset, 1):le_uint()
  1325. subtree:add(f_image_dark_value, image_dark_value)
  1326. offset = offset + 1
  1327. -- dissect flags (8 flags, 1 byte)
  1328. local flags = buffer(offset, 1):le_uint()
  1329. subtree:add(f_flags, flags) -- in this each bit represents a value
  1330. offset = offset + 1
  1331. -- dissect star confidences (1 byte each)
  1332. local star_conf_1 = buffer(offset, 1):le_uint()
  1333. subtree:add(f_star_conf_1, star_conf_1)
  1334. offset = offset + 1
  1335. local star_conf_2 = buffer(offset, 1):le_uint()
  1336. subtree:add(f_star_conf_2, star_conf_2)
  1337. offset = offset + 1
  1338. local star_conf_3 = buffer(offset, 1):le_uint()
  1339. subtree:add(f_star_conf_3, star_conf_3)
  1340. offset = offset + 1
  1341. -- dissect instrument magnitudes (2 bytes each)
  1342. local instrument_mag_1 = buffer(offset, 2):le_uint()
  1343. subtree:add(f_instrument_mag_1, instrument_mag_1)
  1344. offset = offset + 2
  1345. local instrument_mag_2 = buffer(offset, 2):le_uint()
  1346. subtree:add(f_instrument_mag_2, instrument_mag_2)
  1347. offset = offset + 2
  1348. local instrument_mag_3 = buffer(offset, 2):le_uint()
  1349. subtree:add(f_instrument_mag_3, instrument_mag_3)
  1350. offset = offset + 2
  1351. -- dissect capture, detection, and identification (2 bytes each)
  1352. local capture = buffer(offset, 2):le_uint()
  1353. subtree:add(f_capture, capture)
  1354. offset = offset + 2
  1355. local detection = buffer(offset, 2):le_uint()
  1356. subtree:add(f_detection, detection)
  1357. offset = offset + 2
  1358. local identification = buffer(offset, 2):le_uint()
  1359. subtree:add(f_identification, identification)
  1360. offset = offset + 2
  1361. -- dissect estimated rate X-axis, Y-axis, Z-axis (2 bytes each)
  1362. local est_rate_x_raw = buffer(offset, 2):le_int()
  1363. local est_rate_x = est_rate_x_raw -- Apply scaling factor
  1364. subtree:add(f_est_rate_x, est_rate_x)
  1365. offset = offset + 2
  1366. local est_rate_y_raw = buffer(offset, 2):le_int()
  1367. local est_rate_y = est_rate_y_raw -- Apply scaling factor
  1368. subtree:add(f_est_rate_y, est_rate_y)
  1369. offset = offset + 2
  1370. local est_rate_z_raw = buffer(offset, 2):le_int()
  1371. local est_rate_z = est_rate_z_raw -- Apply scaling factor
  1372. subtree:add(f_est_rate_z, est_rate_z)
  1373. offset = offset + 2
  1374. -- dissect estimated attitude (Q1, Q2, Q3)
  1375. local est_attitude_q1_raw = buffer(offset, 2):le_int()
  1376. local est_attitude_q1 = est_attitude_q1_raw -- Apply scaling factor
  1377. subtree:add(f_est_attitude_q1, est_attitude_q1)
  1378. offset = offset + 2
  1379. local est_attitude_q2_raw = buffer(offset, 2):le_int()
  1380. local est_attitude_q2 = est_attitude_q2_raw -- Apply scaling factor
  1381. subtree:add(f_est_attitude_q2, est_attitude_q2)
  1382. offset = offset + 2
  1383. local est_attitude_q3_raw = buffer(offset, 2):le_int()
  1384. local est_attitude_q3 = est_attitude_q3_raw -- Apply scaling factor
  1385. subtree:add(f_est_attitude_q3, est_attitude_q3)
  1386. offset = offset + 2
  1387. -- dissect catalogue number (2 bytes)
  1388. local catalogue_number = buffer(offset, 2):le_uint()
  1389. subtree:add(f_catalogue_number, catalogue_number)
  1390. offset = offset + 2
  1391. -- dissect centroids (X, Y)
  1392. local x_centroid = buffer(offset, 2):le_int()
  1393. subtree:add(f_x_centroid, x_centroid)
  1394. offset = offset + 2
  1395. local y_centroid = buffer(offset, 2):le_int()
  1396. subtree:add(f_y_centroid, y_centroid)
  1397. offset = offset + 2
  1398. -- dissect sample period (2 bytes)
  1399. local sample_period = buffer(offset, 2):le_uint()
  1400. subtree:add(f_sample_period, sample_period)
  1401. offset = offset + 2
  1402. end
  1403. end
  1404. -------------------------------------------------------------------------------------------------------------------------------
  1405. ------------------------------------------------------------------------------------------------------------------------------------------
  1406. --2.2.1.2.22 ADCS_HM_MGTRQR_CMD 21-25
  1407. -- Define the dissector function for the Magnetorquer data
  1408. function adcs_dissector_25(buffer, pinfo, tree,adcs_protocol, offset, num_of_instance)
  1409. -- Define ProtoFields for the new structure fields
  1410. local f_op_status = ProtoField.uint8("MagnetorquerData.op_status", "Operation Status", base.DES)
  1411. local f_epoch_time = ProtoField.uint32("MagnetorquerData.epoch_time", "Epoch Time", base.DES)
  1412. local f_x_magnetorquer_time = ProtoField.int16("MagnetorquerData.x_magnetorquer_time", "X Magnetorquer Commanded On-time (10ms)", base.DEC)
  1413. local f_y_magnetorquer_time = ProtoField.int16("MagnetorquerData.y_magnetorquer_time", "Y Magnetorquer Commanded On-time (10ms)", base.DEC)
  1414. local f_z_magnetorquer_time = ProtoField.int16("MagnetorquerData.z_magnetorquer_time", "Z Magnetorquer Commanded On-time (10ms)", base.DEC)
  1415. -- Add the fields to the protocol
  1416. adcs_protocol.fields = {
  1417. f_op_status, f_epoch_time, f_x_magnetorquer_time, f_y_magnetorquer_time, f_z_magnetorquer_time
  1418. }
  1419. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1420. for i = 0,num_of_instance - 1 do
  1421. -- Add the new structure data as a subtree
  1422. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1423. -- dissect operation status (1 byte)
  1424. local op_status = buffer(offset, 1):le_uint()
  1425. subtree:add(f_op_status, op_status)
  1426. offset = offset + 1
  1427. -- dissect epoch time (4 bytes)
  1428. local epoch_time = buffer(offset, 4):le_uint()
  1429. subtree:add(f_epoch_time, epoch_time)
  1430. offset = offset + 4
  1431. -- dissect X Magnetorquer Commanded on-time (2 bytes)
  1432. local x_magnetorquer_time = buffer(offset, 2):le_int()
  1433. subtree:add(f_x_magnetorquer_time, x_magnetorquer_time)
  1434. offset = offset + 2
  1435. -- dissect Y Magnetorquer Commanded on-time (2 bytes)
  1436. local y_magnetorquer_time = buffer(offset, 2):le_int()
  1437. subtree:add(f_y_magnetorquer_time, y_magnetorquer_time)
  1438. offset = offset + 2
  1439. -- dissect Z Magnetorquer Commanded on-time (2 bytes)
  1440. local z_magnetorquer_time = buffer(offset, 2):le_int()
  1441. subtree:add(f_z_magnetorquer_time, z_magnetorquer_time)
  1442. offset = offset + 2
  1443. end
  1444. end
  1445. -----------------------------------------------------------------------------------------
  1446. --2.2.1.2.21 ADCS_HM_RW_SPEED_CMD 20-24
  1447. -- Define the dissector function for the Reaction Wheel data
  1448. function adcs_dissector_24(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1449. -- Define ProtoFields for the new structure fields
  1450. local f_op_status = ProtoField.uint8("ReactionWheelData.op_status", "Operation Status", base.DES)
  1451. local f_epoch_time = ProtoField.uint32("ReactionWheelData.epoch_time", "Epoch Time", base.DES)
  1452. local f_num_reaction_wheels = ProtoField.uint8("ReactionWheelData.num_reaction_wheels", "Number of Reaction Wheels", base.DES)
  1453. local f_wheel_speed = ProtoField.uint16("ReactionWheelData.wheel_speed_", "Measured Wheel Speed ", base.DEC)
  1454. -- Define the ProtoField for the array of Measured Wheel Speeds (N = 3, each 2 bytes)
  1455. -- Add the fields to the protocol
  1456. adcs_protocol.fields = {
  1457. f_op_status, f_epoch_time, f_num_reaction_wheels, f_wheel_speed
  1458. }
  1459. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1460. for i = 0,num_of_instance - 1 do
  1461. -- Add the new structure data as a subtree
  1462. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1463. -- dissect operation status (1 byte)
  1464. local op_status = buffer(offset, 1):le_uint()
  1465. subtree:add(f_op_status, op_status)
  1466. offset = offset + 1
  1467. -- dissect epoch time (4 bytes)
  1468. local epoch_time = buffer(offset, 4):le_uint()
  1469. subtree:add(f_epoch_time, epoch_time)
  1470. offset = offset + 4
  1471. -- dissect number of reaction wheels (1 byte)
  1472. local num_reaction_wheels = buffer(offset, 1):le_uint()
  1473. subtree:add(f_num_reaction_wheels, num_reaction_wheels)
  1474. offset = offset + 1
  1475. -- dissect wheel speeds (array of N * 2 bytes, with N = 3)
  1476. for i = 1, 3 do
  1477. local wheel_speed = buffer(offset, 2):le_uint()
  1478. subtree:add(f_wheel_speed, wheel_speed)
  1479. offset = offset + 2
  1480. end
  1481. end
  1482. end
  1483. -----------------------------------------------------------------------------------------------------------
  1484. --2.2.1.2.20 ADCS_HM_MEAS_RW_SPEED 19-23
  1485. -- Define the dissector function for the Reaction Wheel Commanded Speed data
  1486. function adcs_dissector_23(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1487. -- Define ProtoFields for the new structure fields
  1488. local f_op_status = ProtoField.uint8("ReactionWheelData.op_status", "Operation Status", base.DES)
  1489. local f_epoch_time = ProtoField.uint32("ReactionWheelData.epoch_time", "Epoch Time", base.DES)
  1490. local f_num_reaction_wheels = ProtoField.uint8("ReactionWheelData.num_reaction_wheels", "Number of Reaction Wheels", base.DES)
  1491. local f_wheel_speed_cmd = ProtoField.uint16("ReactionWheelData.wheel_speed_cmd_","Commanded Wheel Speed ", base.DEC)
  1492. -- Define the ProtoField for the array of Commanded Wheel Speeds (N = 3, each 2 bytes)
  1493. -- Add the fields to the protocol
  1494. adcs_protocol.fields = {
  1495. f_op_status, f_epoch_time, f_num_reaction_wheels,f_wheel_speed_cmd
  1496. }
  1497. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1498. for i = 0, num_of_instance - 1 do
  1499. -- Add the new structure data as a subtree
  1500. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1501. -- dissect operation status (1 byte)
  1502. local op_status = buffer(offset, 1):le_uint()
  1503. subtree:add(f_op_status, op_status)
  1504. offset = offset + 1
  1505. -- dissect epoch time (4 bytes)
  1506. local epoch_time = buffer(offset, 4):le_uint()
  1507. subtree:add(f_epoch_time, epoch_time)
  1508. offset = offset + 4
  1509. -- dissect number of reaction wheels (1 byte)
  1510. local num_reaction_wheels = buffer(offset, 1):le_uint()
  1511. subtree:add(f_num_reaction_wheels, num_reaction_wheels)
  1512. offset = offset + 1
  1513. -- dissect commanded wheel speeds (array of N * 2 bytes, with N = 3)
  1514. for i = 1, 3 do -- value 3 is fixed in structure
  1515. local wheel_speed_cmd = buffer(offset, 2):le_uint()
  1516. subtree:add(f_wheel_speed_cmd, wheel_speed_cmd)
  1517. offset = offset + 2
  1518. end
  1519. end
  1520. end
  1521. --------------------------------------------------------------------------------------------------------
  1522. --2.2.1.2.15 ADCS_HM_FINE_EST_ANG_RATES 14-19
  1523. -- Define the dissector function for the Fine Estimated Angular Rates Data
  1524. function adcs_dissector_19(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1525. -- Define ProtoFields for the Fine Estimated Angular Rates structure
  1526. local f_op_status = ProtoField.uint8("AngularRateData.op_status", "Operation Status", base.DES)
  1527. local f_epoch_time = ProtoField.uint32("AngularRateData.epoch_time", "Epoch Time", base.DES)
  1528. local f_x_angular_rate = ProtoField.int16("AngularRateData.x_angular_rate", "Fine Estimated X Angular Rate", base.DEC)
  1529. local f_y_angular_rate = ProtoField.int16("AngularRateData.y_angular_rate", "Fine Estimated Y Angular Rate", base.DEC)
  1530. local f_z_angular_rate = ProtoField.int16("AngularRateData.z_angular_rate", "Fine Estimated Z Angular Rate", base.DEC)
  1531. -- Add the fields to the protocol
  1532. adcs_protocol.fields = {
  1533. f_op_status, f_epoch_time, f_x_angular_rate, f_y_angular_rate, f_z_angular_rate
  1534. }
  1535. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1536. for i = 0, num_of_instance - 1 do
  1537. -- Add the Fine Estimated Angular Rates data as a subtree
  1538. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1539. -- dissect operation status (1 byte)
  1540. local op_status = buffer(offset, 1):le_uint()
  1541. subtree:add(f_op_status, op_status)
  1542. offset = offset + 1
  1543. -- dissect epoch time (4 bytes)
  1544. local epoch_time = buffer(offset, 4):le_uint()
  1545. subtree:add(f_epoch_time, epoch_time)
  1546. offset = offset + 4
  1547. -- dissect Fine Estimated X Angular Rate (2 bytes, formatted value = RAWVAL*0.001)
  1548. local x_angular_rate = buffer(offset, 2):le_int()
  1549. subtree:add(f_x_angular_rate, x_angular_rate)
  1550. offset = offset + 2
  1551. -- dissect Fine Estimated Y Angular Rate (2 bytes, formatted value = RAWVAL*0.001)
  1552. local y_angular_rate = buffer(offset, 2):le_int()
  1553. subtree:add(f_y_angular_rate, y_angular_rate)
  1554. offset = offset + 2
  1555. -- dissect Fine Estimated Z Angular Rate (2 bytes, formatted value = RAWVAL*0.001)
  1556. local z_angular_rate = buffer(offset, 2):le_int()
  1557. subtree:add(f_z_angular_rate, z_angular_rate)
  1558. offset = offset + 2
  1559. end
  1560. end
  1561. -----------------------------------------------------------------------------------------------------------
  1562. --2.2.1.2.13 ADCS_HM_RATE_SENSOR_TEMPERATURE
  1563. -- Define the dissector function for the Rate Sensor Temperature Data
  1564. function adcs_dissector_12(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1565. -- Define ProtoFields for the structure (adjust names as per your needs)
  1566. local f_op_status = ProtoField.uint8("RateSensorData.op_status", "Operation Status", base.HEX)
  1567. local f_epoch_time = ProtoField.uint32("RateSensorData.epoch_time", "Epoch Time", base.DEC)
  1568. local f_x_rate_temp = ProtoField.int16("RateSensorData.x_rate_temp", "X Rate Sensor Temperature", base.DEC)
  1569. local f_y_rate_temp = ProtoField.int16("RateSensorData.y_rate_temp", "Y Rate Sensor Temperature", base.DEC)
  1570. local f_z_rate_temp = ProtoField.int16("RateSensorData.z_rate_temp", "Z Rate Sensor Temperature", base.DEC)
  1571. -- Add the fields to the protocol
  1572. adcs_protocol.fields = {
  1573. f_op_status, f_epoch_time, f_x_rate_temp, f_y_rate_temp, f_z_rate_temp
  1574. }
  1575. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1576. -- Loop to process multiple data3 (if needed, as per your structure)
  1577. for i = 0, num_of_instance - 1 do
  1578. -- Add the data structure as a subtree
  1579. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1580. -- dissect operation status (1 byte)
  1581. local op_status = buffer(offset, 1):le_uint()
  1582. subtree:add(f_op_status, op_status)
  1583. offset = offset + 1
  1584. -- dissect epoch time (4 bytes)
  1585. local epoch_time = buffer(offset, 4):le_uint()
  1586. subtree:add(f_epoch_time, epoch_time)
  1587. offset = offset + 4
  1588. -- dissect X Rate Sensor Temperature (2 bytes, formatted value = RAWVAL)
  1589. local x_rate_temp = buffer(offset, 2):le_int()
  1590. subtree:add(f_x_rate_temp, x_rate_temp)
  1591. offset = offset + 2
  1592. -- dissect Y Rate Sensor Temperature (2 bytes, formatted value = RAWVAL)
  1593. local y_rate_temp = buffer(offset, 2):le_int()
  1594. subtree:add(f_y_rate_temp, y_rate_temp)
  1595. offset = offset + 2
  1596. -- dissect Z Rate Sensor Temperature (2 bytes, formatted value = RAWVAL)
  1597. local z_rate_temp = buffer(offset, 2):le_int()
  1598. subtree:add(f_z_rate_temp, z_rate_temp)
  1599. offset = offset + 2
  1600. end
  1601. end
  1602. --------------------------------------------------------------------------------------------------------------------
  1603. --2.2.1.2.12 ADCS_HM_TEMPERATURE
  1604. -- Define the dissector function for the Sensor Temperature Data
  1605. function adcs_dissector_11(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1606. -- Define ProtoFields for the structure (adjust names as needed)
  1607. local f_op_status = ProtoField.uint8("SensorTemperatureData.op_status", "Operation Status", base.HEX)
  1608. local f_epoch_time = ProtoField.uint32("SensorTemperatureData.epoch_time", "Epoch Time", base.DEC)
  1609. local f_mcu_temp = ProtoField.int16("SensorTemperatureData.mcu_temp", "MCU Temperature", base.DEC)
  1610. local f_mag_temp = ProtoField.int16("SensorTemperatureData.mag_temp", "Magnetometer Temperature", base.DEC)
  1611. local f_red_mag_temp = ProtoField.int16("SensorTemperatureData.red_mag_temp", "Redundant Magnetometer Temperature", base.DEC)
  1612. -- Add the fields to the protocol
  1613. adcs_protocol.fields = {
  1614. f_op_status, f_epoch_time, f_mcu_temp, f_mag_temp, f_red_mag_temp
  1615. }
  1616. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1617. -- Loop to process multiple data3 (if needed, as per your structure)
  1618. for i = 0, num_of_instance - 1 do
  1619. -- Add the data structure as a subtree
  1620. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1621. -- dissect operation status (1 byte)
  1622. local op_status = buffer(offset, 1):le_uint()
  1623. subtree:add(f_op_status, op_status)
  1624. offset = offset + 1
  1625. -- dissect epoch time (4 bytes)
  1626. local epoch_time = buffer(offset, 4):le_uint()
  1627. subtree:add(f_epoch_time, epoch_time)
  1628. offset = offset + 4
  1629. -- dissect MCU Temperature (2 bytes, formatted value = RAWVAL)
  1630. local mcu_temp = buffer(offset, 2):le_int()
  1631. subtree:add(f_mcu_temp, mcu_temp)
  1632. offset = offset + 2
  1633. -- dissect Magnetometer Temperature (2 bytes, formatted value = RAWVAL*0.1)
  1634. local mag_temp = buffer(offset, 2):le_int()
  1635. local formatted_mag_temp = mag_temp
  1636. subtree:add(f_mag_temp, formatted_mag_temp)
  1637. offset = offset + 2
  1638. -- dissect Redundant Magnetometer Temperature (2 bytes, formatted value = RAWVAL*0.1)
  1639. local red_mag_temp = buffer(offset, 2):le_int()
  1640. local formatted_red_mag_temp = red_mag_temp
  1641. subtree:add(f_red_mag_temp, formatted_red_mag_temp)
  1642. offset = offset + 2
  1643. end
  1644. end
  1645. ----------------------------------------------------------------------------------------------------------------------
  1646. function adcs_dissector_21(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1647. local f_operation_status = ProtoField.uint32("adcs_protocol.operation_status", "Operation Status", base.DEC)
  1648. local f_epoch_time = ProtoField.uint32("adcs_protocol.epoch_time", "Epoch Time", base.DEC)
  1649. local f_mcu_temperature = ProtoField.int16("adcs_protocol.mcu_temperature", "MCU Temperature ", base.DEC)
  1650. local f_magnetometer_temperature = ProtoField.int16("adcs_protocol.magnetometer_temperature", "Magnetometer Temperature ", base.DEC)
  1651. local f_redundant_magnetometer_temperature = ProtoField.int16("adcs_protocol.redundant_magnetometer_temperature", "Redundant Magnetometer Temperature ", base.DEC)
  1652. -- Add the fields to the protocol
  1653. adcs_protocol.fields = { f_operation_status, f_epoch_time, f_mcu_temperature, f_magnetometer_temperature, f_redundant_magnetometer_temperature }
  1654. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1655. for i = 0, num_of_instance - 1 do
  1656. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1657. subtree:add(f_operation_status, buffer(offset, 1):le_uint()) -- 1 bytes for Operation Status (UINT)
  1658. offset = offset + 1
  1659. subtree:add(f_epoch_time, buffer(offset, 4):le_uint()) -- 4 bytes for Epoch Time (UINT)
  1660. offset = offset + 4
  1661. -- Extract raw values for the temperatures (2 bytes each for INT)
  1662. local mcu_temp = buffer(offset, 2):le_uint() * 0.01
  1663. offset = offset + 2
  1664. local magnetometer_temp = buffer(offset, 2):le_uint() * 0.01
  1665. offset = offset + 2
  1666. local redundant_magnetometer_temp = buffer(offset, 2):le_uint() * 0.01
  1667. offset = offset + 2
  1668. -- Add the temperature values to the tree with scaling applied
  1669. subtree:add(f_mcu_temperature, mcu_temp)
  1670. subtree:add(f_magnetometer_temperature, magnetometer_temp)
  1671. subtree:add(f_redundant_magnetometer_temperature, redundant_magnetometer_temp)
  1672. end
  1673. end
  1674. ---------------------------------------------------------------------------------------------------------------------------------------
  1675. function adcs_dissector_18(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1676. -- Define ProtoFields for the updated structure fields
  1677. local f_op_status = ProtoField.uint8("StarTrackerData.op_status", "Operation Status", base.DES)
  1678. local f_epoch_time = ProtoField.uint32("StarTrackerData.epoch_time", "Epoch Time", base.DES)
  1679. local f_est_rate_x = ProtoField.int16("StarTrackerData.est_rate_x", "Estimated X Angular Rate", base.DEC)
  1680. local f_est_rate_y = ProtoField.int16("StarTrackerData.est_rate_y", "Estimated Y Angular Rate", base.DEC)
  1681. local f_est_rate_z = ProtoField.int16("StarTrackerData.est_rate_z", "Estimated Z Angular Rate", base.DEC)
  1682. -- Add the fields to the protocol
  1683. adcs_protocol.fields = {
  1684. f_op_status, f_epoch_time, f_est_rate_x, f_est_rate_y, f_est_rate_z
  1685. }
  1686. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1687. -- Loop through the data (num_of_instance represents the number of instances to dissect)
  1688. for i = 0, num_of_instance - 1 do
  1689. -- Add the new structure data as a subtree
  1690. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1691. -- dissect operation status (1 byte)
  1692. local op_status = buffer(offset, 1):le_uint()
  1693. subtree:add(f_op_status, op_status)
  1694. offset = offset + 1
  1695. -- dissect epoch time (4 bytes)
  1696. local epoch_time = buffer(offset, 4):le_uint()
  1697. subtree:add(f_epoch_time, epoch_time)
  1698. offset = offset + 4
  1699. -- dissect estimated X angular rate (2 bytes)
  1700. local est_rate_x_raw = buffer(offset, 2):le_int()
  1701. local est_rate_x = est_rate_x_raw -- Apply scaling factor
  1702. subtree:add(f_est_rate_x, est_rate_x)
  1703. offset = offset + 2
  1704. -- dissect estimated Y angular rate (2 bytes)
  1705. local est_rate_y_raw = buffer(offset, 2):le_int()
  1706. local est_rate_y = est_rate_y_raw -- Apply scaling factor
  1707. subtree:add(f_est_rate_y, est_rate_y)
  1708. offset = offset + 2
  1709. -- dissect estimated Z angular rate (2 bytes)
  1710. local est_rate_z_raw = buffer(offset, 2):le_int()
  1711. local est_rate_z = est_rate_z_raw -- Apply scaling factor
  1712. subtree:add(f_est_rate_z, est_rate_z)
  1713. offset = offset + 2
  1714. end
  1715. end
  1716. ------------------------------------------------------------------------------------------------
  1717. function adcs_dissector_17(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1718. -- Define ProtoFields for the updated structure fields
  1719. local f_op_status = ProtoField.uint8("StarTrackerData.op_status", "Operation Status", base.DES)
  1720. local f_epoch_time = ProtoField.uint32("StarTrackerData.epoch_time", "Epoch Time", base.DES)
  1721. local f_raw_rate_x = ProtoField.int16("StarTrackerData.raw_rate_x", "X Axis Raw Rate Sensor Measurement", base.DEC)
  1722. local f_raw_rate_y = ProtoField.int16("StarTrackerData.raw_rate_y", "Y Axis Raw Rate Sensor Measurement", base.DEC)
  1723. local f_raw_rate_z = ProtoField.int16("StarTrackerData.raw_rate_z", "Z Axis Raw Rate Sensor Measurement", base.DEC)
  1724. -- Add the fields to the protocol
  1725. adcs_protocol.fields = {
  1726. f_op_status, f_epoch_time, f_raw_rate_x, f_raw_rate_y, f_raw_rate_z
  1727. }
  1728. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1729. -- Loop through the data (num_of_instance represents the number of instances to dissect)
  1730. for i = 0, num_of_instance - 1 do
  1731. -- Add the new structure data as a subtree
  1732. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1733. -- dissect operation status (1 byte)
  1734. local op_status = buffer(offset, 1):le_uint()
  1735. subtree:add(f_op_status, op_status)
  1736. offset = offset + 1
  1737. -- dissect epoch time (4 bytes)
  1738. local epoch_time = buffer(offset, 4):le_uint()
  1739. subtree:add(f_epoch_time, epoch_time)
  1740. offset = offset + 4
  1741. -- dissect X axis raw rate sensor measurement (2 bytes)
  1742. local raw_rate_x = buffer(offset, 2):le_int()
  1743. subtree:add(f_raw_rate_x, raw_rate_x)
  1744. offset = offset + 2
  1745. -- dissect Y axis raw rate sensor measurement (2 bytes)
  1746. local raw_rate_y = buffer(offset, 2):le_int()
  1747. subtree:add(f_raw_rate_y, raw_rate_y)
  1748. offset = offset + 2
  1749. -- dissect Z axis raw rate sensor measurement (2 bytes)
  1750. local raw_rate_z = buffer(offset, 2):le_int()
  1751. subtree:add(f_raw_rate_z, raw_rate_z)
  1752. offset = offset + 2
  1753. end
  1754. end
  1755. ---------------------------------------------------------------------------------------------------------------
  1756. function adcs_dissector_16(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1757. -- Define ProtoFields for the updated structure fields
  1758. local f_op_status = ProtoField.uint8("StarTrackerData.op_status", "Operation Status", base.DES)
  1759. local f_epoch_time = ProtoField.uint32("StarTrackerData.epoch_time", "Epoch Time", base.DES)
  1760. local f_measured_rate_x = ProtoField.int16("StarTrackerData.measured_rate_x", "Measured X Axis Rate", base.DEC)
  1761. local f_measured_rate_y = ProtoField.int16("StarTrackerData.measured_rate_y", "Measured Y Axis Rate", base.DEC)
  1762. local f_measured_rate_z = ProtoField.int16("StarTrackerData.measured_rate_z", "Measured Z Axis Rate", base.DEC)
  1763. -- Add the fields to the protocol
  1764. adcs_protocol.fields = {
  1765. f_op_status, f_epoch_time, f_measured_rate_x, f_measured_rate_y, f_measured_rate_z
  1766. }
  1767. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1768. -- Loop through the data (num_of_instance represents the number of instances to dissect)
  1769. for i = 0, num_of_instance - 1 do
  1770. -- Add the new structure data as a subtree
  1771. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1772. -- dissect operation status (1 byte)
  1773. local op_status = buffer(offset, 1):le_uint()
  1774. subtree:add(f_op_status, op_status)
  1775. offset = offset + 1
  1776. -- dissect epoch time (4 bytes)
  1777. local epoch_time = buffer(offset, 4):le_uint()
  1778. subtree:add(f_epoch_time, epoch_time)
  1779. offset = offset + 4
  1780. -- dissect measured X axis rate (2 bytes), scaled by 0.01
  1781. local measured_rate_x_raw = buffer(offset, 2):le_int()
  1782. local measured_rate_x = measured_rate_x_raw -- Apply scaling factor
  1783. subtree:add(f_measured_rate_x, measured_rate_x)
  1784. offset = offset + 2
  1785. -- dissect measured Y axis rate (2 bytes), scaled by 0.01
  1786. local measured_rate_y_raw = buffer(offset, 2):le_int()
  1787. local measured_rate_y = measured_rate_y_raw -- Apply scaling factor
  1788. subtree:add(f_measured_rate_y, measured_rate_y)
  1789. offset = offset + 2
  1790. -- dissect measured Z axis rate (2 bytes), scaled by 0.01
  1791. local measured_rate_z_raw = buffer(offset, 2):le_int()
  1792. local measured_rate_z = measured_rate_z_raw -- Apply scaling factor
  1793. subtree:add(f_measured_rate_z, measured_rate_z)
  1794. offset = offset + 2
  1795. end
  1796. end
  1797. ------------------------------------------------------------------------------------------------------------------
  1798. function adcs_dissector_15(buffer, pinfo, tree, adcs_protocol, offset, num_of_instance)
  1799. -- Define ProtoFields for the updated structure fields
  1800. local f_op_status = ProtoField.uint8("StarTrackerData.op_status", "Operation Status", base.DES)
  1801. local f_epoch_time = ProtoField.uint32("StarTrackerData.epoch_time", "Epoch Time", base.DES)
  1802. local f_raw_mag_x = ProtoField.int16("StarTrackerData.raw_mag_x", "Raw Magnetometer X Measurement", base.DEC)
  1803. local f_raw_mag_y = ProtoField.int16("StarTrackerData.raw_mag_y", "Raw Magnetometer Y Measurement", base.DEC)
  1804. local f_raw_mag_z = ProtoField.int16("StarTrackerData.raw_mag_z", "Raw Magnetometer Z Measurement", base.DEC)
  1805. -- Add the fields to the protocol
  1806. adcs_protocol.fields = {
  1807. f_op_status, f_epoch_time, f_raw_mag_x, f_raw_mag_y, f_raw_mag_z
  1808. }
  1809. local subtree1 = tree:add(adcs_protocol, buffer(), "ADCS")
  1810. -- Loop through the data (num_of_instance represents the number of instances to dissect)
  1811. for i = 0, num_of_instance - 1 do
  1812. -- Add the new structure data as a subtree
  1813. local subtree = subtree1:add(adcs_protocol, buffer(), "INSTANCE " ..i)
  1814. -- dissect operation status (1 byte)
  1815. local op_status = buffer(offset, 1):le_uint()
  1816. subtree:add(f_op_status, op_status)
  1817. offset = offset + 1
  1818. -- dissect epoch time (4 bytes)
  1819. local epoch_time = buffer(offset, 4):le_uint()
  1820. subtree:add(f_epoch_time, epoch_time)
  1821. offset = offset + 4
  1822. -- dissect raw magnetometer X measurement (2 bytes)
  1823. local raw_mag_x = buffer(offset, 2):le_int()
  1824. subtree:add(f_raw_mag_x, raw_mag_x)
  1825. offset = offset + 2
  1826. -- dissect raw magnetometer Y measurement (2 bytes)
  1827. local raw_mag_y = buffer(offset, 2):le_int()
  1828. subtree:add(f_raw_mag_y, raw_mag_y)
  1829. offset = offset + 2
  1830. -- dissect raw magnetometer Z measurement (2 bytes)
  1831. local raw_mag_z = buffer(offset, 2):le_int()
  1832. subtree:add(f_raw_mag_z, raw_mag_z)
  1833. offset = offset + 2
  1834. end
  1835. end
  1836. --------------------------------------------------------------------------------------------------------