Main.cs 149 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202
  1. 
  2. using System;
  3. using System.Collections.Generic;
  4. using System.ComponentModel;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.IO.Ports;
  8. using System.Linq;
  9. using System.Runtime.InteropServices;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using System.Windows.Forms;
  13. //Add
  14. using System.Reflection;
  15. using Excel = Microsoft.Office.Interop.Excel;
  16. using static Jdas_Mbic.Bluecell_BootProtocol;
  17. using System.Threading;
  18. using System.IO;
  19. using System.Windows.Forms.DataVisualization.Charting;
  20. using System.Text.RegularExpressions;
  21. using System.Diagnostics;
  22. using System.Drawing.Drawing2D;
  23. namespace Jdas_Mbic
  24. {
  25. public partial class JdasMbic : Form
  26. {
  27. public const double Table_Dbm_DefaultValue = 0;//31.5;
  28. public const int Table_DL_DefaultValue = 7;
  29. public const int Table_UL_DefaultValue = -15;
  30. public const int Table_Temp_DefaultValue = -10;
  31. public Serial serial = new Serial(); // Uart Open
  32. const byte ALARM_DLI_P4_LEVEL_LOW = 0x80;
  33. const byte ALARM_DLI_P3_LEVEL_LOW= 0x40;
  34. const byte ALARM_DLI_P2_LEVEL_LOW= 0x20;
  35. const byte ALARM_DLI_P1_LEVEL_LOW= 0x10;
  36. const byte ALARM_DLI_P4_LEVEL_HIGH= 0x08;
  37. const byte ALARM_DLI_P3_LEVEL_HIGH= 0x04;
  38. const byte ALARM_DLI_P2_LEVEL_HIGH= 0x02;
  39. const byte ALARM_DLI_P1_LEVEL_HIGH = 0x01;
  40. const byte ALARM_AGC_P4 = 0x80;
  41. const byte ALARM_AGC_P3 =0x40;
  42. const byte ALARM_AGC_P2 =0x20;
  43. const byte ALARM_AGC_P1 =0x10;
  44. const byte ALARM_DLI_SHUTDOWN_P4 = 0x08;
  45. const byte ALARM_DLI_SHUTDOWN_P3 = 0x04;
  46. const byte ALARM_DLI_SHUTDOWN_P2 = 0x02;
  47. const byte ALARM_DLI_SHUTDOWN_P1 = 0x01;
  48. const byte ALARM_ULO_P4_LEVEL_HIGH = 0x08;
  49. const byte ALARM_ULO_P3_LEVEL_HIGH = 0x04;
  50. const byte ALARM_ULO_P2_LEVEL_HIGH = 0x02;
  51. const byte ALARM_ULO_P1_LEVEL_HIGH = 0x01;
  52. const byte ALARM_ALC_P4 = 0x80;
  53. const byte ALARM_ALC_P3 = 0x40;
  54. const byte ALARM_ALC_P2 = 0x20;
  55. const byte ALARM_ALC_P1 = 0x10;
  56. const byte ALARM_ULO_SHUTDOWN_P4 = 0x08;
  57. const byte ALARM_ULO_SHUTDOWN_P3 = 0x04;
  58. const byte ALARM_ULO_SHUTDOWN_P2 = 0x02;
  59. const byte ALARM_ULO_SHUTDOWN_P1 = 0x01;
  60. public enum DLUL_Category
  61. {
  62. DL_DET = 0,
  63. UL_DET
  64. };
  65. enum Bluecell_CardType_t
  66. {
  67. BLUECELL_3_7G = 0,
  68. BLUECELL_3_8G,
  69. BLUECELL_3_9G,
  70. BLUECELL_4_0G,
  71. BLUECELL_4_1G,
  72. BLUECELL_4_6G,
  73. BLUECELL_SBM,
  74. BLUECELL_DCM,
  75. BLUECELL_KDDI,
  76. BLUECELL_4_7G,
  77. BLUECELL_4_8G,
  78. BLUECELL_4_9G,
  79. BLUECELL_5_0G,
  80. };
  81. enum HFR_CardType_t
  82. {
  83. MBIC_3_7G = 0x80,
  84. MBIC_3_8G = 0x81,
  85. MBIC_3_9G = 0x82,
  86. MBIC_4_0G = 0x83,
  87. MBIC_4_1G = 0x84,
  88. MBIC_4_6G = 0x85,
  89. MBIC_4_7G = 0x86,
  90. MBIC_4_8G = 0x87,
  91. MBIC_4_9G = 0x88,
  92. MBIC_5_0G = 0x89,
  93. MBIC_DCM = 0x8A,
  94. MBIC_SBM = 0x8B,
  95. MBIC_KDDI = 0x8C
  96. }
  97. public enum MBIC_TableNumber
  98. {
  99. DLI_P1_Level_Table_Number = 0x00,
  100. DLI_P2_Level_Table_Number = 0x01,
  101. DLI_P3_Level_Table_Number = 0x02,
  102. DLI_P4_Level_Table_Number = 0x03,
  103. ULO_P1_Level_Table_Number = 0x10,
  104. ULO_P2_Level_Table_Number = 0x11,
  105. ULO_P3_Level_Table_Number = 0x12,
  106. ULO_P4_Level_Table_Number = 0x13,
  107. DLI_P1_ATT_Temp_guarantee_Table_Number = 0x20,
  108. DLI_P2_ATT_Temp_guarantee_Table_Number = 0x21,
  109. DLI_P3_ATT_Temp_guarantee_Table_Number = 0x22,
  110. DLI_P4_ATT_Temp_guarantee_Table_Number = 0x23,
  111. ULO_P1_ATT_Temp_guarantee_Table_Number = 0x30,
  112. ULO_P2_ATT_Temp_guarantee_Table_Number = 0x31,
  113. ULO_P3_ATT_Temp_guarantee_Table_Number = 0x32,
  114. ULO_P4_ATT_Temp_guarantee_Table_Number = 0x33,
  115. DLI_P1_ATT_Accuracy_Table_Number = 0x40,
  116. DLI_P2_ATT_Accuracy_Table_Number = 0x41,
  117. DLI_P3_ATT_Accuracy_Table_Number = 0x42,
  118. DLI_P4_ATT_Accuracy_Table_Number = 0x43,
  119. ULO_P1_ATT_Accuracy_Table_Number = 0x50,
  120. ULO_P2_ATT_Accuracy_Table_Number = 0x51,
  121. ULO_P3_ATT_Accuracy_Table_Number = 0x52,
  122. ULO_P4_ATT_Accuracy_Table_Number = 0x53,
  123. }
  124. public JdasMbic()
  125. {
  126. InitializeComponent();
  127. }
  128. DataTable table = new DataTable();
  129. private void JdasMbic_Load(object sender, EventArgs e)
  130. {
  131. serial.Serial_Main_Form_Get(this);
  132. serial.Serial_Initialize(ref comboBox_Port);
  133. }
  134. Hidden hidden = new Hidden();
  135. protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
  136. {
  137. Keys key = keyData & ~(Keys.Shift | Keys.Control);
  138. hidden = new Hidden();
  139. hidden.Owner = this; //부모값넘김
  140. switch (key)
  141. {
  142. case Keys.F:
  143. // 조합키 사용 시
  144. if ((keyData & Keys.Control) != 0)
  145. {
  146. MessageBox.Show("Ctrl+F8");
  147. }
  148. break;
  149. case Keys.F8:
  150. // 단일키 사용시
  151. hidden.Show();
  152. hidden.main = this;
  153. //MessageBox.Show("f8");
  154. break;
  155. default:
  156. //MessageBox.Show("지정되지 않은 키입니다.");
  157. return base.ProcessCmdKey(ref msg, keyData);
  158. }
  159. return true;
  160. }
  161. private void dataGridView_TableSetting_CellClick(object sender, DataGridViewCellEventArgs e)
  162. {
  163. }
  164. /*
  165. *
  166. * TABLE Setting Area
  167. *
  168. */
  169. // Bluecell_Serial bluecellserial = new Bluecell_Serial();
  170. public void button_PortOpen_Click(object sender, EventArgs e)
  171. {
  172. byte ret = 0;
  173. ret = serial.Serial_PortOpen(ref button_PortOpen, ref comboBox_Port);
  174. Serial_connectiondisable(ret);
  175. if (ret == 0 && timer_JdasMbic.Enabled == false)
  176. {
  177. timer_JdasMbic.Start(); //타이머를 발동시킨다.
  178. }
  179. else if (timer_JdasMbic.Enabled == true)
  180. {
  181. timer_JdasMbic.Stop(); //타이머를 멈춘다.
  182. }
  183. else
  184. {
  185. /*NOP*/
  186. }
  187. serial.Serial_Main_Form_Get(this);
  188. }
  189. private void button_terminal_Click(object sender, EventArgs e)
  190. {
  191. serial.Serial_TerminalOpen(serial);
  192. }
  193. public bool Serial_connectiondisable(byte on_off)
  194. {
  195. if (on_off != 2)
  196. {
  197. comboBox_Port.Enabled = Convert.ToBoolean(on_off);
  198. comboBox_baudrate.Enabled = Convert.ToBoolean(on_off);
  199. }
  200. else
  201. {
  202. return false;
  203. }
  204. return Convert.ToBoolean(on_off);
  205. }
  206. public bool TX_RX_Light = false;
  207. private delegate void StringSend(object label, String str);
  208. private delegate void SWVisible(object label, bool set);
  209. private delegate void GridviewSend(ref object gridview, string Text);
  210. private delegate void ByteSend(byte[] Text);
  211. private delegate String Stringreturn(object combobox);
  212. int offset = 0;
  213. byte[] rxBuffer;
  214. #if false
  215. private void sPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
  216. {
  217. string startStr = "V";
  218. string endStr = "\n";
  219. try
  220. {
  221. if (offset == 0)
  222. {
  223. rxBuffer = new byte[4096];
  224. }
  225. string rxString = "";
  226. int intRecSize = serialPort_JdasMbic.BytesToRead;
  227. if (intRecSize != 0)
  228. {
  229. /* if (panel_GpsTest.Visible == true)
  230. {
  231. byte[] btdata = new byte[intRecSize];
  232. serialPort_JdasMbic.Read(btdata, 0, intRecSize);
  233. string data = Encoding.Default.GetString(rxBuffer);
  234. this.Invoke(new StringSend(Data_Recv_Str), data);
  235. }
  236. else*/
  237. {
  238. serialPort_JdasMbic.Read(rxBuffer, offset, intRecSize);
  239. offset += intRecSize;
  240. for (int iTemp = 0; iTemp < offset; iTemp++)
  241. {
  242. rxString += Convert.ToChar(rxBuffer[iTemp]);
  243. }
  244. /*
  245. *
  246. * Example
  247. * if (panel_SensorTest.Visible == true)
  248. {
  249. startStr = "V";
  250. endStr = "\n";
  251. }
  252. else if (panel_Catm1Test.Visible == true)
  253. {
  254. startStr = "B";
  255. endStr = "\n";
  256. }
  257. else if (panel_GpsTest.Visible == true)
  258. {
  259. startStr = "$";
  260. endStr = "\n";
  261. }
  262. */
  263. if (rxString.Contains(startStr))
  264. {
  265. rxString = rxString.Substring(rxString.IndexOf(startStr));
  266. if (rxString.Contains(endStr))
  267. {
  268. this.Invoke(new StringSend(Data_Recv_Str), rxString);
  269. //program.dataReceived(rxString, "Receive");
  270. offset = 0;
  271. }
  272. }
  273. else
  274. {
  275. this.Invoke(new StringSend(Data_Recv_Str), rxString);
  276. offset = 0;
  277. }
  278. }
  279. }
  280. }
  281. catch { }
  282. }
  283. #endif
  284. int LineLimit = 500;
  285. [DllImport("user32.dll")]
  286. public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
  287. private const int WM_SETREDRAW = 11;
  288. public void Data_Recv_Str(string text)
  289. {
  290. System.Windows.Forms.RichTextBox tbReceived = null;
  291. //tbReceived = richTextBox_Sensor;
  292. int nLimitLines = Convert.ToInt32(LineLimit); //제한 라인 수
  293. try
  294. {
  295. try
  296. {
  297. SendMessage(this.Handle, WM_SETREDRAW, false, 0);
  298. }
  299. catch (Exception e) { MessageBox.Show(e.StackTrace); }
  300. if (tbReceived.Lines.Length > nLimitLines)
  301. {
  302. LinkedList<string> tempLines = new LinkedList<string>(tbReceived.Lines);
  303. while ((tempLines.Count - nLimitLines) > 0)
  304. {
  305. tempLines.RemoveFirst();
  306. }
  307. tbReceived.Lines = tempLines.ToArray();
  308. }
  309. try
  310. {
  311. SendMessage(this.Handle, WM_SETREDRAW, true, 0);
  312. }
  313. catch { return; }
  314. /* Example
  315. if (panel_SensorTest.Visible == true)
  316. {
  317. Sensor_TestFunc(text);
  318. tbReceived.AppendText(text);
  319. }
  320. else
  321. {
  322. tbReceived.AppendText(text);
  323. }
  324. */
  325. tbReceived.SelectionStart = tbReceived.Text.Length;//맨 마지막 선택...
  326. tbReceived.ScrollToCaret();
  327. }
  328. catch { try { SendMessage(this.Handle, WM_SETREDRAW, true, 0); } catch { return; } }
  329. }
  330. public void Data_Recv_Str(byte[] text)
  331. {
  332. string strtext = Encoding.Default.GetString(text);
  333. System.Windows.Forms.RichTextBox tbReceived = null;
  334. // tbReceived = richTextBox_Sensor;
  335. int nLimitLines = Convert.ToInt32(LineLimit); //제한 라인 수
  336. try
  337. {
  338. try
  339. {
  340. SendMessage(this.Handle, WM_SETREDRAW, false, 0);
  341. }
  342. catch (Exception e) { MessageBox.Show(e.StackTrace); }
  343. if (tbReceived.Lines.Length > nLimitLines)
  344. {
  345. LinkedList<string> tempLines = new LinkedList<string>(tbReceived.Lines);
  346. while ((tempLines.Count - nLimitLines) > 0)
  347. {
  348. tempLines.RemoveFirst();
  349. }
  350. tbReceived.Lines = tempLines.ToArray();
  351. }
  352. try
  353. {
  354. SendMessage(this.Handle, WM_SETREDRAW, true, 0);
  355. }
  356. catch { return; }
  357. /* Example
  358. if (panel_SensorTest.Visible == true)
  359. {
  360. Sensor_TestFunc(strtext);
  361. tbReceived.AppendText(strtext);
  362. }
  363. else
  364. {
  365. tbReceived.AppendText(strtext);
  366. }
  367. */
  368. tbReceived.SelectionStart = tbReceived.Text.Length;//맨 마지막 선택...
  369. tbReceived.ScrollToCaret();
  370. }
  371. catch { try { SendMessage(this.Handle, WM_SETREDRAW, true, 0); } catch { return; } }
  372. }
  373. Int64 Timer_Cnt = 0;
  374. public Int32 ReqTimer_Cnt = 0;
  375. Bluecell_BootProtocol bluecell_BootProtocol = new Bluecell_BootProtocol();
  376. private void timer1_Tick(object sender, EventArgs e)
  377. {
  378. Update_Serial update_Serial = null;
  379. bool req_set = false;
  380. if (update_Serial == null)
  381. {
  382. update_Serial = (Update_Serial)serial.FileDownloadClass_Get();
  383. if (update_Serial == null)
  384. req_set = true;
  385. else if (update_Serial.Update_ready == false)
  386. req_set = true;
  387. }
  388. if (req_set)
  389. {
  390. ReqTimer_Cnt++;
  391. }
  392. if (TX_RX_Light == true)
  393. {
  394. Timer_Cnt++;
  395. }
  396. if (Timer_Cnt < 1000)
  397. {
  398. if (this.pictureBox_G_TX.Visible == true)
  399. {
  400. TX_Light_OFF();
  401. }
  402. if (this.pictureBox_G_RX.Visible == true)
  403. {
  404. RX_Light_OFF();
  405. }
  406. Timer_Cnt = 0;
  407. TX_RX_Light = false;
  408. }
  409. if (ReqTimer_Cnt > 6)
  410. {
  411. bluecell_BootProtocol.Bluecell_RF_Status_Req(serial);
  412. ReqTimer_Cnt = 0;
  413. }
  414. }
  415. Update_Serial file = new Update_Serial();
  416. private void button_FirmwareUpdate_Click(object sender, EventArgs e)
  417. {
  418. OpenFileDialog ofd = new OpenFileDialog();
  419. //FileDownload file = new FileDownload();
  420. file.ShowFileOpenDialog(ref serial, ofd);
  421. }
  422. public void TX_Light_ON()
  423. {
  424. this.pictureBox_G_TX.Visible = true;
  425. this.pictureBox_R_TX.Visible = false;
  426. }
  427. public void TX_Light_OFF()
  428. {
  429. this.pictureBox_R_TX.Visible = true;
  430. this.pictureBox_G_TX.Visible = false;
  431. }
  432. public void RX_Light_ON()
  433. {
  434. this.pictureBox_G_RX.Visible = true;
  435. this.pictureBox_R_RX.Visible = false;
  436. }
  437. public void RX_Light_OFF()
  438. {
  439. this.pictureBox_R_RX.Visible = true;
  440. this.pictureBox_G_RX.Visible = false;
  441. }
  442. const byte BLUECELL_RESET_LENGTH = 9;
  443. public const byte BLUECELL_HEADER = 0xBE;
  444. public const byte BLUECELL_TAILER = 0xEB;
  445. const byte BLUECELL_ATTEN_LENGTH = 32 + 5;
  446. #if false
  447. private void button_ATT_Click_1(object sender, EventArgs e)
  448. {
  449. byte[] temp_buf = new byte[BLUECELL_ATTEN_LENGTH];
  450. Button btn = (Button)sender;
  451. byte datatype = (byte)Bluecell_BootProtocol.DATATYPE.ATTSET;
  452. Int16[] DL = new Int16[4];
  453. Int16[] UL = new Int16[4];
  454. Int16[] ALC_MAX = new Int16[4];
  455. Int16[] ALC_MIN = new Int16[4];
  456. byte tmp_H = 0;
  457. byte tmp_L = 0;
  458. DL[0] = Convert.ToInt16(numericUpDown_ATT_DL1.Value * 10);
  459. DL[1] = Convert.ToInt16(numericUpDown_ATT_DL2.Value * 10);
  460. DL[2] = Convert.ToInt16(numericUpDown_ATT_DL3.Value * 10);
  461. DL[3] = Convert.ToInt16(numericUpDown_ATT_DL4.Value * 10);
  462. UL[0] = Convert.ToInt16(numericUpDown_ATT_UL1.Value * 10);
  463. UL[1] = Convert.ToInt16(numericUpDown_ATT_UL2.Value * 10);
  464. UL[2] = Convert.ToInt16(numericUpDown_ATT_UL3.Value * 10);
  465. UL[3] = Convert.ToInt16(numericUpDown_ATT_UL4.Value * 10);
  466. /*ALC_MAX[0] = Convert.ToInt16(numericUpDown_ALC1_MAX.Value * 10);
  467. ALC_MAX[1] = Convert.ToInt16(numericUpDown_ALC2_MAX.Value * 10);
  468. ALC_MAX[2] = Convert.ToInt16(numericUpDown_ALC3_MAX.Value * 10);
  469. ALC_MAX[3] = Convert.ToInt16(numericUpDown_ALC4_MAX.Value * 10);
  470. ALC_MIN[0] = Convert.ToInt16(numericUpDown_ALC1_MIN.Value * 10);
  471. ALC_MIN[1] = Convert.ToInt16(numericUpDown_AGC2_MIN.Value * 10);
  472. ALC_MIN[2] = Convert.ToInt16(numericUpDown_AGC3_MIN.Value * 10);
  473. ALC_MIN[3] = Convert.ToInt16(numericUpDown_AGC4_MIN.Value * 10);
  474. */
  475. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  476. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
  477. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = 6;
  478. for (int i = 0; i < 4; i++)
  479. {
  480. tmp_H = Convert.ToByte((DL[i] & 0xFF00) >> 8);
  481. tmp_L = Convert.ToByte((DL[i] & 0x00FF));
  482. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2] = tmp_H;
  483. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2 + 1] = tmp_L;
  484. }
  485. for (int i = 4; i < 8; i++)
  486. {
  487. tmp_H = Convert.ToByte((UL[i - 4] & 0xFF00) >> 8);
  488. tmp_L = Convert.ToByte((UL[i - 4] & 0x00FF));
  489. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2] = tmp_H;
  490. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2 + 1] = tmp_L;
  491. }
  492. for (int i = 8; i < 12; i++)
  493. {
  494. tmp_H = Convert.ToByte((ALC_MAX[i - 8] & 0xFF00) >> 8);
  495. tmp_L = Convert.ToByte((ALC_MAX[i - 8] & 0x00FF));
  496. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2] = tmp_H;
  497. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2 + 1] = tmp_L;
  498. }
  499. for (int i = 12; i < 16; i++)
  500. {
  501. tmp_H = Convert.ToByte((ALC_MIN[i - 12] & 0xFF00) >> 8);
  502. tmp_L = Convert.ToByte((ALC_MIN[i - 12] & 0x00FF));
  503. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2] = tmp_H;
  504. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2 + 1] = tmp_L;
  505. }
  506. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 16 * 2] = 1; //CRC
  507. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  508. ReqTimer_Cnt = 0;
  509. }
  510. #endif
  511. private void button_ATT_Click_2(object sender, EventArgs e)
  512. {
  513. Crc16 crc = new Crc16();
  514. byte[] temp_buf = new byte[TableGetMaxLength];
  515. NumericUpDown numeric = (NumericUpDown)sender;
  516. byte tmp_H = 0;
  517. byte tmp_L = 0;
  518. UInt16 Length = TableGetMaxLength - 3;
  519. Int16 UserData = 0;
  520. if (numeric.Name == "numericUpDown_Path1_GainValue"
  521. || numeric.Name == "numericUpDown_Path2_GainValue"
  522. || numeric.Name == "numericUpDown_Path3_GainValue"
  523. || numeric.Name == "numericUpDown_Path4_GainValue")
  524. {
  525. UserData = Convert.ToInt16(numeric.Value);
  526. }
  527. else
  528. {
  529. UserData = Convert.ToInt16(numeric.Value * 10);
  530. }
  531. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  532. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = Convert.ToByte((Length & 0xFF00) >> 8);
  533. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte(Length & 0x00FF);
  534. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
  535. tmp_H = Convert.ToByte((UserData & 0xFF00) >> 8);
  536. tmp_L = Convert.ToByte((UserData & 0x00FF));
  537. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = tmp_H;
  538. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = tmp_L;
  539. switch (numeric.Name)
  540. {
  541. case "numericUpDown_ATT_DL1":
  542. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  543. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL1;
  544. break;
  545. case "numericUpDown_ATT_DL2":
  546. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  547. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL2;
  548. break;
  549. case "numericUpDown_ATT_DL3":
  550. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  551. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL3;
  552. break;
  553. case "numericUpDown_ATT_DL4":
  554. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  555. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL4;
  556. break;
  557. case "numericUpDown_ATT_UL1":
  558. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  559. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL1;
  560. break;
  561. case "numericUpDown_ATT_UL2":
  562. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  563. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL2;
  564. break;
  565. case "numericUpDown_ATT_UL3":
  566. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  567. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL3;
  568. break;
  569. case "numericUpDown_ATT_UL4":
  570. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  571. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL4;
  572. break;
  573. case "numericUpDown_DL1_User":
  574. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  575. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL1_USER;
  576. break;
  577. case "numericUpDown_DL2_User":
  578. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  579. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL2_USER;
  580. break;
  581. case "numericUpDown_DL3_User":
  582. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  583. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL3_USER;
  584. break;
  585. case "numericUpDown_DL4_User":
  586. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  587. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL4_USER;
  588. break;
  589. case "numericUpDown_UL1_User":
  590. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  591. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL1_USER;
  592. break;
  593. case "numericUpDown_UL2_User":
  594. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  595. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL2_USER;
  596. break;
  597. case "numericUpDown_UL3_User":
  598. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  599. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL3_USER;
  600. break;
  601. case "numericUpDown_UL4_User":
  602. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  603. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL4_USER;
  604. break;
  605. case "numericUpDown_Path1_GainValue":
  606. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  607. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Path1_GainValue;
  608. break;
  609. case "numericUpDown_Path2_GainValue":
  610. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  611. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Path2_GainValue;
  612. break;
  613. case "numericUpDown_Path3_GainValue":
  614. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  615. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Path3_GainValue;
  616. break;
  617. case "numericUpDown_Path4_GainValue":
  618. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  619. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Path4_GainValue;
  620. break;
  621. case "numericUpDown_DLI_FRBT_D_Day":
  622. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] /= 10;
  623. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  624. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_FRBT_DaySetting;
  625. break;
  626. }
  627. UInt16 CRCRET = crc.CRC16_Generate(temp_buf, Length );
  628. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
  629. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = Convert.ToByte(CRCRET & 0x00FF);
  630. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  631. ReqTimer_Cnt = 0;
  632. }
  633. enum BluecellReqIndex{
  634. bluecell_header,
  635. bluecell_type,
  636. bluecell_length,
  637. bluecell_crcindex,
  638. Path1_GainValue,
  639. Path2_GainValue,
  640. Path3_GainValue,
  641. Path4_GainValue,
  642. ATT_DL1_PATH,
  643. ATT_DL2_PATH,
  644. ATT_DL3_PATH,
  645. ATT_DL4_PATH,
  646. ATT_UL1_PATH,
  647. ATT_UL2_PATH,
  648. ATT_UL3_PATH,
  649. ATT_UL4_PATH,
  650. ATT_DL1_H,
  651. ATT_DL1_L,
  652. ATT_DL2_H,
  653. ATT_DL2_L,
  654. ATT_DL3_H,
  655. ATT_DL3_L,
  656. ATT_DL4_H,
  657. ATT_DL4_L,
  658. ATT_UL1_H,
  659. ATT_UL1_L,
  660. ATT_UL2_H,
  661. ATT_UL2_L,
  662. ATT_UL3_H,
  663. ATT_UL3_L,
  664. ATT_UL4_H,
  665. ATT_UL4_L,
  666. ULO_P1_Level1_H,
  667. ULO_P1_Level1_L,
  668. ULO_P2_Level2_H,
  669. ULO_P2_Level2_L,
  670. ULO_P3_Level3_H,
  671. ULO_P3_Level3_L,
  672. ULO_P4_Level4_H,
  673. ULO_P4_Level4_L,
  674. DLI_P1_Level1_H,
  675. DLI_P1_Level1_L,
  676. DLI_P2_Level2_H,
  677. DLI_P2_Level2_L,
  678. DLI_P3_Level3_H,
  679. DLI_P3_Level3_L,
  680. DLI_P4_Level4_H,
  681. DLI_P4_Level4_L,
  682. DET_TEMP,
  683. DLI_AGC_ON_OFF,
  684. ULO_ALC_ON_OFF,
  685. ULO_Level1_H,
  686. ULO_Level1_L,
  687. ULO_Level2_H,
  688. ULO_Level2_L,
  689. ULO_Level3_H,
  690. ULO_Level3_L,
  691. ULO_Level4_H,
  692. ULO_Level4_L,
  693. DLI_Level1_H,
  694. DLI_Level1_L,
  695. DLI_Level2_H,
  696. DLI_Level2_L,
  697. DLI_Level3_H,
  698. DLI_Level3_L,
  699. DLI_Level4_H,
  700. DLI_Level4_L,
  701. ULO_ALC_Threshold_H,
  702. ULO_ALC_Threshold_L,
  703. bluecell_User_DL1_H,
  704. bluecell_User_DL1_L,
  705. bluecell_User_DL2_H,
  706. bluecell_User_DL2_L,
  707. bluecell_User_DL3_H,
  708. bluecell_User_DL3_L,
  709. bluecell_User_DL4_H,
  710. bluecell_User_DL4_L,
  711. bluecell_User_UL1_H,
  712. bluecell_User_UL1_L,
  713. bluecell_User_UL2_H,
  714. bluecell_User_UL2_L,
  715. bluecell_User_UL3_H,
  716. bluecell_User_UL3_L,
  717. bluecell_User_UL4_H,
  718. bluecell_User_UL4_L,
  719. bluecell_User_TEMP_H,
  720. bluecell_User_TEMP_L,
  721. bluecell_User_TEMP_OFFSET,
  722. Temp_High_Threshold,
  723. Temp_High_Threshold_Default,
  724. DLI_Level_High_Threshold_H,
  725. DLI_Level_High_Threshold_L,
  726. DLI_Level_Low_Threshold_H,
  727. DLI_Level_Low_Threshold_L,
  728. DLI_Level_High_Low_Threshold_default,
  729. ALARM_TEMP_HIGH, //bit
  730. ALARM_DLI_Level,
  731. ALARM_DLI_SHTUTDOWN,
  732. ALARM_DLI_AGC_Alarm,
  733. ALARM_ULO_ALC_Alarm,
  734. ALARM_ULO_Level,
  735. ALARM_ULO_SHTUTDOWN,
  736. ALARM_MASK1,
  737. ALARM_MASK2,
  738. ALARM_MASK3,
  739. ALARM_MASK4,
  740. ALARM_MASK5,
  741. ALARM_TESTMODE,
  742. ALARM_Test_Dummy1,
  743. ALARM_Test_Dummy2,
  744. ALARM_Test_Dummy3,
  745. ALARM_Test_Dummy4,
  746. ALARM_Test_Dummy5,
  747. CPUVERSION1,
  748. CPUVERSION2,
  749. CPUVERSION3,
  750. CPU_Current_Bank,
  751. CPU_Bank_Select,//Reboot_by,
  752. CPU_Bank1_Image_Version1,
  753. CPU_Bank1_Image_Version2,
  754. CPU_Bank1_Image_Version3,
  755. CPU_Bank1_Image_BuildTime1,
  756. CPU_Bank1_Image_BuildTime2,
  757. CPU_Bank1_Image_BuildTime3,
  758. CPU_Bank1_Image_BuildTime4,
  759. CPU_Bank1_Image_BuildTime5,
  760. CPU_Bank1_Image_BuildTime6,
  761. CPU_Bank1_Image_Name,
  762. CPU_Bank2_Image_Version1 = CPU_Bank1_Image_Name +32,
  763. CPU_Bank2_Image_Version2,
  764. CPU_Bank2_Image_Version3,
  765. CPU_Bank2_Image_BuildTime1,
  766. CPU_Bank2_Image_BuildTime2,
  767. CPU_Bank2_Image_BuildTime3,
  768. CPU_Bank2_Image_BuildTime4,
  769. CPU_Bank2_Image_BuildTime5,
  770. CPU_Bank2_Image_BuildTime6,
  771. CPU_Bank2_Image_Name,
  772. S_W_Reset= CPU_Bank2_Image_Name + 32,
  773. Factory_Set_Initialization,
  774. Temp_High_Alarm,
  775. LED_TEST,
  776. NODE,
  777. Type,
  778. PCB_Version,
  779. Serial_Number = PCB_Version + 2, // INDEX : 20
  780. Manufacture = Serial_Number +20,
  781. Manufacture_Date,
  782. Freq_ID = Manufacture_Date + 3,
  783. Carrier_ID,
  784. Carrier_ON_OFF,
  785. DLI_Level_High_Alarm1,
  786. DLI_Level_High_Alarm2,
  787. DLI_Level_High_Alarm3,
  788. DLI_Level_High_Alarm4,
  789. DLI_Level_Low_Alarm1,
  790. DLI_Level_Low_Alarm2,
  791. DLI_Level_Low_Alarm3,
  792. DLI_Level_Low_Alarm4,
  793. DLI_FRBT_Atten1_H,
  794. DLI_FRBT_Atten1_L,
  795. DLI_FRBT_Atten2_H,
  796. DLI_FRBT_Atten2_L,
  797. DLI_FRBT_Atten3_H,
  798. DLI_FRBT_Atten3_L,
  799. DLI_FRBT_Atten4_H,
  800. DLI_FRBT_Atten4_L,
  801. DLI_FRBT_D_Day,
  802. DLI_FRBT_Status,
  803. DLI_FRBT_ON_OFF,
  804. DLI_AGC_Threshold_H,
  805. DLI_AGC_Threshold_L,
  806. DLI_AGC_Threshold_default,
  807. DLI_Shutdown_ON_OFF,
  808. DLI_Shutdown_Threshold_H,
  809. DLI_Shutdown_Threshold_L,
  810. DLI_Shutdown_Threshold_Default,
  811. DLI_Shutdown_Retry_Count1,
  812. DLI_Shutdown_Retry_Count2,
  813. DLI_Shutdown_Retry_Count3,
  814. DLI_Shutdown_Retry_Count4,
  815. DLI_AGC_Alarm1,
  816. DLI_AGC_Alarm2,
  817. DLI_AGC_Alarm3,
  818. DLI_AGC_Alarm4,
  819. DLI_Shutdown_Alarm1,
  820. DLI_Shutdown_Alarm2,
  821. DLI_Shutdown_Alarm3,
  822. DLI_Shutdown_Alarm4,
  823. ULO_Level_High_Threshold_H,
  824. ULO_Level_High_Threshold_L,
  825. ULO_Level_High_Threshold_default,
  826. ULO_Level_High_Alarm1,
  827. ULO_Level_High_Alarm2,
  828. ULO_Level_High_Alarm3,
  829. ULO_Level_High_Alarm4,
  830. ULO_ALC_Threshold_Default,
  831. ULO_Shutdown_ON_OFF,
  832. ULO_Shutdown_Threshold_H,
  833. ULO_Shutdown_Threshold_L,
  834. ULO_Shutdown_Threshold_Default,
  835. ULO_Shutdown_Retry_Count1,
  836. ULO_Shutdown_Retry_Count2,
  837. ULO_Shutdown_Retry_Count3,
  838. ULO_Shutdown_Retry_Count4,
  839. ULO_ALC_Alarm1,
  840. ULO_ALC_Alarm2,
  841. ULO_ALC_Alarm3,
  842. ULO_ALC_Alarm4,
  843. ULO_Shutdown_Alarm1,
  844. ULO_Shutdown_Alarm2,
  845. ULO_Shutdown_Alarm3,
  846. ULO_Shutdown_Alarm4,
  847. MBIC_ULO_ALC_Atten1_H,
  848. MBIC_ULO_ALC_Atten1_L,
  849. MBIC_ULO_ALC_Atten2_H,
  850. MBIC_ULO_ALC_Atten2_L,
  851. MBIC_ULO_ALC_Atten3_H,
  852. MBIC_ULO_ALC_Atten3_L,
  853. MBIC_ULO_ALC_Atten4_H,
  854. MBIC_ULO_ALC_Atten4_L,
  855. DL_Det_ALL_Offset,
  856. MBIC_Download_Auto_Restart_Set,
  857. Path_TempSave_Bit,/*DL1 / DL 2 /DL3 /DL4 /UL1/UL2/UL3/UL4*/
  858. Path_TempShutdown_Set,/*DL1 / DL 2 /DL3 /DL4 /UL1/UL2/UL3/UL4*/
  859. SelfTest,
  860. SelfTest_ATT_DL1_H,
  861. SelfTest_ATT_DL1_L,
  862. SelfTest_ATT_DL2_H,
  863. SelfTest_ATT_DL2_L,
  864. SelfTest_ATT_DL3_H,
  865. SelfTest_ATT_DL3_L,
  866. SelfTest_ATT_DL4_H,
  867. SelfTest_ATT_DL4_L,
  868. SelfTest_ATT_UL1_H,
  869. SelfTest_ATT_UL1_L,
  870. SelfTest_ATT_UL2_H,
  871. SelfTest_ATT_UL2_L,
  872. SelfTest_ATT_UL3_H,
  873. SelfTest_ATT_UL3_L,
  874. SelfTest_ATT_UL4_H,
  875. SelfTest_ATT_UL4_L,
  876. Reserve = SelfTest_ATT_UL4_L + 15,
  877. /**/
  878. bluecell_crc_H,
  879. bluecell_crc_L,
  880. bluecell_etx,
  881. };
  882. const byte Reqdatastartindex = 4;
  883. //private delegate void StringSend(object label, String str);
  884. private void Numeric_Text_Set(object label, String str)
  885. {
  886. NumericUpDown Temp_label = (NumericUpDown)label;
  887. Temp_label.Text = str;
  888. }
  889. private void TextBox_Text_Set(object label, String str)
  890. {
  891. TextBox Temp_label = (TextBox)label;
  892. Temp_label.Text = str;
  893. }
  894. private void String_Text_Set(object label, String str)
  895. {
  896. String Temp_label = (String)label;
  897. Temp_label = str;
  898. }
  899. private void Label_Text_Set(object label, String str)
  900. {
  901. Label Temp_label = (Label)label;
  902. Temp_label.Text = str;
  903. }
  904. private void Table_Text_Set(object label, String str)
  905. {
  906. label = str;
  907. }
  908. private String ComboBox_Text_Get(object data)
  909. {
  910. ComboBox Temp_data = (ComboBox)data;
  911. return Temp_data.Text;
  912. }
  913. private void PicVisible_Text_Set(object label, bool set)
  914. {
  915. PictureBox Temp_pic = (PictureBox)label;
  916. Temp_pic.Visible = set;
  917. }
  918. private void CheckBoxVisible_Text_Set(object label, bool set)
  919. {
  920. CheckBox Temp_pic = (CheckBox) label;
  921. Temp_pic.Checked = set;
  922. }
  923. private void Button_Text_Set(object label, string val)
  924. {
  925. Button temp_button = (Button)label;
  926. temp_button.Text = val;
  927. }
  928. private Double ADCValueTodBmConvert(DataGridView table,object[] RefData, object[] AdcData, object Currdata)
  929. {
  930. /*
  931. * RefData : Dbm 값
  932. AdcData : Dbm과 매칭되어있는 ADC값
  933. Currdata : 현재 ADC 값
  934. */
  935. object data = Currdata; // 현재 ADC 값
  936. double[] Vitual_array = new double[10];
  937. double step = 0;
  938. double temp,temp1;
  939. Double ret = 0xFF,Currentret = 0;
  940. int LastIndex = 0;
  941. int dot = 0;
  942. for(int i = 0; i < table.RowCount; i++)
  943. {
  944. try
  945. {
  946. step = (Convert.ToDouble(AdcData[i]) - Convert.ToDouble(AdcData[i + 1])) *0.1;
  947. for (int a = 0; a < 10; a++)
  948. {
  949. Vitual_array[a] = Convert.ToDouble(AdcData[i]) - (step * a);
  950. /*현재 ADC 값과 테이블의 ADC값의 모든값들을 마이너스 합 후 */
  951. Currentret = Convert.ToDouble(Vitual_array[a]) - Convert.ToDouble(data);
  952. /*만약 0보다 작을 시 절대값을 취해준다.*/
  953. if (Currentret < 0)
  954. {
  955. Currentret = (Currentret * -2) + Currentret;
  956. }
  957. /*만약 현재 결과 값이 이전 결과 값보다
  958. * 작을 경우 그값이 최종 결과 값이다.*/
  959. if (ret >= Currentret)
  960. {
  961. ret = Currentret;
  962. LastIndex = i;
  963. dot = a;
  964. }
  965. }
  966. }
  967. catch { }
  968. }
  969. temp = Convert.ToDouble(AdcData[LastIndex]);
  970. temp1 = Convert.ToDouble(Currdata);
  971. if (temp1 < temp)
  972. return Convert.ToDouble(RefData[LastIndex + 1]) + (dot * 0.1);
  973. else
  974. return Convert.ToDouble(RefData[0]);
  975. }
  976. public void GUIDataStatusSet(byte[] buf)
  977. {
  978. double Volt_Calc_val = 0.001;//3.3 / 4095;
  979. double adcdata = 0;
  980. Int16 dBmdata = 0;
  981. short LiMitdata = 0;
  982. short AttData = 0;
  983. if (buf[(int)BluecellReqIndex.DLI_AGC_ON_OFF] == 0)
  984. {
  985. this.Invoke(new StringSend(Button_Text_Set), button_AGC, "OFF");// = false;
  986. }
  987. else
  988. {
  989. this.Invoke(new StringSend(Button_Text_Set), button_AGC, "ON");// = false;
  990. }
  991. if (buf[(int)BluecellReqIndex.ULO_ALC_ON_OFF] == 0)
  992. {
  993. this.Invoke(new StringSend(Button_Text_Set), button_ALC, "OFF");// = false;
  994. }
  995. else
  996. {
  997. this.Invoke(new StringSend(Button_Text_Set), button_ALC, "ON");// = false;
  998. }
  999. switch (buf[(int)BluecellReqIndex.Type])
  1000. {
  1001. case (int)HFR_CardType_t.MBIC_3_7G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "3.7G DCM"); break;
  1002. case (int)HFR_CardType_t.MBIC_3_8G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "3.8G KDDI");break;
  1003. case (int)HFR_CardType_t.MBIC_3_9G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "3.9G RAKUTEN");break;
  1004. case (int)HFR_CardType_t.MBIC_4_0G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "4.0G SMB");break;
  1005. case (int)HFR_CardType_t.MBIC_4_1G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "4.1G KDDI");break;
  1006. case (int)HFR_CardType_t.MBIC_4_6G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "4.6G DCM");break;
  1007. case (int)HFR_CardType_t.MBIC_4_7G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LOCAL1"); break;
  1008. case (int)HFR_CardType_t.MBIC_4_8G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LOCAL2"); break;
  1009. case (int)HFR_CardType_t.MBIC_4_9G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "RESERVE1");break;
  1010. case (int)HFR_CardType_t.MBIC_5_0G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "RESERVE2");break;
  1011. case (int)HFR_CardType_t.MBIC_DCM : this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LTE-DCM");break;
  1012. case (int)HFR_CardType_t.MBIC_SBM : this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LTE-SBM");break;
  1013. case (int)HFR_CardType_t.MBIC_KDDI: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LTE-KDDI"); break;
  1014. default: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "ID None"); break;
  1015. }
  1016. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DLI_FRBT_D_Day, buf[(int)BluecellReqIndex.DLI_FRBT_D_Day].ToString());
  1017. if(buf[(int)BluecellReqIndex.CPU_Current_Bank] == 1)
  1018. this.Invoke(new StringSend(TextBox_Text_Set), textBox_CurrBank, "Bank 1");// = false;
  1019. else if (buf[(int)BluecellReqIndex.CPU_Current_Bank] == 2)
  1020. this.Invoke(new StringSend(TextBox_Text_Set), textBox_CurrBank, "Bank 2");// = false;
  1021. else
  1022. this.Invoke(new StringSend(TextBox_Text_Set), textBox_CurrBank, "Unknown");// = false;
  1023. if (buf[(int)BluecellReqIndex.DLI_FRBT_Status] == 0)
  1024. {
  1025. this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_Status, "IDLE");// = false;
  1026. }
  1027. else if (buf[(int)BluecellReqIndex.DLI_FRBT_Status] == 1)
  1028. {
  1029. this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_Status, "TRACKING");// = false;
  1030. }
  1031. else if (buf[(int)BluecellReqIndex.DLI_FRBT_Status] == 2)
  1032. {
  1033. this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_Status, "RUNNING");// = false;
  1034. }
  1035. if(buf[(int)BluecellReqIndex.DLI_FRBT_ON_OFF] == 0)
  1036. {
  1037. this.Invoke(new StringSend(Button_Text_Set), button_FRBT_ONOFF, "OFF");// = false;
  1038. }
  1039. else
  1040. {
  1041. this.Invoke(new StringSend(Button_Text_Set), button_FRBT_ONOFF, "ON");// = false;
  1042. }
  1043. if (buf[(int)BluecellReqIndex.Carrier_ON_OFF] == 0)
  1044. {
  1045. this.Invoke(new StringSend(Button_Text_Set), button_Carrier, "OFF");// = false;
  1046. this.Invoke(new StringSend(TextBox_Text_Set), textBox1_Carrier, "OFF");// = false;
  1047. }
  1048. else
  1049. {
  1050. this.Invoke(new StringSend(Button_Text_Set), button_Carrier, "ON");// = false;
  1051. this.Invoke(new StringSend(TextBox_Text_Set), textBox1_Carrier, "ON");// = false;
  1052. }
  1053. if (buf[(int)BluecellReqIndex.Path_TempShutdown_Set] == 0)
  1054. {
  1055. this.Invoke(new StringSend(Button_Text_Set), button_TempShutdown, "OFF");// = false;
  1056. }
  1057. else
  1058. {
  1059. this.Invoke(new StringSend(Button_Text_Set), button_TempShutdown, "ON");// = false;
  1060. }
  1061. if (buf[(int)BluecellReqIndex.SelfTest] == 0)
  1062. {
  1063. this.Invoke(new StringSend(Button_Text_Set), button_SelfTest1, "OFF");// = false;
  1064. }
  1065. else
  1066. {
  1067. this.Invoke(new StringSend(Button_Text_Set), button_SelfTest1, "ON");// = false;
  1068. }
  1069. if (buf[(int)BluecellReqIndex.SelfTest] == 0)
  1070. {
  1071. this.Invoke(new StringSend(Button_Text_Set), button_SelfTest2, "OFF");// = false;
  1072. }
  1073. else
  1074. {
  1075. this.Invoke(new StringSend(Button_Text_Set), button_SelfTest2, "ON");// = false;
  1076. }
  1077. if (buf[(int)BluecellReqIndex.SelfTest] == 0)
  1078. {
  1079. this.Invoke(new StringSend(Button_Text_Set), button_SelfTest3, "OFF");// = false;
  1080. }
  1081. else
  1082. {
  1083. this.Invoke(new StringSend(Button_Text_Set), button_SelfTest3, "ON");// = false;
  1084. }
  1085. if (buf[(int)BluecellReqIndex.SelfTest] == 0)
  1086. {
  1087. this.Invoke(new StringSend(Button_Text_Set), button_SelfTest4, "OFF");// = false;
  1088. }
  1089. else
  1090. {
  1091. this.Invoke(new StringSend(Button_Text_Set), button_SelfTest4, "ON");// = false;
  1092. }
  1093. if (buf[(int)BluecellReqIndex.ATT_DL1_PATH] == 0)
  1094. {
  1095. this.Invoke(new StringSend(Button_Text_Set), button_DL1_PATH, "OFF");// = false;
  1096. }
  1097. else
  1098. {
  1099. this.Invoke(new StringSend(Button_Text_Set), button_DL1_PATH, "ON");// = false;
  1100. }
  1101. if (buf[(int)BluecellReqIndex.ATT_DL2_PATH] == 0)
  1102. {
  1103. this.Invoke(new StringSend(Button_Text_Set), button_DL2_PATH, "OFF");// = false;
  1104. }
  1105. else
  1106. {
  1107. this.Invoke(new StringSend(Button_Text_Set), button_DL2_PATH, "ON");// = false;
  1108. }
  1109. if (buf[(int)BluecellReqIndex.ATT_DL3_PATH] == 0)
  1110. {
  1111. this.Invoke(new StringSend(Button_Text_Set), button_DL3_PATH, "OFF");// = false;
  1112. }
  1113. else
  1114. {
  1115. this.Invoke(new StringSend(Button_Text_Set), button_DL3_PATH, "ON");// = false;
  1116. }
  1117. if (buf[(int)BluecellReqIndex.ATT_DL4_PATH] == 0)
  1118. {
  1119. this.Invoke(new StringSend(Button_Text_Set), button_DL4_PATH, "OFF");// = false;
  1120. }
  1121. else
  1122. {
  1123. this.Invoke(new StringSend(Button_Text_Set), button_DL4_PATH, "ON");// = false;
  1124. }
  1125. if (buf[(int)BluecellReqIndex.ATT_UL1_PATH] == 0)
  1126. {
  1127. this.Invoke(new StringSend(Button_Text_Set), button_UL1_PATH, "OFF");// = false;
  1128. }
  1129. else
  1130. {
  1131. this.Invoke(new StringSend(Button_Text_Set), button_UL1_PATH, "ON");// = false;
  1132. }
  1133. if (buf[(int)BluecellReqIndex.ATT_UL2_PATH] == 0)
  1134. {
  1135. this.Invoke(new StringSend(Button_Text_Set), button_UL2_PATH, "OFF");// = false;
  1136. }
  1137. else
  1138. {
  1139. this.Invoke(new StringSend(Button_Text_Set), button_UL2_PATH, "ON");// = false;
  1140. }
  1141. if (buf[(int)BluecellReqIndex.ATT_UL3_PATH] == 0)
  1142. {
  1143. this.Invoke(new StringSend(Button_Text_Set), button_UL3_PATH, "OFF");// = false;
  1144. }
  1145. else
  1146. {
  1147. this.Invoke(new StringSend(Button_Text_Set), button_UL3_PATH, "ON");// = false;
  1148. }
  1149. if (buf[(int)BluecellReqIndex.ATT_UL4_PATH] == 0)
  1150. {
  1151. this.Invoke(new StringSend(Button_Text_Set), button_UL4_PATH, "OFF");// = false;
  1152. }
  1153. else
  1154. {
  1155. this.Invoke(new StringSend(Button_Text_Set), button_UL4_PATH, "ON");// = false;
  1156. }
  1157. if (buf[(int)BluecellReqIndex.ALARM_TEMP_HIGH] != 0x80)
  1158. {
  1159. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_TempHigh_Alarm_ON, false);// = false;
  1160. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_TempHigh_Alarm_OFF, true);// = false;
  1161. }
  1162. else
  1163. {
  1164. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_TempHigh_Alarm_ON, true);// = false;
  1165. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_TempHigh_Alarm_OFF, false);// = false;
  1166. }
  1167. if (buf[(int)BluecellReqIndex.ALARM_DLI_Level] == 0)
  1168. {
  1169. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_ON, false);// = false;
  1170. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_ON, false);// = false;
  1171. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_ON, false);// = false;
  1172. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_ON, false);// = false;
  1173. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_OFF, true);// = false;
  1174. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_OFF, true);// = false;
  1175. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_OFF, true);// = false;
  1176. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_OFF, true);// = false;
  1177. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_ON, false);// = false;
  1178. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_ON, false);// = false;
  1179. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_ON, false);// = false;
  1180. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_ON, false);// = false;
  1181. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_OFF, true);// = false;
  1182. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_OFF, true);// = false;
  1183. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_OFF, true);// = false;
  1184. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_OFF, true);// = false;
  1185. }
  1186. else
  1187. {
  1188. /**
  1189. *
  1190. * DLI HIGH ALARM PART
  1191. *
  1192. * **/
  1193. if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P1_LEVEL_HIGH) > 0)
  1194. {
  1195. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_ON, true);// = false;
  1196. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_OFF, false);// = false;
  1197. }
  1198. else
  1199. {
  1200. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_ON, false);// = false;
  1201. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_OFF, true);// = false;
  1202. }
  1203. if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P2_LEVEL_HIGH) > 0)
  1204. {
  1205. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_ON, true);// = false;
  1206. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_OFF, false);// = false;
  1207. }
  1208. else
  1209. {
  1210. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_ON, false);// = false;
  1211. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_OFF, true);// = false;
  1212. }
  1213. if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P3_LEVEL_HIGH) > 0)
  1214. {
  1215. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_ON, true);// = false;
  1216. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_OFF, false);// = false;
  1217. }
  1218. else
  1219. {
  1220. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_ON, false);// = false;
  1221. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_OFF, true);// = false;
  1222. }
  1223. if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P4_LEVEL_HIGH) > 0)
  1224. {
  1225. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_ON, true);// = false;
  1226. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_OFF, false);// = false;
  1227. }
  1228. else
  1229. {
  1230. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_ON, false);// = false;
  1231. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_OFF, true);// = false;
  1232. }
  1233. /**
  1234. *
  1235. * DLI LOW ALARM PART
  1236. *
  1237. * **/
  1238. if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P1_LEVEL_LOW) > 0)
  1239. {
  1240. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_ON, true);// = false;
  1241. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_OFF, false);// = false;
  1242. }
  1243. else
  1244. {
  1245. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_ON, false);// = false;
  1246. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_OFF, true);// = false;
  1247. }
  1248. if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P2_LEVEL_LOW) > 0)
  1249. {
  1250. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_ON, true);// = false;
  1251. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_OFF, false);// = false;
  1252. }
  1253. else
  1254. {
  1255. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_ON, false);// = false;
  1256. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_OFF, true);// = false;
  1257. }
  1258. if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P3_LEVEL_LOW) > 0)
  1259. {
  1260. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_ON, true);// = false;
  1261. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_OFF, false);// = false;
  1262. }
  1263. else
  1264. {
  1265. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_ON, false);// = false;
  1266. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_OFF, true);// = false;
  1267. }
  1268. if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P4_LEVEL_LOW) > 0)
  1269. {
  1270. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_ON, true);// = false;
  1271. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_OFF, false);// = false;
  1272. }
  1273. else
  1274. {
  1275. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_ON, false);// = false;
  1276. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_OFF, true);// = false;
  1277. }
  1278. }
  1279. if (buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] == 0)
  1280. {
  1281. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_ON, false);// = false;
  1282. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_ON, false);// = false;
  1283. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_ON, false);// = false;
  1284. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_ON, false);// = false;
  1285. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_OFF, true);// = false;
  1286. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_OFF, true);// = false;
  1287. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_OFF, true);// = false;
  1288. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_OFF, true);// = false;
  1289. }
  1290. else
  1291. {
  1292. if ((buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] & ALARM_DLI_SHUTDOWN_P1) > 0)
  1293. {
  1294. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_ON, true);// = false;
  1295. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_OFF, false);// = false;
  1296. }
  1297. else
  1298. {
  1299. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_ON, false);// = false;
  1300. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_OFF, true);// = false;
  1301. }
  1302. if ((buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] & ALARM_DLI_SHUTDOWN_P2) > 0)
  1303. {
  1304. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_ON, true);// = false;
  1305. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_OFF, false);// = false;
  1306. }
  1307. else
  1308. {
  1309. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_ON, false);// = false;
  1310. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_OFF, true);// = false;
  1311. }
  1312. if ((buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] & ALARM_DLI_SHUTDOWN_P3) > 0)
  1313. {
  1314. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_ON, true);// = false;
  1315. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_OFF, false);// = false;
  1316. }
  1317. else
  1318. {
  1319. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_ON, false);// = false;
  1320. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_OFF, true);// = false;
  1321. }
  1322. if ((buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] & ALARM_DLI_SHUTDOWN_P4) > 0)
  1323. {
  1324. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_ON, true);// = false;
  1325. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_OFF, false);// = false;
  1326. }
  1327. else
  1328. {
  1329. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_ON, false);// = false;
  1330. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_OFF, true);// = false;
  1331. }
  1332. }
  1333. if (buf[(int)BluecellReqIndex.DLI_Shutdown_ON_OFF] == 0)
  1334. {
  1335. this.Invoke(new StringSend(Button_Text_Set), button_DL_Shutdown, "OFF");// = false;
  1336. }
  1337. else
  1338. {
  1339. this.Invoke(new StringSend(Button_Text_Set), button_DL_Shutdown, "ON");// = false;
  1340. }
  1341. if (buf[(int)BluecellReqIndex.ULO_Shutdown_ON_OFF] == 0)
  1342. {
  1343. this.Invoke(new StringSend(Button_Text_Set), button_UL_Shutdown, "OFF");// = false;
  1344. }
  1345. else
  1346. {
  1347. this.Invoke(new StringSend(Button_Text_Set), button_UL_Shutdown, "ON");// = false;
  1348. }
  1349. if (buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] == 0)
  1350. {
  1351. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_ON, false);// = false;
  1352. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_ON, false);// = false;
  1353. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_ON, false);// = false;
  1354. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_ON, false);// = false;
  1355. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_OFF, true);// = false;
  1356. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_OFF, true);// = false;
  1357. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_OFF, true);// = false;
  1358. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_OFF, true);// = false;
  1359. }
  1360. else
  1361. {
  1362. if ((buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] & ALARM_AGC_P1) > 0)
  1363. {
  1364. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_ON, true);// = false;
  1365. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_OFF, false);// = false;
  1366. }
  1367. else
  1368. {
  1369. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_ON, false);// = false;
  1370. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_OFF, true);// = fals
  1371. }
  1372. if ((buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] & ALARM_AGC_P2) > 0)
  1373. {
  1374. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_ON, true);// = false;
  1375. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_OFF, false);// = false;
  1376. }
  1377. else
  1378. {
  1379. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_ON, false);// = false;
  1380. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_OFF, true);// = fals
  1381. }
  1382. if ((buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] & ALARM_AGC_P3) > 0)
  1383. {
  1384. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_ON, true);// = false;
  1385. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_OFF, false);// = false;
  1386. }
  1387. else
  1388. {
  1389. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_ON, false);// = false;
  1390. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_OFF, true);// = fals
  1391. }
  1392. if ((buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] & ALARM_AGC_P4) > 0)
  1393. {
  1394. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_ON, true);// = false;
  1395. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_OFF, false);// = false;
  1396. }
  1397. else
  1398. {
  1399. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_ON, false);// = false;
  1400. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_OFF, true);// = fals
  1401. }
  1402. }
  1403. if (buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] == 0)
  1404. {
  1405. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_ON, false);// = false;
  1406. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_ON, false);// = false;
  1407. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_ON, false);// = false;
  1408. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_ON, false);// = false;
  1409. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_OFF, true);// = false;
  1410. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_OFF, true);// = false;
  1411. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_OFF, true);// = false;
  1412. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_OFF, true);// = false;
  1413. }
  1414. else
  1415. {
  1416. if ((buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] & ALARM_ALC_P1) > 0)
  1417. {
  1418. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_ON, true);// = false;
  1419. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_OFF, false);// = false;
  1420. }
  1421. else
  1422. {
  1423. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_ON, false);// = false;
  1424. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_OFF, true);// = fals
  1425. }
  1426. if ((buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] & ALARM_ALC_P2) > 0)
  1427. {
  1428. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_ON, true);// = false;
  1429. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_OFF, false);// = false;
  1430. }
  1431. else
  1432. {
  1433. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_ON, false);// = false;
  1434. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_OFF, true);// = fals
  1435. }
  1436. if ((buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] & ALARM_ALC_P3) > 0)
  1437. {
  1438. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_ON, true);// = false;
  1439. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_OFF, false);// = false;
  1440. }
  1441. else
  1442. {
  1443. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_ON, false);// = false;
  1444. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_OFF, true);// = fals
  1445. }
  1446. if ((buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] & ALARM_ALC_P4) > 0)
  1447. {
  1448. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_ON, true);// = false;
  1449. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_OFF, false);// = false;
  1450. }
  1451. else
  1452. {
  1453. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_ON, false);// = false;
  1454. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_OFF, true);// = fals
  1455. }
  1456. }
  1457. if (buf[(int)BluecellReqIndex.ALARM_ULO_Level] == 0)
  1458. {
  1459. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path1_High_Alarm_ON, false);// = false;
  1460. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path2_High_Alarm_ON, false);// = false;
  1461. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path3_High_Alarm_ON, false);// = false;
  1462. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path4_High_Alarm_ON, false);// = false;
  1463. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path1_High_Alarm_OFF, true);// = false;
  1464. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path2_High_Alarm_OFF, true);// = false;
  1465. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path3_High_Alarm_OFF, true);// = false;
  1466. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path4_High_Alarm_OFF, true);// = false;
  1467. }
  1468. else
  1469. {
  1470. /**
  1471. *
  1472. * ULO HIGH ALARM PART
  1473. *
  1474. * **/
  1475. if ((buf[(int)BluecellReqIndex.ALARM_ULO_Level] & ALARM_ULO_P1_LEVEL_HIGH) > 0)
  1476. {
  1477. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path1_High_Alarm_ON, true);// = false;
  1478. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path1_High_Alarm_OFF, false);// = false;
  1479. }
  1480. if ((buf[(int)BluecellReqIndex.ALARM_ULO_Level] & ALARM_ULO_P2_LEVEL_HIGH) > 0)
  1481. {
  1482. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path2_High_Alarm_ON, true);// = false;
  1483. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path2_High_Alarm_OFF, false);// = false;
  1484. }
  1485. if ((buf[(int)BluecellReqIndex.ALARM_ULO_Level] & ALARM_ULO_P3_LEVEL_HIGH) > 0)
  1486. {
  1487. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path3_High_Alarm_ON, true);// = false;
  1488. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path3_High_Alarm_OFF, false);// = false;
  1489. }
  1490. if ((buf[(int)BluecellReqIndex.ALARM_ULO_Level] & ALARM_ULO_P4_LEVEL_HIGH) > 0)
  1491. {
  1492. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path4_High_Alarm_ON, true);// = false;
  1493. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path4_High_Alarm_OFF, false);// = false;
  1494. }
  1495. }
  1496. if (buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] == 0)
  1497. {
  1498. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_ON, false);// = false;
  1499. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_ON, false);// = false;
  1500. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_ON, false);// = false;
  1501. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_ON, false);// = false;
  1502. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_OFF, true);// = false;
  1503. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_OFF, true);// = false;
  1504. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_OFF, true);// = false;
  1505. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_OFF, true);// = false;
  1506. }
  1507. else
  1508. {
  1509. if ((buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] & ALARM_ULO_SHUTDOWN_P1) > 0)
  1510. {
  1511. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_ON, true);// = false;
  1512. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_OFF, false);// = false;
  1513. }
  1514. else
  1515. {
  1516. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_ON, false);// = false;
  1517. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_OFF, true);// = false;
  1518. }
  1519. if ((buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] & ALARM_ULO_SHUTDOWN_P2) > 0)
  1520. {
  1521. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_ON, true);// = false;
  1522. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_OFF, false);// = false;
  1523. }
  1524. else
  1525. {
  1526. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_ON, false);// = false;
  1527. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_OFF, true);// = false;
  1528. }
  1529. if ((buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] & ALARM_ULO_SHUTDOWN_P3) > 0)
  1530. {
  1531. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_ON, true);// = false;
  1532. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_OFF, false);// = false;
  1533. }
  1534. else
  1535. {
  1536. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_ON, false);// = false;
  1537. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_OFF, true);// = false;
  1538. }
  1539. if ((buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] & ALARM_ULO_SHUTDOWN_P4) > 0)
  1540. {
  1541. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_ON, true);// = false;
  1542. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_OFF, false);// = false;
  1543. }
  1544. else
  1545. {
  1546. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_ON, false);// = false;
  1547. this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_OFF, true);// = false;
  1548. }
  1549. }
  1550. this.Invoke(new SWVisible(CheckBoxVisible_Text_Set), checkBox_Fix, IamSetting_Get());// = false;
  1551. if (IamSetting_Get() == false)
  1552. {
  1553. LiMitdata = 0;
  1554. LiMitdata += buf[(int)BluecellReqIndex.Temp_High_Threshold];
  1555. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Temp_Threshold, LiMitdata.ToString());
  1556. LiMitdata = 0;
  1557. LiMitdata += buf[(int)BluecellReqIndex.Temp_High_Threshold_Default];
  1558. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Temp_Threshold_Default, LiMitdata.ToString("N2"));
  1559. LiMitdata = 0;
  1560. LiMitdata += buf[(int)BluecellReqIndex.bluecell_User_TEMP_OFFSET];
  1561. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Temperature_Offset, LiMitdata.ToString());
  1562. LiMitdata = 0;
  1563. LiMitdata += buf[(int)BluecellReqIndex.ALARM_MASK1];
  1564. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_MASK, LiMitdata.ToString());
  1565. LiMitdata = 0;
  1566. LiMitdata += (short)((buf[(int)BluecellReqIndex.DLI_AGC_Threshold_H] << 8) & 0xFF00);
  1567. LiMitdata += (short)(buf[(int)BluecellReqIndex.DLI_AGC_Threshold_L] & 0x00FF);
  1568. LiMitdata /= 10;
  1569. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DLI_AGC_Threshold, LiMitdata.ToString());
  1570. LiMitdata = 0;
  1571. LiMitdata += (short)((buf[(int)BluecellReqIndex.ULO_ALC_Threshold_H] << 8) & 0xFF00);
  1572. LiMitdata += (short)(buf[(int)BluecellReqIndex.ULO_ALC_Threshold_L] & 0x00FF);
  1573. LiMitdata /= 10;
  1574. this.Invoke(new StringSend(TextBox_Text_Set), textBox_ULO_ALC_Threshold, LiMitdata.ToString());
  1575. AttData = (short)(((buf[(int)BluecellReqIndex.ATT_DL1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_DL1_L] & 0x00FF));
  1576. adcdata = AttData *0.1;
  1577. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_DL1, adcdata.ToString("N2"));
  1578. AttData = (short)(((buf[(int)BluecellReqIndex.ATT_DL2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_DL2_L] & 0x00FF));
  1579. adcdata = AttData *0.1;
  1580. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_DL2, adcdata.ToString("N2"));
  1581. AttData = (short)(((buf[(int)BluecellReqIndex.ATT_DL3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_DL3_L] & 0x00FF));
  1582. adcdata = AttData *0.1;
  1583. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_DL3, adcdata.ToString("N2"));
  1584. AttData = (short)(((buf[(int)BluecellReqIndex.ATT_DL4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_DL4_L] & 0x00FF));
  1585. adcdata = AttData *0.1;
  1586. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_DL4, adcdata.ToString("N2"));
  1587. AttData = (short)(((buf[(int)BluecellReqIndex.ATT_UL1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_UL1_L] & 0x00FF));
  1588. adcdata = AttData *0.1;
  1589. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL1, adcdata.ToString("N2"));
  1590. AttData = (short)(((buf[(int)BluecellReqIndex.ATT_UL2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_UL2_L] & 0x00FF));
  1591. adcdata = AttData *0.1;
  1592. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL2, adcdata.ToString("N2"));
  1593. AttData = (short)(((buf[(int)BluecellReqIndex.ATT_UL3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_UL3_L] & 0x00FF));
  1594. adcdata = AttData *0.1;
  1595. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL3, adcdata.ToString("N2"));
  1596. AttData = (short)(((buf[(int)BluecellReqIndex.ATT_UL4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_UL4_L] & 0x00FF));
  1597. adcdata = AttData *0.1;
  1598. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL4, adcdata.ToString("N2"));
  1599. AttData = (short)(buf[(int)BluecellReqIndex.Path1_GainValue]);
  1600. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Path1_GainValue, AttData.ToString());
  1601. AttData = (short)(buf[(int)BluecellReqIndex.Path2_GainValue]);
  1602. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Path2_GainValue, AttData.ToString());
  1603. AttData = (short)(buf[(int)BluecellReqIndex.Path3_GainValue]);
  1604. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Path3_GainValue, AttData.ToString());
  1605. AttData = (short)(buf[(int)BluecellReqIndex.Path4_GainValue]);
  1606. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Path4_GainValue, AttData.ToString());
  1607. //this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC4_MAX, adcdata.ToString("N2"));
  1608. adcdata = 0;
  1609. AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_DL1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_DL1_L] & 0x00FF));
  1610. adcdata = AttData *0.1;
  1611. /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
  1612. {
  1613. adcdata = (0xffff - adcdata) + 1;
  1614. adcdata *= -1;
  1615. }
  1616. adcdata = AttData *0.1;*/
  1617. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DL1_User, adcdata.ToString("N2"));
  1618. adcdata = 0;
  1619. AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_DL2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_DL2_L] & 0x00FF));
  1620. adcdata = (AttData) *0.1;
  1621. //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_DL2_H] << 8) & 0xFF00);
  1622. //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_DL2_L] & 0x00FF);
  1623. /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
  1624. {
  1625. adcdata = (0xffff - adcdata) + 1;
  1626. adcdata *= -1;
  1627. }
  1628. adcdata = AttData *0.1;*/
  1629. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DL2_User, adcdata.ToString("N2"));
  1630. adcdata = 0;
  1631. AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_DL3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_DL3_L] & 0x00FF));
  1632. adcdata = AttData *0.1;
  1633. //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_DL3_H] << 8) & 0xFF00);
  1634. //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_DL3_L] & 0x00FF);
  1635. /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
  1636. {
  1637. adcdata = (0xffff - adcdata) + 1;
  1638. adcdata *= -1;
  1639. }
  1640. adcdata = AttData *0.1;*/
  1641. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DL3_User, adcdata.ToString("N2"));
  1642. adcdata = 0;
  1643. AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_DL4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_DL4_L] & 0x00FF));
  1644. adcdata = AttData *0.1;
  1645. //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_DL4_H] << 8) & 0xFF00);
  1646. //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_DL4_L] & 0x00FF);
  1647. /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
  1648. {
  1649. adcdata = (0xffff - adcdata) + 1;
  1650. adcdata *= -1;
  1651. }
  1652. adcdata = AttData *0.1;*/
  1653. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DL4_User, adcdata.ToString("N2"));
  1654. adcdata = 0;
  1655. AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_UL1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_UL1_L] & 0x00FF));
  1656. adcdata = AttData *0.1;
  1657. //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_UL1_H] << 8) & 0xFF00);
  1658. //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_UL1_L] & 0x00FF);
  1659. /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
  1660. {
  1661. adcdata = (0xffff - adcdata) + 1;
  1662. adcdata *= -1;
  1663. }
  1664. adcdata = AttData *0.1;*/
  1665. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_UL1_User, adcdata.ToString("N2"));
  1666. adcdata = 0;
  1667. AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_UL2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_UL2_L] & 0x00FF));
  1668. adcdata = AttData *0.1;
  1669. //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_UL2_H] << 8) & 0xFF00);
  1670. //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_UL2_L] & 0x00FF);
  1671. /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
  1672. {
  1673. adcdata = (0xffff - adcdata) + 1;
  1674. adcdata *= -1;
  1675. }
  1676. adcdata = AttData *0.1;*/
  1677. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_UL2_User, adcdata.ToString("N2"));
  1678. adcdata = 0;
  1679. AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_UL3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_UL3_L] & 0x00FF));
  1680. adcdata = AttData *0.1;
  1681. //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_UL3_H] << 8) & 0xFF00);
  1682. //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_UL3_L] & 0x00FF);
  1683. /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
  1684. {
  1685. adcdata = (0xffff - adcdata) + 1;
  1686. adcdata *= -1;
  1687. }
  1688. adcdata = AttData *0.1;*/
  1689. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_UL3_User, adcdata.ToString("N2"));
  1690. adcdata = 0;
  1691. AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_UL4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_UL4_L] & 0x00FF));
  1692. adcdata = AttData *0.1;
  1693. //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_UL4_H] << 8) & 0xFF00);
  1694. //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_UL4_L] & 0x00FF);
  1695. /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
  1696. {
  1697. adcdata = (0xffff - adcdata) + 1;
  1698. adcdata *= -1;
  1699. }
  1700. adcdata = AttData *0.1;*/
  1701. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_UL4_User, adcdata.ToString("N2"));
  1702. adcdata = 0;
  1703. AttData = (short)(((buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten1_L] & 0x00FF));
  1704. AttData /= 10;
  1705. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC1, AttData.ToString());
  1706. AttData = (short)(((buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten2_L] & 0x00FF));
  1707. AttData /= 10;
  1708. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC2, AttData.ToString());
  1709. AttData = (short)(((buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten3_L] & 0x00FF));
  1710. AttData /= 10;
  1711. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC3, AttData.ToString());
  1712. AttData = (short)(((buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten4_L] & 0x00FF));
  1713. AttData /= 10;
  1714. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC4, AttData.ToString());
  1715. }
  1716. this.Invoke(new StringSend(TextBox_Text_Set), textBox_MunufactureDate,
  1717. buf[(int)BluecellReqIndex.Manufacture_Date].ToString()
  1718. + buf[(int)BluecellReqIndex.Manufacture_Date + 1].ToString("D2")
  1719. + buf[(int)BluecellReqIndex.Manufacture_Date + 2].ToString("D2"));
  1720. string tempstr = "";
  1721. for (int strindex = 0; strindex < 20; strindex++)
  1722. tempstr += Convert.ToChar(buf[(int)BluecellReqIndex.Serial_Number + strindex]);
  1723. this.Invoke(new StringSend(TextBox_Text_Set), textBox_SerialNumber, tempstr);
  1724. tempstr = buf[(int)BluecellReqIndex.PCB_Version].ToString();
  1725. tempstr += ".";
  1726. tempstr += buf[(int)BluecellReqIndex.PCB_Version + 1].ToString();
  1727. this.Invoke(new StringSend(TextBox_Text_Set), textBox_PcbVersion, tempstr);
  1728. tempstr = "";
  1729. for (int strindex = 0; strindex < 31; strindex++)
  1730. tempstr += Convert.ToChar(buf[(int)BluecellReqIndex.CPU_Bank1_Image_Name + strindex]);
  1731. this.Invoke(new StringSend(TextBox_Text_Set), textBox_Bank1Name, tempstr);
  1732. tempstr = "";
  1733. for (int strindex = 0; strindex < 31; strindex++)
  1734. tempstr += Convert.ToChar(buf[(int)BluecellReqIndex.CPU_Bank2_Image_Name + strindex]);
  1735. this.Invoke(new StringSend(TextBox_Text_Set), textBox_Bank2Name, tempstr);
  1736. AttData = (short)(((buf[(int)BluecellReqIndex.DLI_Shutdown_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.DLI_Shutdown_Threshold_L] & 0x00FF));
  1737. AttData = Convert.ToInt16(AttData * 0.1);
  1738. //this.Invoke(new StringSend(Numeric_Text_Set), hidden.numericUpDown_DLI_Shutdown_Threshold, AttData.ToString());
  1739. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL_ShutdownLimit, AttData.ToString());
  1740. AttData = (short)(((buf[(int)BluecellReqIndex.ULO_Shutdown_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ULO_Shutdown_Threshold_L] & 0x00FF));
  1741. AttData = Convert.ToInt16(AttData * 0.1);
  1742. this.Invoke(new StringSend(TextBox_Text_Set), textBox_UL_ShutdownLimit, AttData.ToString());
  1743. AttData = (short)(buf[(int)BluecellReqIndex.DL_Det_ALL_Offset]);
  1744. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL1_TableOffset, ((sbyte)AttData).ToString());
  1745. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL2_TableOffset, ((sbyte)AttData).ToString());
  1746. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL3_TableOffset, ((sbyte)AttData).ToString());
  1747. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL4_TableOffset, ((sbyte)AttData).ToString());
  1748. AttData = (short)(((buf[(int)BluecellReqIndex.DLI_Level_High_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.DLI_Level_High_Threshold_L] & 0x00FF));
  1749. AttData = Convert.ToInt16(AttData * 0.1);
  1750. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DLI_Level_High_Threshold, AttData.ToString());
  1751. AttData = (short)(((buf[(int)BluecellReqIndex.DLI_Level_Low_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.DLI_Level_Low_Threshold_L] & 0x00FF));
  1752. AttData = Convert.ToInt16(AttData * 0.1);
  1753. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DLI_Level_Low_Threshold, AttData.ToString());
  1754. AttData = (short)(((buf[(int)BluecellReqIndex.ULO_Level_High_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ULO_Level_High_Threshold_L] & 0x00FF));
  1755. AttData = Convert.ToInt16(AttData * 0.1);
  1756. this.Invoke(new StringSend(TextBox_Text_Set), textBox_ULO_Level_High_Threshold, AttData.ToString());
  1757. AttData = buf[(int)BluecellReqIndex.ULO_Shutdown_Retry_Count1];
  1758. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownUL1, AttData.ToString());
  1759. AttData = buf[(int)BluecellReqIndex.ULO_Shutdown_Retry_Count2];
  1760. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownUL2, AttData.ToString());
  1761. AttData = buf[(int)BluecellReqIndex.ULO_Shutdown_Retry_Count3];
  1762. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownUL3, AttData.ToString());
  1763. AttData = buf[(int)BluecellReqIndex.ULO_Shutdown_Retry_Count4];
  1764. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownUL4, AttData.ToString());
  1765. AttData = buf[(int)BluecellReqIndex.DLI_Shutdown_Retry_Count1];
  1766. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownDL1, AttData.ToString());
  1767. AttData = buf[(int)BluecellReqIndex.DLI_Shutdown_Retry_Count2];
  1768. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownDL2, AttData.ToString());
  1769. AttData = buf[(int)BluecellReqIndex.DLI_Shutdown_Retry_Count3];
  1770. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownDL3, AttData.ToString());
  1771. AttData = buf[(int)BluecellReqIndex.DLI_Shutdown_Retry_Count4];
  1772. this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownDL4, AttData.ToString());
  1773. adcdata = 0;
  1774. adcdata = ((buf[(int)BluecellReqIndex.DLI_P1_Level1_H] << 8) & 0xFF00);
  1775. adcdata += (buf[(int)BluecellReqIndex.DLI_P1_Level1_L] & 0x00FF);
  1776. adcdata *= Volt_Calc_val;
  1777. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL1, adcdata.ToString("N3"));
  1778. dBmdata = 0;
  1779. dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_Level1_H] << 8) & 0xFF00);
  1780. dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_Level1_L] & 0x00FF);
  1781. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL1_dBm, (dBmdata * 0.1).ToString());
  1782. adcdata = 0;
  1783. adcdata = ((buf[(int)BluecellReqIndex.DLI_P2_Level2_H] << 8) & 0xFF00);
  1784. adcdata += (buf[(int)BluecellReqIndex.DLI_P2_Level2_L] & 0x00FF);
  1785. adcdata *= Volt_Calc_val;
  1786. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL2, adcdata.ToString("N3"));
  1787. dBmdata = 0;
  1788. dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_Level2_H] << 8) & 0xFF00);
  1789. dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_Level2_L] & 0x00FF);
  1790. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL2_dBm, (dBmdata * 0.1).ToString());
  1791. adcdata = 0;
  1792. adcdata = ((buf[(int)BluecellReqIndex.DLI_P3_Level3_H] << 8) & 0xFF00);
  1793. adcdata += (buf[(int)BluecellReqIndex.DLI_P3_Level3_L] & 0x00FF);
  1794. adcdata *= Volt_Calc_val;
  1795. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL3, adcdata.ToString("N3"));
  1796. dBmdata = 0;
  1797. dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_Level3_H] << 8) & 0xFF00);
  1798. dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_Level3_L] & 0x00FF);
  1799. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL3_dBm, (dBmdata * 0.1).ToString());
  1800. adcdata = 0;
  1801. adcdata = ((buf[(int)BluecellReqIndex.DLI_P4_Level4_H] << 8) & 0xFF00);
  1802. adcdata += (buf[(int)BluecellReqIndex.DLI_P4_Level4_L] & 0x00FF);
  1803. adcdata *= Volt_Calc_val;
  1804. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL4, adcdata.ToString("N3"));
  1805. dBmdata = 0;
  1806. dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_Level4_H] << 8) & 0xFF00);
  1807. dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_Level4_L] & 0x00FF);
  1808. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL4_dBm, (dBmdata * 0.1).ToString());
  1809. adcdata = 0;
  1810. adcdata = ((buf[(int)BluecellReqIndex.ULO_P1_Level1_H] << 8) & 0xFF00);
  1811. adcdata += (buf[(int)BluecellReqIndex.ULO_P1_Level1_L] & 0x00FF);
  1812. adcdata *= Volt_Calc_val;
  1813. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL1, adcdata.ToString("N3"));
  1814. dBmdata = 0;
  1815. dBmdata = (short)((buf[(int)BluecellReqIndex.ULO_Level1_H] << 8) & 0xFF00);
  1816. dBmdata += (short)(buf[(int)BluecellReqIndex.ULO_Level1_L] & 0x00FF);
  1817. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL1_dBm, (dBmdata * 0.1).ToString());
  1818. adcdata = 0;
  1819. adcdata = ((buf[(int)BluecellReqIndex.ULO_P2_Level2_H] << 8) & 0xFF00);
  1820. adcdata += (buf[(int)BluecellReqIndex.ULO_P2_Level2_L] & 0x00FF);
  1821. adcdata *= Volt_Calc_val;
  1822. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL2, adcdata.ToString("N3"));
  1823. dBmdata = 0;
  1824. dBmdata = (short)((buf[(int)BluecellReqIndex.ULO_Level2_H] << 8) & 0xFF00);
  1825. dBmdata += (short)(buf[(int)BluecellReqIndex.ULO_Level2_L] & 0x00FF);
  1826. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL2_dBm, (dBmdata * 0.1).ToString());
  1827. adcdata = 0;
  1828. adcdata = ((buf[(int)BluecellReqIndex.ULO_P3_Level3_H] << 8) & 0xFF00);
  1829. adcdata += (buf[(int)BluecellReqIndex.ULO_P3_Level3_L] & 0x00FF);
  1830. adcdata *= Volt_Calc_val;
  1831. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL3, adcdata.ToString("N3"));
  1832. dBmdata = 0;
  1833. dBmdata = (short)((buf[(int)BluecellReqIndex.ULO_Level3_H] << 8) & 0xFF00);
  1834. dBmdata += (short)(buf[(int)BluecellReqIndex.ULO_Level3_L] & 0x00FF);
  1835. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL3_dBm, (dBmdata * 0.1).ToString());
  1836. adcdata = 0;
  1837. adcdata = ((buf[(int)BluecellReqIndex.ULO_P4_Level4_H] << 8) & 0xFF00);
  1838. adcdata += (buf[(int)BluecellReqIndex.ULO_P4_Level4_L] & 0x00FF);
  1839. adcdata *= Volt_Calc_val;
  1840. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL4, adcdata.ToString("N3"));
  1841. dBmdata = 0;
  1842. dBmdata = (short)((buf[(int)BluecellReqIndex.ULO_Level4_H] << 8) & 0xFF00);
  1843. dBmdata += (short)(buf[(int)BluecellReqIndex.ULO_Level4_L] & 0x00FF);
  1844. this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL4_dBm, (dBmdata * 0.1).ToString());
  1845. dBmdata = 0;
  1846. dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_FRBT_Atten1_H] << 8) & 0xFF00);
  1847. dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_FRBT_Atten1_L] & 0x00FF);
  1848. this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_DL1, (dBmdata * 0.1).ToString());
  1849. dBmdata = 0;
  1850. dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_FRBT_Atten2_H] << 8) & 0xFF00);
  1851. dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_FRBT_Atten2_L] & 0x00FF);
  1852. this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_DL2, (dBmdata * 0.1).ToString());
  1853. dBmdata = 0;
  1854. dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_FRBT_Atten3_H] << 8) & 0xFF00);
  1855. dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_FRBT_Atten3_L] & 0x00FF);
  1856. this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_DL3, (dBmdata * 0.1).ToString());
  1857. dBmdata = 0;
  1858. dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_FRBT_Atten4_H] << 8) & 0xFF00);
  1859. dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_FRBT_Atten4_L] & 0x00FF);
  1860. this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_DL4, (dBmdata * 0.1).ToString());
  1861. adcdata = 0;
  1862. #if false
  1863. adcdata += ((buf[(int)BluecellReqIndex.DET_TEMP_H] << 8) & 0xFF00);
  1864. adcdata += (buf[(int)BluecellReqIndex.DET_TEMP_L] & 0x00FF);
  1865. adcdata = adcdata * 3.3 / 4095;
  1866. adcdata = (adcdata - 0.5) * 100;
  1867. #else
  1868. adcdata = (sbyte)(buf[(int)BluecellReqIndex.DET_TEMP]);
  1869. #endif
  1870. this.Invoke(new StringSend(Label_Text_Set), label_Temp, adcdata.ToString("N2") + "°C");
  1871. adcdata = 0;
  1872. //string tmp = Convert.ToInt32(buf[(int)BluecellReqIndex.CPUVERSION3],16).ToString();
  1873. char pad = '0';
  1874. string version = Convert.ToString(buf[(int)BluecellReqIndex.CPUVERSION1]).PadLeft(2,pad)
  1875. + "."
  1876. + Convert.ToString(buf[(int)BluecellReqIndex.CPUVERSION2]).PadLeft(2, pad)
  1877. + "."
  1878. + Convert.ToInt32(buf[(int)BluecellReqIndex.CPUVERSION3]).ToString("X").PadLeft(2, pad);
  1879. //Convert.ToInt32(buf[(int)BluecellReqIndex.CPUVERSION3], 16).ToString();
  1880. //adcdata += (buf[(int)BluecellReqIndex.CPUVERSION2])/10;
  1881. //adcdata += (buf[(int)BluecellReqIndex.CPUVERSION3]);
  1882. this.Invoke(new StringSend(TextBox_Text_Set), textBox_CpuVersion, version);
  1883. hidden.TableCurrentOutputSetting();
  1884. }
  1885. object[] DET_DL1_Table = new object[128];
  1886. object[] DET_DL2_Table = new object[128];
  1887. object[] DET_DL3_Table = new object[128];
  1888. object[] DET_DL4_Table = new object[128];
  1889. object[] DET_UL1_Table = new object[128];
  1890. object[] DET_UL2_Table = new object[128];
  1891. object[] DET_UL3_Table = new object[128];
  1892. object[] DET_UL4_Table = new object[128];
  1893. object[] DET_DL1_RefTable = new object[128];
  1894. object[] DET_DL2_RefTable = new object[128];
  1895. object[] DET_DL3_RefTable = new object[128];
  1896. object[] DET_DL4_RefTable = new object[128];
  1897. object[] DET_UL1_RefTable = new object[128];
  1898. object[] DET_UL2_RefTable = new object[128];
  1899. object[] DET_UL3_RefTable = new object[128];
  1900. object[] DET_UL4_RefTable = new object[128];
  1901. public void TableDataStatusSet(byte[] buf)
  1902. {
  1903. hidden.TableDataStatusSet(buf);
  1904. }
  1905. public void DateLabelInputFunc(string date)
  1906. {
  1907. this.Invoke(new StringSend(Label_Text_Set), label_CompileDate, date);
  1908. }
  1909. private void ATT_Enter(object sender, KeyEventArgs e)
  1910. {
  1911. if (e.KeyCode == Keys.Enter)
  1912. {
  1913. //button_ATT_Click_1(sender, null);
  1914. button_ATT_Click_2(sender, null);
  1915. //to do
  1916. }
  1917. else if(e.KeyCode == Keys.Escape)
  1918. {
  1919. Activi_Change__Setting(null,null);
  1920. }
  1921. else
  1922. {
  1923. return;
  1924. }
  1925. }
  1926. private bool IamSetting = false;
  1927. private void Activi_Change__SettingComplete(object sender, EventArgs e)
  1928. {
  1929. IamSetting = true;
  1930. }
  1931. public void Activi_Change__Setting(object sender, EventArgs e)
  1932. {
  1933. IamSetting = false;
  1934. }
  1935. public bool IamSetting_Get()
  1936. {
  1937. return IamSetting;
  1938. }
  1939. private void checkBox_Fix_CheckedChanged(object sender, EventArgs e)
  1940. {
  1941. }
  1942. public const byte DET_TableMaxLength = 160 + 1+ 6 + 2; // Header + Type + Length + CRCINDEX + TableIndex + ..... + CRC
  1943. public const byte ATT_TableMaxLength = 96 + 1 + 6 + 2; // Header + Type + Length + CRCINDEX + TableIndex + ..... + CRC
  1944. public const byte Temp_TableMaxLength = 96 + 1 + 6 + 2; // Header + Type + Length + CRCINDEX + TableIndex + ..... + CRC
  1945. const byte TableGetMaxLength = 1 + 7 + 1;
  1946. private void button_Save_Click(object sender, EventArgs e)
  1947. {
  1948. byte[] temp_buf = new byte[TableGetMaxLength];
  1949. Int16 Length =
  1950. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  1951. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_StatusSave;
  1952. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = TableGetMaxLength - 2;
  1953. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
  1954. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = (byte)1;
  1955. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  1956. ReqTimer_Cnt = 0;
  1957. }
  1958. private void numericUpDown_User_KeyDown(object sender, KeyEventArgs e)
  1959. {
  1960. NumericUpDown numeric = (NumericUpDown)sender;
  1961. const byte TableGetMaxLength = 9;
  1962. byte tmp_H = 0;
  1963. byte tmp_L = 0;
  1964. ReqTimer_Cnt = 0;
  1965. if (e.KeyCode == Keys.Enter)
  1966. {
  1967. byte[] temp_buf = new byte[TableGetMaxLength];
  1968. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  1969. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = Convert.ToByte(((TableGetMaxLength - 3) & 0xFF00) >> 8);
  1970. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte((TableGetMaxLength - 3) & 0x00FF);
  1971. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
  1972. if ( numeric.Name == "numericUpDown_Temp_Threshold"
  1973. || numeric.Name == "numericUpDown_Temp_Threshold_Default"
  1974. || numeric.Name == "numericUpDown_Temperature_Offset"
  1975. || numeric.Name.Contains("Default") == true)
  1976. {
  1977. Int16 UserData = Convert.ToInt16(numeric.Value);
  1978. //tmp_H = Convert.ToByte((UserData & 0xFF00) >> 8);
  1979. tmp_L = Convert.ToByte((UserData & 0x00FF));
  1980. //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = tmp_H;
  1981. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = tmp_L;
  1982. }
  1983. else
  1984. {
  1985. Int16 UserData = Convert.ToInt16(numeric.Value * 10);
  1986. tmp_H = Convert.ToByte((UserData & 0xFF00) >> 8);
  1987. tmp_L = Convert.ToByte((UserData & 0x00FF));
  1988. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = tmp_H;
  1989. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = tmp_L;
  1990. }
  1991. switch (numeric.Name)
  1992. {
  1993. case "numericUpDown_Temp_Threshold":
  1994. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  1995. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Temp_High_Threshold;
  1996. break;
  1997. case "numericUpDown_Temp_Threshold_Default":
  1998. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  1999. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Temp_High_Threshold_Default;
  2000. break;
  2001. case "numericUpDown_Temperature_Offset":
  2002. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2003. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Temperature_Offset;
  2004. break;
  2005. case "numericUpDown_DL1_User":
  2006. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2007. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DL1_USER;
  2008. break;
  2009. case "numericUpDown_DL2_User":
  2010. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2011. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DL2_USER;
  2012. break;
  2013. case "numericUpDown_DL3_User":
  2014. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2015. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DL3_USER;
  2016. break;
  2017. case "numericUpDown_DL4_User":
  2018. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2019. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DL4_USER;
  2020. break;
  2021. case "numericUpDown_UL1_User":
  2022. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2023. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_UL1_USER;
  2024. break;
  2025. case "numericUpDown_UL2_User":
  2026. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2027. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_UL2_USER;
  2028. break;
  2029. case "numericUpDown_UL3_User":
  2030. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2031. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_UL3_USER;
  2032. break;
  2033. case "numericUpDown_UL4_User":
  2034. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2035. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_UL4_USER;
  2036. break;
  2037. case "numericUpDown_TEMP_User":
  2038. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2039. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_TEMP_USER;
  2040. break;
  2041. case "numericUpDown_DLI_Level_High_Threshold":
  2042. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2043. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Level_High_Threshold;
  2044. break;
  2045. case "numericUpDown_DLI_Level_Low_Threshold":
  2046. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2047. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Level_Low_Threshold;
  2048. break;
  2049. case "numericUpDown_DLI_Level_High_Low_Threshold_default":
  2050. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2051. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Level_High_Low_Threshold_default;
  2052. break;
  2053. case "numericUpDown_DLI_AGC_Threshold":
  2054. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2055. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_AGC_Threshold;
  2056. break;
  2057. case "numericUpDown_DLI_AGC_Threshold_Default":
  2058. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2059. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_AGC_Threshold_Default;
  2060. break;
  2061. case "numericUpDown_DLI_Shutdown_Threshold":
  2062. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2063. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Shutdown_Threshold;
  2064. break;
  2065. case "numericUpDown_DLI_Shutdown_Threshold_Default":
  2066. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2067. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Shutdown_Threshold_Default;
  2068. break;
  2069. case "numericUpDown_ULO_Level_High_Threshold":
  2070. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2071. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_Level_High_Threshold;
  2072. break;
  2073. case "numericUpDown_DLI_Level_High_Threshold_default":
  2074. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2075. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Level_High_Low_Threshold_default;
  2076. break;
  2077. case "numericUpDown_ULO_ALC_Threshold":
  2078. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2079. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_ALC_Threshold;
  2080. break;
  2081. case "numericUpDown_ULO_ALC_Threshold_Default":
  2082. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2083. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_ALC_Threshold_Default;
  2084. break;
  2085. case "numericUpDown_ULO_Shutdown_Threshold":
  2086. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2087. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_Shutdown_Threshold;
  2088. break;
  2089. case "numericUpDown_ULO_Shutdown_Threshold_Default":
  2090. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2091. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_Shutdown_Threshold_Default;
  2092. break;
  2093. case "numericUpDown_MASK":
  2094. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2095. = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Alarm_Mask;
  2096. break;
  2097. case "numericUpDown_ALC1":
  2098. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2099. = (byte)Bluecell_BootProtocol.DATATYPE.BLuecell_ATT_ALC1;
  2100. break;
  2101. case "numericUpDown_ALC2":
  2102. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2103. = (byte)Bluecell_BootProtocol.DATATYPE.BLuecell_ATT_ALC2;
  2104. break;
  2105. case "numericUpDown_ALC3":
  2106. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2107. = (byte)Bluecell_BootProtocol.DATATYPE.BLuecell_ATT_ALC3;
  2108. break;
  2109. case "numericUpDown_ALC4":
  2110. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
  2111. = (byte)Bluecell_BootProtocol.DATATYPE.BLuecell_ATT_ALC4;
  2112. break;
  2113. default:break;
  2114. }
  2115. Crc16 crc = new Crc16();
  2116. UInt16 CRCRET = crc.CRC16_Generate(temp_buf, Convert.ToByte((TableGetMaxLength - 3) & 0x00FF));
  2117. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
  2118. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = Convert.ToByte(CRCRET & 0x00FF);
  2119. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  2120. ReqTimer_Cnt = 0;
  2121. //to do
  2122. }
  2123. else if (e.KeyCode == Keys.Escape)
  2124. {
  2125. Activi_Change__Setting(null, null);
  2126. }
  2127. else
  2128. {
  2129. return;
  2130. }
  2131. }
  2132. private void button_Reset_Click(object sender, EventArgs e)
  2133. {
  2134. label_CompileDate.Text = "";
  2135. byte[] temp_buf = new byte[TableGetMaxLength];
  2136. byte[] Temp_MBICResetCmd = { 0x16, 0x16, 0x16, 0x16, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x48, 0x00, 0x14, 0x06, 0x09, 0x00, 0x14, 0x33, 0x00, 0x01, 0x00, 0x04, 0xa7, 0xe0, 0x0e, 0x01, 0x00, 0xac, 0xda, 0x03 };
  2137. // serial.Serial_DataSend(Temp_MBICResetCmd, Temp_MBICResetCmd.Length);
  2138. //return;
  2139. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  2140. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.BLUECELL_SOFTWARERESET;
  2141. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = Convert.ToByte((TableGetMaxLength - 2 & 0xFF00 )>> 8);
  2142. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte((TableGetMaxLength - 2 & 0x00FF));
  2143. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
  2144. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = (byte)1;
  2145. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  2146. ReqTimer_Cnt = 0;
  2147. }
  2148. private void numericUpDown_ATT_DL1_ValueChanged(object sender, EventArgs e)
  2149. {
  2150. }
  2151. private void button_LedTest_Click(object sender, EventArgs e)
  2152. {
  2153. byte[] temp_buf = new byte[BLUECELL_RESET_LENGTH];
  2154. Button button = (Button)sender;
  2155. DATATYPE datatype;
  2156. ReqTimer_Cnt = 0;
  2157. switch (button.Name)
  2158. {
  2159. case "button_LedTest":
  2160. datatype = DATATYPE.Bluecell_LED_TEST;
  2161. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 1;
  2162. break;
  2163. default:
  2164. MessageBox.Show("잘 못된 값 입니다. 확인 부탁드립니다.");
  2165. return;
  2166. }
  2167. //pictureBox.Visible = false;
  2168. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  2169. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
  2170. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = 0;
  2171. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = 6;
  2172. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
  2173. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = 0;
  2174. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = 1; //CRC
  2175. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  2176. }
  2177. UInt32[] crc32_tab = {
  2178. 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
  2179. 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
  2180. 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
  2181. 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
  2182. 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
  2183. 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
  2184. 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
  2185. 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
  2186. 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
  2187. 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
  2188. 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
  2189. 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
  2190. 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
  2191. 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
  2192. 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
  2193. 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
  2194. 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
  2195. 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
  2196. 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
  2197. 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
  2198. 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
  2199. 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
  2200. 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
  2201. 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
  2202. 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
  2203. 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
  2204. 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
  2205. 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
  2206. 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
  2207. 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
  2208. 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
  2209. 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
  2210. 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
  2211. 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
  2212. 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
  2213. 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
  2214. 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
  2215. 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
  2216. 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
  2217. 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
  2218. 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
  2219. 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
  2220. 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
  2221. };
  2222. public UInt32 crc32(byte[] buf, UInt32 size)
  2223. {
  2224. UInt32 crcret = 0;
  2225. int a = 0;
  2226. crcret = crcret ^ ~0U;
  2227. while (size-- > 0) {
  2228. //printf("index : size : %d buf %x \r\n", size,* p);
  2229. crcret = crc32_tab[(crcret ^ buf[a++]) & 0xFF] ^ (crcret >> 8);
  2230. }
  2231. return crcret ^ ~0U;
  2232. }
  2233. public byte[] MBIC_BootLoader_DataArray;
  2234. byte[] MBIC_Add_BootLoader_DataArray = new byte[128];
  2235. const string MBIC_HeaderName = "JT-NRDAS ";
  2236. public byte[] DataToConvertHex(string date)
  2237. {
  2238. char[] tmpret;
  2239. byte[] ret = new byte[6];
  2240. tmpret = date.ToCharArray();
  2241. for (int i = 0; i < date.Length/2; i++)
  2242. {
  2243. ret[i] = Convert.ToByte((tmpret[i * 2] & 0x0F) * 10) ;
  2244. ret[i] += Convert.ToByte((tmpret[(i * 2) + 1] & 0x0F));
  2245. }
  2246. return ret;
  2247. }
  2248. public Crc16 crc = new Crc16();
  2249. byte[] MBIC_BootLoaderData;
  2250. public MBIC_DownLoadWnc mbic_downloadwnc = new MBIC_DownLoadWnc();
  2251. private void button_Test_Click(object sender, EventArgs e)
  2252. {
  2253. #if false
  2254. string MBIC_HeaderFileName = "jhfs-mbic-nrdas-v00.00." + numericUpDown_Version.Text+ ".mbc";
  2255. char[] tempchardata;
  2256. int TotalFrame = 0;
  2257. OpenFileDialog Mbic_ofd = new OpenFileDialog();
  2258. UInt32 Crcret = 0;
  2259. byte[] tempdata = new byte[1027];
  2260. int i = 0;
  2261. int SendDataLength = 0;
  2262. UInt16 CrcRet = 0;
  2263. timer_JdasMbic.Stop(); //타이머를 멈춘다.
  2264. //파일오픈창 생성 및 설정
  2265. Mbic_ofd.Title = "업데이터 파일 탐색기";
  2266. Mbic_ofd.FileName = "*.bin";
  2267. Mbic_ofd.Filter = "binary 파일 (*.binary,*.bin) | *.binary;, *.bin; | 모든 파일 (*.*) | *.*";
  2268. string s3 = DateTime.Now.ToString("yyMMddHHmmss");
  2269. //string s3 = DateTime.Now.ToString("yyMMdd");
  2270. //파일 오픈창 로드
  2271. DialogResult dr = Mbic_ofd.ShowDialog();
  2272. //OK버튼 클릭시
  2273. if (dr == DialogResult.OK)
  2274. {
  2275. //File명과 확장자를 가지고 온다.
  2276. string fileName = Mbic_ofd.SafeFileName;
  2277. //File경로와 File명을 모두 가지고 온다.
  2278. string fileFullName = Mbic_ofd.FileName;
  2279. //File경로만 가지고 온다.
  2280. string filePath = fileFullName.Replace(fileName, "");
  2281. //this.serial.debug_hextoasciiConvert();
  2282. //출력 예제용 로직
  2283. // label1.Text = "File Name : " + fileName;
  2284. // label2.Text = "Full Name : " + fileFullName;
  2285. // label3.Text = "File Path : " + filePath;`
  2286. //File경로 + 파일명 리턴
  2287. //JT-NRDAS
  2288. tempchardata = MBIC_HeaderName.ToCharArray();
  2289. for(i = 0; i < tempchardata.Length; i++)
  2290. {
  2291. MBIC_Add_BootLoader_DataArray[i] = Convert.ToByte(tempchardata[i]);
  2292. }
  2293. MBIC_Add_BootLoader_DataArray[9] = 0x20; //file type : MBIC 0x20
  2294. MBIC_Add_BootLoader_DataArray[10] = 0x00; //file type : CPU 0x00
  2295. MBIC_Add_BootLoader_DataArray[11] = 0x00;//version
  2296. MBIC_Add_BootLoader_DataArray[12] = 0x00;//version
  2297. MBIC_Add_BootLoader_DataArray[13] = 0x01;//version
  2298. tempchardata = MBIC_HeaderFileName.ToCharArray();
  2299. for (i = 14; i < 14 + tempchardata.Length + 12; i++) // Total 41byte Filename
  2300. {
  2301. try
  2302. {
  2303. MBIC_Add_BootLoader_DataArray[i] = Convert.ToByte(tempchardata[i - 14]);
  2304. }
  2305. catch
  2306. {
  2307. MBIC_Add_BootLoader_DataArray[i] = 0x20;
  2308. }
  2309. }
  2310. tempchardata = s3.ToCharArray();
  2311. for (i = 55; i < 54 + tempchardata.Length / 2 + 1; i++)
  2312. {
  2313. MBIC_Add_BootLoader_DataArray[i] = DataToConvertHex(s3)[i - 55];
  2314. }
  2315. MBIC_BootLoader_DataArray = File.ReadAllBytes(Mbic_ofd.FileName);
  2316. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0xFF00) >> 8);
  2317. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128)& 0x00FF));
  2318. Crcret = crc32(MBIC_BootLoader_DataArray, Convert.ToUInt32(MBIC_BootLoader_DataArray.Length));
  2319. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0xFF000000) >> (8 * 3));
  2320. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x00FF0000) >> (8 * 2));
  2321. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x0000FF00) >> (8 * 1));
  2322. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x000000FF) >> (8 * 0));
  2323. for (i = 0; i < 62; i++)
  2324. MBIC_Add_BootLoader_DataArray[66 + i] = 0x00;
  2325. byte[] RetBinary = new byte[MBIC_Add_BootLoader_DataArray.Length + MBIC_BootLoader_DataArray.Length];
  2326. Array.Copy(MBIC_Add_BootLoader_DataArray, 0, RetBinary, 0, MBIC_Add_BootLoader_DataArray.Length);
  2327. Array.Copy(MBIC_BootLoader_DataArray, 0, RetBinary, MBIC_Add_BootLoader_DataArray.Length, MBIC_BootLoader_DataArray.Length);
  2328. // System.IO.FileStream infile = new System.IO.FileStream("FileName.bin", System.IO.FileMode.Create); //파일 스트림 선언
  2329. //infile.Write(RetBinary, 0, RetBinary.Length); //쓰기
  2330. // infile.Close(); //꼭 닫아 주세요. 파일 입출력엔 엄청 중요하죠.
  2331. MBIC_BootLoaderData = bluecell_BootProtocol.MBIC_HeaderMergeFunction(RetBinary, RetBinary.Length);
  2332. /*Download Start Request*/
  2333. /*tempdata[0] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0xFF000000) >> 24);
  2334. tempdata[1] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0x00FF0000) >> 16);
  2335. tempdata[2] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0x0000FF00) >> 8);
  2336. tempdata[3] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0x000000FF));*/
  2337. TotalFrame = MBIC_BootLoader_DataArray.Length / 1024;
  2338. if(MBIC_BootLoader_DataArray.Length % 1024 > 0)
  2339. {
  2340. TotalFrame += 1;
  2341. }
  2342. tempdata[0] = Convert.ToByte(((TotalFrame) & 0xFF000000) >> 24);
  2343. tempdata[1] = Convert.ToByte(((TotalFrame) & 0x00FF0000) >> 16);
  2344. tempdata[2] = Convert.ToByte(((TotalFrame) & 0x0000FF00) >> 8);
  2345. tempdata[3] = Convert.ToByte(((TotalFrame) & 0x000000FF));
  2346. tempdata[4] = 0;
  2347. tempdata[5] = 0;
  2348. tempdata[6] = 0;
  2349. tempdata[7] = 0;
  2350. tempdata = bluecell_BootProtocol.MBIC_HeaderMergeFunction(tempdata, 8);
  2351. tempdata[(int)MBICProt_st.MBIC_CMD_0] = 0x10;
  2352. SendDataLength = 8 + 22 + 3;
  2353. tempdata[(int)MBICProt_st.MBIC_LENGTH_0] = 0x00;
  2354. tempdata[(int)MBICProt_st.MBIC_LENGTH_1] = (Byte)(SendDataLength - 25);
  2355. tempdata[(int)MBICProt_st.MBIC_HEADERCHECKSUM_0] = crc.Chksum_Create(tempdata);
  2356. CrcRet = crc.MBIC_CRC16_Generate(tempdata, SendDataLength - 25); //Length = Total Length - Header Length - Taile Length
  2357. tempdata[SendDataLength - 3] = Convert.ToByte((CrcRet & 0xFF00) >> 8);
  2358. tempdata[SendDataLength - 2] = Convert.ToByte(CrcRet & 0x00FF);
  2359. tempdata[SendDataLength - 1] = 0x03;
  2360. this.serial.Serial_DataSend(tempdata, 8 + 22 + 3);
  2361. //this.serial.Serial_DataSend(MBIC_BootLoaderData, 1024 + 22 + 3);
  2362. /*
  2363. tempdata[0] = 0xbe;
  2364. tempdata[1] = Termianl_Reset;
  2365. tempdata[2] = 0x02;
  2366. tempdata[3] = STH30_CreateCrc(tempdata, tempdata[2]);
  2367. tempdata[4] = 0xeb;
  2368. this.serial.Serial_DataSend(tempdata, 5);*/
  2369. try
  2370. {
  2371. // Controller_Debug.Controller_TX_TextLoad(tempdata);
  2372. }
  2373. catch { }
  2374. }
  2375. //취소버튼 클릭시 또는 ESC키로 파일창을 종료 했을경우
  2376. else if (dr == DialogResult.Cancel)
  2377. {
  2378. }
  2379. #else
  2380. timer_JdasMbic.Stop(); //타이머를 멈춘다.
  2381. mbic_downloadwnc = new MBIC_DownLoadWnc();
  2382. mbic_downloadwnc.Owner = this; //부모값넘김
  2383. mbic_downloadwnc.Show();
  2384. mbic_downloadwnc.main = this;
  2385. #endif
  2386. }
  2387. private void button_Make_Click(object sender, EventArgs e)
  2388. {
  2389. char[] tempchardata;
  2390. OpenFileDialog Mbic_ofd = new OpenFileDialog();
  2391. UInt32 Crcret = 0;
  2392. byte[] tempdata = new byte[1027];
  2393. int i = 0;
  2394. /*string dec = ;
  2395. string hex = Convert.ToString(int.Parse(dec, 16).ToUpper();*/
  2396. string hex = "24";
  2397. string dec = Convert.ToInt32(hex, 10).ToString();
  2398. char pad = '0';
  2399. string MBIC_HeaderFileName = "jhfs-mbic-nrdas-v"+ numericUpDown_Version1.Text.PadLeft(2,pad)+ "." + numericUpDown_Version2.Text.PadLeft(2, pad) + "." + numericUpDown_Version3.Text.PadLeft(2, pad) + ".mbc";
  2400. //현재 사용자 바탕화면 경로
  2401. string localpath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
  2402. timer_JdasMbic.Stop(); //타이머를 멈춘다.
  2403. //파일오픈창 생성 및 설정
  2404. Mbic_ofd.Title = "업데이터 파일 탐색기";
  2405. Mbic_ofd.FileName = "*.bin";
  2406. Mbic_ofd.Filter = "binary 파일 (*.binary,*.bin) | *.binary;, *.bin; | 모든 파일 (*.*) | *.*";
  2407. string s3 = DateTime.Now.ToString("yyMMddHHmmss");
  2408. //string s3 = DateTime.Now.ToString("yyMMdd");
  2409. //파일 오픈창 로드
  2410. DialogResult dr = Mbic_ofd.ShowDialog();
  2411. //OK버튼 클릭시
  2412. if (dr == DialogResult.OK)
  2413. {
  2414. //File명과 확장자를 가지고 온다.
  2415. string fileName = Mbic_ofd.SafeFileName;
  2416. //File경로와 File명을 모두 가지고 온다.
  2417. string fileFullName = Mbic_ofd.FileName;
  2418. //File경로만 가지고 온다.
  2419. string filePath = fileFullName.Replace(fileName, "");
  2420. //this.serial.debug_hextoasciiConvert();
  2421. //출력 예제용 로직
  2422. // label1.Text = "File Name : " + fileName;
  2423. // label2.Text = "Full Name : " + fileFullName;
  2424. // label3.Text = "File Path : " + filePath;`
  2425. //File경로 + 파일명 리턴
  2426. //JT-NRDAS
  2427. tempchardata = MBIC_HeaderName.ToCharArray();
  2428. for (i = 0; i < tempchardata.Length; i++)
  2429. {
  2430. MBIC_Add_BootLoader_DataArray[i] = Convert.ToByte(tempchardata[i]);
  2431. }
  2432. MBIC_Add_BootLoader_DataArray[9] = 0x20; //file type : MBIC 0x20
  2433. MBIC_Add_BootLoader_DataArray[10] = 0x00; //file type : CPU 0x00
  2434. MBIC_Add_BootLoader_DataArray[11] = Convert.ToByte(numericUpDown_Version1.Text, 16);//version
  2435. MBIC_Add_BootLoader_DataArray[12] = Convert.ToByte(numericUpDown_Version2.Text, 16);//version
  2436. MBIC_Add_BootLoader_DataArray[13] = Convert.ToByte(numericUpDown_Version3.Text,16);//version
  2437. tempchardata = MBIC_HeaderFileName.ToCharArray();
  2438. for (i = 14; i < 14 + tempchardata.Length + 12; i++) // Total 41byte Filename
  2439. {
  2440. try
  2441. {
  2442. MBIC_Add_BootLoader_DataArray[i] = Convert.ToByte(tempchardata[i - 14]);
  2443. }
  2444. catch
  2445. {
  2446. MBIC_Add_BootLoader_DataArray[i] = 0x20;
  2447. }
  2448. }
  2449. tempchardata = s3.ToCharArray();
  2450. for (i = 55; i < 55 + tempchardata.Length / 2 ; i++)
  2451. {
  2452. MBIC_Add_BootLoader_DataArray[i] = DataToConvertHex(s3)[i - 55];
  2453. }
  2454. MBIC_BootLoader_DataArray = File.ReadAllBytes(Mbic_ofd.FileName);
  2455. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((MBIC_BootLoader_DataArray.Length & 0xFF000000) >> (8 * 3));
  2456. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((MBIC_BootLoader_DataArray.Length & 0x00FF0000) >> (8 * 2));
  2457. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((MBIC_BootLoader_DataArray.Length & 0x0000FF00) >> (8 * 1));
  2458. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((MBIC_BootLoader_DataArray.Length & 0x000000FF) >> (8 * 0));
  2459. Crcret = crc32( MBIC_BootLoader_DataArray, Convert.ToUInt32(MBIC_BootLoader_DataArray.Length));
  2460. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0xFF000000) >> (8 * 3));
  2461. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x00FF0000) >> (8 * 2));
  2462. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x0000FF00) >> (8 * 1));
  2463. MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x000000FF) >> (8 * 0));
  2464. for (i = 0; i < 59; i++)
  2465. MBIC_Add_BootLoader_DataArray[69 + i] = 0x00;
  2466. byte[] RetBinary = new byte[MBIC_Add_BootLoader_DataArray.Length + MBIC_BootLoader_DataArray.Length];
  2467. Array.Copy(MBIC_Add_BootLoader_DataArray, 0, RetBinary, 0, MBIC_Add_BootLoader_DataArray.Length);
  2468. Array.Copy(MBIC_BootLoader_DataArray, 0, RetBinary, MBIC_Add_BootLoader_DataArray.Length, MBIC_BootLoader_DataArray.Length);
  2469. System.IO.FileStream infile = new System.IO.FileStream(localpath+"\\" + MBIC_HeaderFileName, System.IO.FileMode.Create); //파일 스트림 선언
  2470. infile.Write(RetBinary, 0, RetBinary.Length); //쓰기d
  2471. infile.Close(); //꼭 닫아 주세요. 파일 입출력엔 엄청 중요하죠.
  2472. }
  2473. //취소버튼 클릭시 또는 ESC키로 파일창을 종료 했을경우
  2474. else if (dr == DialogResult.Cancel)
  2475. {
  2476. }
  2477. }
  2478. private void comboBox_BankSel_SelectedIndexChanged(object sender, EventArgs e)
  2479. {
  2480. byte[] temp_buf = new byte[9];
  2481. byte Length = 5;
  2482. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  2483. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_BankSelect;
  2484. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = 0;
  2485. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = 5;
  2486. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
  2487. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = Convert.ToByte(Convert.ToByte(comboBox_BankSel.SelectedIndex) + 1);
  2488. UInt16 CRCRET = crc.CRC16_Generate(temp_buf, Length);
  2489. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
  2490. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte(CRCRET & 0x00FF);
  2491. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = 0xeb;
  2492. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  2493. ReqTimer_Cnt = 0;
  2494. }
  2495. public IEnumerable<int> ExtractNumbers(string text)
  2496. {
  2497. text += " ";
  2498. var temp = string.Empty;
  2499. for (var i = 0; i < text.Length; i++)
  2500. {
  2501. if (char.IsDigit(text[i]))
  2502. {
  2503. if ('-'.Equals(text[i - 1]))
  2504. {
  2505. temp += text[i - 1];
  2506. }
  2507. temp += text[i];
  2508. }
  2509. else if (temp.Length > 0)
  2510. {
  2511. yield return int.Parse(temp);
  2512. temp = string.Empty;
  2513. }
  2514. }
  2515. }
  2516. private void button1_Click(object sender, EventArgs e)
  2517. {
  2518. label_CompileDate.Text = "";
  2519. byte[] temp_buf = new byte[TableGetMaxLength];
  2520. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  2521. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.BLUECELL_SOFTWARERESET;
  2522. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = Convert.ToByte((TableGetMaxLength - 4 & 0xFF00) >> 8);
  2523. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte((TableGetMaxLength - 4 & 0x00FF));
  2524. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
  2525. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = (byte)1;
  2526. UInt16 CRCRET = crc.CRC16_Generate(temp_buf, TableGetMaxLength - 4);
  2527. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
  2528. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte(CRCRET & 0x00FF);
  2529. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = 0xeb;
  2530. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  2531. ReqTimer_Cnt = 0;
  2532. }
  2533. private void button_FRBT_TimeSetting_Click(object sender, EventArgs e)
  2534. {
  2535. string Time = textBox_FRBT_TIME.Text;
  2536. string[] Timearray = Time.Split('-');
  2537. int i = 0;
  2538. byte[] Timedata = new byte[6 + 4 + 3]; //Header CRC 4byte TYPE LENGTH 3byte
  2539. Timedata[0] = 0xbe;
  2540. Timedata[1] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_TimeSetting;
  2541. Timedata[2] = 0;
  2542. Timedata[3] = (byte)(Timedata.Length - 4);
  2543. for (i = 0; i < 6; i++)
  2544. Timedata[4 + i] = Convert.ToByte(Timearray[i]);
  2545. UInt16 CRCRET = crc.CRC16_Generate(Timedata, Timedata[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
  2546. Timedata[4 + i++] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
  2547. Timedata[4 + i++] = Convert.ToByte(CRCRET & 0x00FF);
  2548. serial.Serial_DataSend(Timedata, Timedata.Length);
  2549. }
  2550. private void button_FactorySet_Click(object sender, EventArgs e)
  2551. {
  2552. byte[] tempdata = new byte[1 + 4 + 3]; //Header CRC 4byte TYPE LENGTH 3byte
  2553. tempdata[0] = 0xbe;
  2554. tempdata[1] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Factory_Set;
  2555. tempdata[2] = 0;
  2556. tempdata[3] = (byte)(tempdata.Length - 3);
  2557. tempdata[5] = 1;
  2558. UInt16 CRCRET = crc.CRC16_Generate(tempdata, tempdata[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
  2559. tempdata[6] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
  2560. tempdata[7] = Convert.ToByte(CRCRET & 0x00FF);
  2561. serial.Serial_DataSend(tempdata, tempdata.Length);
  2562. }
  2563. private void button_Carrier_Click(object sender, EventArgs e)
  2564. {
  2565. byte[] tempdata = new byte[1 + 4 + 3]; //Header CRC 4byte TYPE LENGTH 3byte
  2566. tempdata[0] = 0xbe;
  2567. tempdata[1] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_CarrierOnOff;
  2568. tempdata[2] = 0;
  2569. tempdata[3] = (byte)(tempdata.Length - 4);
  2570. tempdata[5] = 1;
  2571. UInt16 CRCRET = crc.CRC16_Generate(tempdata, tempdata[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
  2572. tempdata[6] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
  2573. tempdata[7] = Convert.ToByte(CRCRET & 0x00FF);
  2574. serial.Serial_DataSend(tempdata, tempdata.Length);
  2575. }
  2576. private void button_Carrier_OFF_Click(object sender, EventArgs e)
  2577. {
  2578. byte[] tempdata = new byte[1 + 4 + 3]; //Header CRC 4byte TYPE LENGTH 3byte
  2579. tempdata[0] = 0xbe;
  2580. tempdata[1] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_CarrierOnOff;
  2581. tempdata[2] = 0;
  2582. tempdata[3] = (byte)(tempdata.Length - 4);
  2583. tempdata[5] = 0;
  2584. UInt16 CRCRET = crc.CRC16_Generate(tempdata, tempdata[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
  2585. tempdata[6] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
  2586. tempdata[7] = Convert.ToByte(CRCRET & 0x00FF);
  2587. serial.Serial_DataSend(tempdata, tempdata.Length);
  2588. }
  2589. private void button_PATH_Ctrl_Click(object sender, EventArgs e)
  2590. {
  2591. byte[] temp_buf = new byte[BLUECELL_RESET_LENGTH];
  2592. Button button = (Button)sender;
  2593. DATATYPE datatype;
  2594. ReqTimer_Cnt = 0;
  2595. if (button.Text == "OFF")
  2596. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 1;
  2597. else
  2598. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
  2599. switch (button.Name)
  2600. {
  2601. case "button_DL1_PATH":
  2602. datatype = DATATYPE.ATT_DL1_PATH;
  2603. break;
  2604. case "button_DL2_PATH":
  2605. datatype = DATATYPE.ATT_DL2_PATH;
  2606. break;
  2607. case "button_DL3_PATH":
  2608. datatype = DATATYPE.ATT_DL3_PATH;
  2609. break;
  2610. case "button_DL4_PATH":
  2611. datatype = DATATYPE.ATT_DL4_PATH;
  2612. break;
  2613. case "button_UL1_PATH":
  2614. datatype = DATATYPE.ATT_UL1_PATH;
  2615. break;
  2616. case "button_UL2_PATH":
  2617. datatype = DATATYPE.ATT_UL2_PATH;
  2618. break;
  2619. case "button_UL3_PATH":
  2620. datatype = DATATYPE.ATT_UL3_PATH;
  2621. break;
  2622. case "button_UL4_PATH":
  2623. datatype = DATATYPE.ATT_UL4_PATH;
  2624. break;
  2625. case "button_SelfTest1":
  2626. datatype = DATATYPE.ATT_SelfTest;
  2627. break;
  2628. case "button_SelfTest2":
  2629. datatype = DATATYPE.ATT_SelfTest;
  2630. break;
  2631. case "button_SelfTest3":
  2632. datatype = DATATYPE.ATT_SelfTest;
  2633. break;
  2634. case "button_SelfTest4":
  2635. datatype = DATATYPE.ATT_SelfTest;
  2636. break;
  2637. case "button_DL_Shutdown":
  2638. datatype = DATATYPE.Bluecell_DLI_Shutdown_ON_OFF;
  2639. break;
  2640. case "button_UL_Shutdown":
  2641. datatype = DATATYPE.Bluecell_ULO_Shutdown_ON_OFF;
  2642. break;
  2643. case "button_ALC":
  2644. datatype = DATATYPE.Bluecell_ULO_ALC_ON_OFF;
  2645. break;
  2646. case "button_AGC":
  2647. datatype = DATATYPE.Bluecell_DLI_AGC_ON_OFF;
  2648. break;
  2649. case "button_Carrier":
  2650. datatype = DATATYPE.Bluecell_CarrierOnOff;
  2651. break;
  2652. case "button_TempShutdown":
  2653. datatype = DATATYPE.Bluecell_Temp_Shutdown_Path_ON_OFF;
  2654. break;
  2655. case "button_LedTest":
  2656. datatype = DATATYPE.Bluecell_LED_TEST;
  2657. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 1;
  2658. break;
  2659. case "button_FRBT_ONOFF":
  2660. datatype = DATATYPE.DLI_FRBT_ON_OFF;
  2661. break;
  2662. default:
  2663. MessageBox.Show("잘 못된 값 입니다. 확인 부탁드립니다.");
  2664. return;
  2665. }
  2666. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  2667. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
  2668. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = ((6 & 0xFF00) >> 8);
  2669. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = (6 & 0x00FF);
  2670. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
  2671. //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
  2672. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = 0;
  2673. UInt16 CRCRET = crc.CRC16_Generate(temp_buf, temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
  2674. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte((CRCRET & 0xFF00) >> 8);//CRC
  2675. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = Convert.ToByte(CRCRET & 0x00FF);//CRC
  2676. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  2677. }
  2678. private void panel_MainTitle_Paint(object sender, PaintEventArgs e)
  2679. {
  2680. /* LinearGradientBrush br = new LinearGradientBrush(this.ClientRectangle,
  2681. Color.FromArgb(50, 56, 203),
  2682. Color.FromArgb(70, 255, 255),
  2683. 180,
  2684. false);
  2685. e.Graphics.FillRectangle(br, this.ClientRectangle);*/
  2686. }
  2687. private void panel_Serial_Paint(object sender, PaintEventArgs e)
  2688. {
  2689. }
  2690. private Point mousePoint = new Point(0, 0);
  2691. private void panel_MainTitle_MouseMove(object sender, MouseEventArgs e)
  2692. {
  2693. if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
  2694. {
  2695. Location = new Point(this.Left - (mousePoint.X - e.X),
  2696. this.Top - (mousePoint.Y - e.Y));
  2697. }
  2698. /* if (e.Button == MouseButtons.Left)
  2699. {
  2700. this.Location = new Point(this.Location.X + (mCurrentPosition.X + e.X), this.Location.Y + (mCurrentPosition.Y + e.Y));
  2701. }*/
  2702. }
  2703. private void panel_MainTitle_DragEnter(object sender, DragEventArgs e)
  2704. {
  2705. /* if (e.Data.GetDataPresent(DataFormats.FileDrop))
  2706. {
  2707. e.Effect = DragDropEffects.All;
  2708. }
  2709. else
  2710. {
  2711. e.Effect = DragDropEffects.None;
  2712. }*/
  2713. }
  2714. private void panel_MainTitle_MouseDown(object sender, MouseEventArgs e)
  2715. {
  2716. mousePoint = new Point(e.X, e.Y);
  2717. }
  2718. private void button_Exit_Click(object sender, EventArgs e)
  2719. {
  2720. Process.GetCurrentProcess().Kill();
  2721. }
  2722. private void button_ManufactureSet_Click(object sender, EventArgs e)
  2723. {
  2724. byte[] temp_buf = new byte[10];
  2725. Button button = (Button)sender;
  2726. DATATYPE datatype;
  2727. ReqTimer_Cnt = 0;
  2728. char[] tempchardata;
  2729. string s3 = DateTime.Now.ToString("yyMMdd");
  2730. tempchardata = s3.ToCharArray();
  2731. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = DataToConvertHex(s3)[0];
  2732. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = DataToConvertHex(s3)[1];
  2733. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = DataToConvertHex(s3)[2];
  2734. datatype = DATATYPE.Bluecell_ManufactureDateSet;
  2735. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  2736. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
  2737. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = ((7 & 0xFF00) >> 8);
  2738. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = (7 & 0x00FF);
  2739. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
  2740. //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
  2741. UInt16 CRCRET = crc.CRC16_Generate(temp_buf, temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
  2742. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = Convert.ToByte((CRCRET & 0xFF00) >> 8);//CRC
  2743. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 4] = Convert.ToByte(CRCRET & 0x00FF);//CRC
  2744. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  2745. }
  2746. //Serial Number : BL-J37C00-20050004 Example
  2747. private void button_SerialNumverSet_Click(object sender, EventArgs e)
  2748. {
  2749. byte[] temp_buf = new byte[26];
  2750. int i = 0;
  2751. Button button = (Button)sender;
  2752. DATATYPE datatype;
  2753. ReqTimer_Cnt = 0;
  2754. char[] data = textBox_SerialNumber.Text.ToCharArray();
  2755. //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = textBox_SerialNumber.Text.Split();
  2756. datatype = DATATYPE.Bluecell_SerialNumberSet;
  2757. for (i = 0; i < data.Length; i++)
  2758. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i] = (Byte)data[i];
  2759. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  2760. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
  2761. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = ((23 & 0xFF00) >> 8);
  2762. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = (23 & 0x00FF);
  2763. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
  2764. //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
  2765. UInt16 CRCRET = crc.CRC16_Generate(temp_buf, temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
  2766. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i++] = Convert.ToByte((CRCRET & 0xFF00) >> 8);//CRC
  2767. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i++] = Convert.ToByte(CRCRET & 0x00FF);//CRC
  2768. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  2769. }
  2770. private void button_PCBVersionSet_Click(object sender, EventArgs e)
  2771. {
  2772. byte[] temp_buf = new byte[9];
  2773. int i = 0;
  2774. Button button = (Button)sender;
  2775. DATATYPE datatype;
  2776. ReqTimer_Cnt = 0;
  2777. string[] data = textBox_PcbVersion.Text.Split('.');
  2778. //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = textBox_SerialNumber.Text.Split();
  2779. datatype = DATATYPE.Bluecell_PCBVersionSet;
  2780. for (i = 0; i < data.Length; i++)
  2781. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i] = Convert.ToByte(data[i]);
  2782. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
  2783. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
  2784. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = ((6 & 0xFF00) >> 8);
  2785. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = (6 & 0x00FF);
  2786. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
  2787. //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
  2788. UInt16 CRCRET = crc.CRC16_Generate(temp_buf, temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
  2789. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i++] = Convert.ToByte((CRCRET & 0xFF00) >> 8);//CRC
  2790. temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i++] = Convert.ToByte(CRCRET & 0x00FF);//CRC
  2791. serial.Serial_DataSend(temp_buf, temp_buf.Length);
  2792. }
  2793. }
  2794. class AutoClosingMessageBox
  2795. {
  2796. [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
  2797. static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
  2798. [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
  2799. static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
  2800. System.Threading.Timer _timeoutTimer; //쓰레드 타이머
  2801. string _caption;
  2802. const int WM_CLOSE = 0x0010; //close 명령
  2803. AutoClosingMessageBox(string text, string caption, int timeout)
  2804. {
  2805. _caption = caption;
  2806. _timeoutTimer = new System.Threading.Timer(OnTimerElapsed,
  2807. null, timeout, System.Threading.Timeout.Infinite);
  2808. MessageBox.Show(text, caption);
  2809. }
  2810. //생성자 함수
  2811. public static void Show(string text, string caption, int timeout)
  2812. {
  2813. new AutoClosingMessageBox(text, caption, timeout);
  2814. }
  2815. //시간이 다되면 close 메세지를 보냄
  2816. void OnTimerElapsed(object state)
  2817. {
  2818. IntPtr mbWnd = FindWindow(null, _caption);
  2819. if (mbWnd != IntPtr.Zero)
  2820. SendMessage(mbWnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
  2821. _timeoutTimer.Dispose();
  2822. }
  2823. }
  2824. }