1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202 |
-
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.IO.Ports;
- using System.Linq;
- using System.Runtime.InteropServices;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows.Forms;
- //Add
- using System.Reflection;
- using Excel = Microsoft.Office.Interop.Excel;
- using static Jdas_Mbic.Bluecell_BootProtocol;
- using System.Threading;
- using System.IO;
- using System.Windows.Forms.DataVisualization.Charting;
- using System.Text.RegularExpressions;
- using System.Diagnostics;
- using System.Drawing.Drawing2D;
- namespace Jdas_Mbic
- {
-
- public partial class JdasMbic : Form
- {
- public const double Table_Dbm_DefaultValue = 0;//31.5;
- public const int Table_DL_DefaultValue = 7;
- public const int Table_UL_DefaultValue = -15;
- public const int Table_Temp_DefaultValue = -10;
- public Serial serial = new Serial(); // Uart Open
- const byte ALARM_DLI_P4_LEVEL_LOW = 0x80;
- const byte ALARM_DLI_P3_LEVEL_LOW= 0x40;
- const byte ALARM_DLI_P2_LEVEL_LOW= 0x20;
- const byte ALARM_DLI_P1_LEVEL_LOW= 0x10;
- const byte ALARM_DLI_P4_LEVEL_HIGH= 0x08;
- const byte ALARM_DLI_P3_LEVEL_HIGH= 0x04;
- const byte ALARM_DLI_P2_LEVEL_HIGH= 0x02;
- const byte ALARM_DLI_P1_LEVEL_HIGH = 0x01;
- const byte ALARM_AGC_P4 = 0x80;
- const byte ALARM_AGC_P3 =0x40;
- const byte ALARM_AGC_P2 =0x20;
- const byte ALARM_AGC_P1 =0x10;
- const byte ALARM_DLI_SHUTDOWN_P4 = 0x08;
- const byte ALARM_DLI_SHUTDOWN_P3 = 0x04;
- const byte ALARM_DLI_SHUTDOWN_P2 = 0x02;
- const byte ALARM_DLI_SHUTDOWN_P1 = 0x01;
- const byte ALARM_ULO_P4_LEVEL_HIGH = 0x08;
- const byte ALARM_ULO_P3_LEVEL_HIGH = 0x04;
- const byte ALARM_ULO_P2_LEVEL_HIGH = 0x02;
- const byte ALARM_ULO_P1_LEVEL_HIGH = 0x01;
- const byte ALARM_ALC_P4 = 0x80;
- const byte ALARM_ALC_P3 = 0x40;
- const byte ALARM_ALC_P2 = 0x20;
- const byte ALARM_ALC_P1 = 0x10;
- const byte ALARM_ULO_SHUTDOWN_P4 = 0x08;
- const byte ALARM_ULO_SHUTDOWN_P3 = 0x04;
- const byte ALARM_ULO_SHUTDOWN_P2 = 0x02;
- const byte ALARM_ULO_SHUTDOWN_P1 = 0x01;
- public enum DLUL_Category
- {
- DL_DET = 0,
- UL_DET
- };
- enum Bluecell_CardType_t
- {
- BLUECELL_3_7G = 0,
- BLUECELL_3_8G,
- BLUECELL_3_9G,
- BLUECELL_4_0G,
- BLUECELL_4_1G,
- BLUECELL_4_6G,
- BLUECELL_SBM,
- BLUECELL_DCM,
- BLUECELL_KDDI,
- BLUECELL_4_7G,
- BLUECELL_4_8G,
- BLUECELL_4_9G,
- BLUECELL_5_0G,
- };
- enum HFR_CardType_t
- {
- MBIC_3_7G = 0x80,
- MBIC_3_8G = 0x81,
- MBIC_3_9G = 0x82,
- MBIC_4_0G = 0x83,
- MBIC_4_1G = 0x84,
- MBIC_4_6G = 0x85,
- MBIC_4_7G = 0x86,
- MBIC_4_8G = 0x87,
- MBIC_4_9G = 0x88,
- MBIC_5_0G = 0x89,
- MBIC_DCM = 0x8A,
- MBIC_SBM = 0x8B,
- MBIC_KDDI = 0x8C
- }
- public enum MBIC_TableNumber
- {
- DLI_P1_Level_Table_Number = 0x00,
- DLI_P2_Level_Table_Number = 0x01,
- DLI_P3_Level_Table_Number = 0x02,
- DLI_P4_Level_Table_Number = 0x03,
- ULO_P1_Level_Table_Number = 0x10,
- ULO_P2_Level_Table_Number = 0x11,
- ULO_P3_Level_Table_Number = 0x12,
- ULO_P4_Level_Table_Number = 0x13,
- DLI_P1_ATT_Temp_guarantee_Table_Number = 0x20,
- DLI_P2_ATT_Temp_guarantee_Table_Number = 0x21,
- DLI_P3_ATT_Temp_guarantee_Table_Number = 0x22,
- DLI_P4_ATT_Temp_guarantee_Table_Number = 0x23,
- ULO_P1_ATT_Temp_guarantee_Table_Number = 0x30,
- ULO_P2_ATT_Temp_guarantee_Table_Number = 0x31,
- ULO_P3_ATT_Temp_guarantee_Table_Number = 0x32,
- ULO_P4_ATT_Temp_guarantee_Table_Number = 0x33,
- DLI_P1_ATT_Accuracy_Table_Number = 0x40,
- DLI_P2_ATT_Accuracy_Table_Number = 0x41,
- DLI_P3_ATT_Accuracy_Table_Number = 0x42,
- DLI_P4_ATT_Accuracy_Table_Number = 0x43,
- ULO_P1_ATT_Accuracy_Table_Number = 0x50,
- ULO_P2_ATT_Accuracy_Table_Number = 0x51,
- ULO_P3_ATT_Accuracy_Table_Number = 0x52,
- ULO_P4_ATT_Accuracy_Table_Number = 0x53,
- }
-
- public JdasMbic()
- {
- InitializeComponent();
-
- }
- DataTable table = new DataTable();
- private void JdasMbic_Load(object sender, EventArgs e)
- {
- serial.Serial_Main_Form_Get(this);
- serial.Serial_Initialize(ref comboBox_Port);
- }
- Hidden hidden = new Hidden();
- protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
- {
- Keys key = keyData & ~(Keys.Shift | Keys.Control);
- hidden = new Hidden();
- hidden.Owner = this; //부모값넘김
- switch (key)
- {
- case Keys.F:
- // 조합키 사용 시
- if ((keyData & Keys.Control) != 0)
- {
- MessageBox.Show("Ctrl+F8");
- }
- break;
- case Keys.F8:
- // 단일키 사용시
- hidden.Show();
- hidden.main = this;
- //MessageBox.Show("f8");
- break;
- default:
- //MessageBox.Show("지정되지 않은 키입니다.");
- return base.ProcessCmdKey(ref msg, keyData);
- }
- return true;
- }
-
- private void dataGridView_TableSetting_CellClick(object sender, DataGridViewCellEventArgs e)
- {
- }
- /*
- *
- * TABLE Setting Area
- *
- */
- // Bluecell_Serial bluecellserial = new Bluecell_Serial();
- public void button_PortOpen_Click(object sender, EventArgs e)
- {
- byte ret = 0;
- ret = serial.Serial_PortOpen(ref button_PortOpen, ref comboBox_Port);
- Serial_connectiondisable(ret);
- if (ret == 0 && timer_JdasMbic.Enabled == false)
- {
- timer_JdasMbic.Start(); //타이머를 발동시킨다.
- }
- else if (timer_JdasMbic.Enabled == true)
- {
- timer_JdasMbic.Stop(); //타이머를 멈춘다.
- }
- else
- {
- /*NOP*/
- }
-
-
- serial.Serial_Main_Form_Get(this);
- }
- private void button_terminal_Click(object sender, EventArgs e)
- {
- serial.Serial_TerminalOpen(serial);
- }
-
-
- public bool Serial_connectiondisable(byte on_off)
- {
- if (on_off != 2)
- {
- comboBox_Port.Enabled = Convert.ToBoolean(on_off);
- comboBox_baudrate.Enabled = Convert.ToBoolean(on_off);
- }
- else
- {
- return false;
- }
- return Convert.ToBoolean(on_off);
- }
- public bool TX_RX_Light = false;
- private delegate void StringSend(object label, String str);
- private delegate void SWVisible(object label, bool set);
- private delegate void GridviewSend(ref object gridview, string Text);
- private delegate void ByteSend(byte[] Text);
- private delegate String Stringreturn(object combobox);
- int offset = 0;
- byte[] rxBuffer;
- #if false
- private void sPort_DataReceived(object sender, SerialDataReceivedEventArgs e)
- {
- string startStr = "V";
- string endStr = "\n";
- try
- {
- if (offset == 0)
- {
- rxBuffer = new byte[4096];
- }
- string rxString = "";
- int intRecSize = serialPort_JdasMbic.BytesToRead;
- if (intRecSize != 0)
- {
- /* if (panel_GpsTest.Visible == true)
- {
- byte[] btdata = new byte[intRecSize];
- serialPort_JdasMbic.Read(btdata, 0, intRecSize);
- string data = Encoding.Default.GetString(rxBuffer);
- this.Invoke(new StringSend(Data_Recv_Str), data);
- }
- else*/
- {
- serialPort_JdasMbic.Read(rxBuffer, offset, intRecSize);
- offset += intRecSize;
- for (int iTemp = 0; iTemp < offset; iTemp++)
- {
- rxString += Convert.ToChar(rxBuffer[iTemp]);
- }
- /*
- *
- * Example
- * if (panel_SensorTest.Visible == true)
- {
- startStr = "V";
- endStr = "\n";
- }
- else if (panel_Catm1Test.Visible == true)
- {
- startStr = "B";
- endStr = "\n";
- }
- else if (panel_GpsTest.Visible == true)
- {
- startStr = "$";
- endStr = "\n";
- }
-
- */
- if (rxString.Contains(startStr))
- {
- rxString = rxString.Substring(rxString.IndexOf(startStr));
- if (rxString.Contains(endStr))
- {
- this.Invoke(new StringSend(Data_Recv_Str), rxString);
- //program.dataReceived(rxString, "Receive");
- offset = 0;
- }
- }
- else
- {
- this.Invoke(new StringSend(Data_Recv_Str), rxString);
- offset = 0;
- }
- }
- }
- }
- catch { }
- }
- #endif
- int LineLimit = 500;
- [DllImport("user32.dll")]
- public static extern int SendMessage(IntPtr hWnd, Int32 wMsg, bool wParam, Int32 lParam);
- private const int WM_SETREDRAW = 11;
- public void Data_Recv_Str(string text)
- {
- System.Windows.Forms.RichTextBox tbReceived = null;
- //tbReceived = richTextBox_Sensor;
- int nLimitLines = Convert.ToInt32(LineLimit); //제한 라인 수
- try
- {
- try
- {
- SendMessage(this.Handle, WM_SETREDRAW, false, 0);
- }
- catch (Exception e) { MessageBox.Show(e.StackTrace); }
- if (tbReceived.Lines.Length > nLimitLines)
- {
- LinkedList<string> tempLines = new LinkedList<string>(tbReceived.Lines);
- while ((tempLines.Count - nLimitLines) > 0)
- {
- tempLines.RemoveFirst();
- }
- tbReceived.Lines = tempLines.ToArray();
- }
- try
- {
- SendMessage(this.Handle, WM_SETREDRAW, true, 0);
- }
- catch { return; }
- /* Example
- if (panel_SensorTest.Visible == true)
- {
- Sensor_TestFunc(text);
- tbReceived.AppendText(text);
- }
- else
- {
- tbReceived.AppendText(text);
- }
- */
-
- tbReceived.SelectionStart = tbReceived.Text.Length;//맨 마지막 선택...
- tbReceived.ScrollToCaret();
- }
- catch { try { SendMessage(this.Handle, WM_SETREDRAW, true, 0); } catch { return; } }
- }
- public void Data_Recv_Str(byte[] text)
- {
- string strtext = Encoding.Default.GetString(text);
- System.Windows.Forms.RichTextBox tbReceived = null;
-
- // tbReceived = richTextBox_Sensor;
- int nLimitLines = Convert.ToInt32(LineLimit); //제한 라인 수
- try
- {
- try
- {
- SendMessage(this.Handle, WM_SETREDRAW, false, 0);
- }
- catch (Exception e) { MessageBox.Show(e.StackTrace); }
- if (tbReceived.Lines.Length > nLimitLines)
- {
- LinkedList<string> tempLines = new LinkedList<string>(tbReceived.Lines);
- while ((tempLines.Count - nLimitLines) > 0)
- {
- tempLines.RemoveFirst();
- }
- tbReceived.Lines = tempLines.ToArray();
- }
- try
- {
- SendMessage(this.Handle, WM_SETREDRAW, true, 0);
- }
- catch { return; }
- /* Example
- if (panel_SensorTest.Visible == true)
- {
- Sensor_TestFunc(strtext);
- tbReceived.AppendText(strtext);
- }
- else
- {
- tbReceived.AppendText(strtext);
- }
- */
- tbReceived.SelectionStart = tbReceived.Text.Length;//맨 마지막 선택...
- tbReceived.ScrollToCaret();
- }
- catch { try { SendMessage(this.Handle, WM_SETREDRAW, true, 0); } catch { return; } }
- }
- Int64 Timer_Cnt = 0;
- public Int32 ReqTimer_Cnt = 0;
- Bluecell_BootProtocol bluecell_BootProtocol = new Bluecell_BootProtocol();
- private void timer1_Tick(object sender, EventArgs e)
- {
- Update_Serial update_Serial = null;
- bool req_set = false;
- if (update_Serial == null)
- {
- update_Serial = (Update_Serial)serial.FileDownloadClass_Get();
- if (update_Serial == null)
- req_set = true;
- else if (update_Serial.Update_ready == false)
- req_set = true;
- }
- if (req_set)
- {
- ReqTimer_Cnt++;
- }
- if (TX_RX_Light == true)
- {
- Timer_Cnt++;
- }
- if (Timer_Cnt < 1000)
- {
- if (this.pictureBox_G_TX.Visible == true)
- {
- TX_Light_OFF();
- }
- if (this.pictureBox_G_RX.Visible == true)
- {
- RX_Light_OFF();
- }
- Timer_Cnt = 0;
- TX_RX_Light = false;
- }
- if (ReqTimer_Cnt > 6)
- {
- bluecell_BootProtocol.Bluecell_RF_Status_Req(serial);
- ReqTimer_Cnt = 0;
- }
- }
-
- Update_Serial file = new Update_Serial();
- private void button_FirmwareUpdate_Click(object sender, EventArgs e)
- {
- OpenFileDialog ofd = new OpenFileDialog();
- //FileDownload file = new FileDownload();
- file.ShowFileOpenDialog(ref serial, ofd);
- }
- public void TX_Light_ON()
- {
- this.pictureBox_G_TX.Visible = true;
- this.pictureBox_R_TX.Visible = false;
- }
- public void TX_Light_OFF()
- {
- this.pictureBox_R_TX.Visible = true;
- this.pictureBox_G_TX.Visible = false;
- }
- public void RX_Light_ON()
- {
- this.pictureBox_G_RX.Visible = true;
- this.pictureBox_R_RX.Visible = false;
- }
- public void RX_Light_OFF()
- {
- this.pictureBox_R_RX.Visible = true;
- this.pictureBox_G_RX.Visible = false;
- }
- const byte BLUECELL_RESET_LENGTH = 9;
- public const byte BLUECELL_HEADER = 0xBE;
- public const byte BLUECELL_TAILER = 0xEB;
-
- const byte BLUECELL_ATTEN_LENGTH = 32 + 5;
- #if false
- private void button_ATT_Click_1(object sender, EventArgs e)
- {
- byte[] temp_buf = new byte[BLUECELL_ATTEN_LENGTH];
- Button btn = (Button)sender;
- byte datatype = (byte)Bluecell_BootProtocol.DATATYPE.ATTSET;
- Int16[] DL = new Int16[4];
- Int16[] UL = new Int16[4];
- Int16[] ALC_MAX = new Int16[4];
- Int16[] ALC_MIN = new Int16[4];
- byte tmp_H = 0;
- byte tmp_L = 0;
- DL[0] = Convert.ToInt16(numericUpDown_ATT_DL1.Value * 10);
- DL[1] = Convert.ToInt16(numericUpDown_ATT_DL2.Value * 10);
- DL[2] = Convert.ToInt16(numericUpDown_ATT_DL3.Value * 10);
- DL[3] = Convert.ToInt16(numericUpDown_ATT_DL4.Value * 10);
- UL[0] = Convert.ToInt16(numericUpDown_ATT_UL1.Value * 10);
- UL[1] = Convert.ToInt16(numericUpDown_ATT_UL2.Value * 10);
- UL[2] = Convert.ToInt16(numericUpDown_ATT_UL3.Value * 10);
- UL[3] = Convert.ToInt16(numericUpDown_ATT_UL4.Value * 10);
- /*ALC_MAX[0] = Convert.ToInt16(numericUpDown_ALC1_MAX.Value * 10);
- ALC_MAX[1] = Convert.ToInt16(numericUpDown_ALC2_MAX.Value * 10);
- ALC_MAX[2] = Convert.ToInt16(numericUpDown_ALC3_MAX.Value * 10);
- ALC_MAX[3] = Convert.ToInt16(numericUpDown_ALC4_MAX.Value * 10);
- ALC_MIN[0] = Convert.ToInt16(numericUpDown_ALC1_MIN.Value * 10);
- ALC_MIN[1] = Convert.ToInt16(numericUpDown_AGC2_MIN.Value * 10);
- ALC_MIN[2] = Convert.ToInt16(numericUpDown_AGC3_MIN.Value * 10);
- ALC_MIN[3] = Convert.ToInt16(numericUpDown_AGC4_MIN.Value * 10);
- */
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length] = 6;
- for (int i = 0; i < 4; i++)
- {
- tmp_H = Convert.ToByte((DL[i] & 0xFF00) >> 8);
- tmp_L = Convert.ToByte((DL[i] & 0x00FF));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2] = tmp_H;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2 + 1] = tmp_L;
- }
- for (int i = 4; i < 8; i++)
- {
- tmp_H = Convert.ToByte((UL[i - 4] & 0xFF00) >> 8);
- tmp_L = Convert.ToByte((UL[i - 4] & 0x00FF));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2] = tmp_H;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2 + 1] = tmp_L;
- }
- for (int i = 8; i < 12; i++)
- {
- tmp_H = Convert.ToByte((ALC_MAX[i - 8] & 0xFF00) >> 8);
- tmp_L = Convert.ToByte((ALC_MAX[i - 8] & 0x00FF));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2] = tmp_H;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2 + 1] = tmp_L;
- }
- for (int i = 12; i < 16; i++)
- {
- tmp_H = Convert.ToByte((ALC_MIN[i - 12] & 0xFF00) >> 8);
- tmp_L = Convert.ToByte((ALC_MIN[i - 12] & 0x00FF));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2] = tmp_H;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i * 2 + 1] = tmp_L;
- }
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 16 * 2] = 1; //CRC
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- ReqTimer_Cnt = 0;
- }
- #endif
- private void button_ATT_Click_2(object sender, EventArgs e)
- {
- Crc16 crc = new Crc16();
- byte[] temp_buf = new byte[TableGetMaxLength];
- NumericUpDown numeric = (NumericUpDown)sender;
- byte tmp_H = 0;
- byte tmp_L = 0;
- UInt16 Length = TableGetMaxLength - 3;
- Int16 UserData = 0;
- if (numeric.Name == "numericUpDown_Path1_GainValue"
- || numeric.Name == "numericUpDown_Path2_GainValue"
- || numeric.Name == "numericUpDown_Path3_GainValue"
- || numeric.Name == "numericUpDown_Path4_GainValue")
- {
- UserData = Convert.ToInt16(numeric.Value);
- }
- else
- {
- UserData = Convert.ToInt16(numeric.Value * 10);
- }
-
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = Convert.ToByte((Length & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte(Length & 0x00FF);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
- tmp_H = Convert.ToByte((UserData & 0xFF00) >> 8);
- tmp_L = Convert.ToByte((UserData & 0x00FF));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = tmp_H;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = tmp_L;
- switch (numeric.Name)
- {
- case "numericUpDown_ATT_DL1":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL1;
- break;
- case "numericUpDown_ATT_DL2":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL2;
- break;
- case "numericUpDown_ATT_DL3":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL3;
- break;
- case "numericUpDown_ATT_DL4":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL4;
- break;
- case "numericUpDown_ATT_UL1":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL1;
- break;
- case "numericUpDown_ATT_UL2":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL2;
- break;
- case "numericUpDown_ATT_UL3":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL3;
- break;
- case "numericUpDown_ATT_UL4":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL4;
- break;
- case "numericUpDown_DL1_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL1_USER;
- break;
- case "numericUpDown_DL2_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL2_USER;
- break;
- case "numericUpDown_DL3_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL3_USER;
- break;
- case "numericUpDown_DL4_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_DL4_USER;
- break;
- case "numericUpDown_UL1_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL1_USER;
- break;
- case "numericUpDown_UL2_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL2_USER;
- break;
- case "numericUpDown_UL3_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL3_USER;
- break;
- case "numericUpDown_UL4_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ATT_UL4_USER;
- break;
- case "numericUpDown_Path1_GainValue":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Path1_GainValue;
- break;
- case "numericUpDown_Path2_GainValue":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Path2_GainValue;
- break;
- case "numericUpDown_Path3_GainValue":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Path3_GainValue;
- break;
- case "numericUpDown_Path4_GainValue":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Path4_GainValue;
- break;
- case "numericUpDown_DLI_FRBT_D_Day":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] /= 10;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_FRBT_DaySetting;
- break;
- }
- UInt16 CRCRET = crc.CRC16_Generate(temp_buf, Length );
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = Convert.ToByte(CRCRET & 0x00FF);
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- ReqTimer_Cnt = 0;
- }
-
-
- enum BluecellReqIndex{
- bluecell_header,
- bluecell_type,
- bluecell_length,
- bluecell_crcindex,
- Path1_GainValue,
- Path2_GainValue,
- Path3_GainValue,
- Path4_GainValue,
- ATT_DL1_PATH,
- ATT_DL2_PATH,
- ATT_DL3_PATH,
- ATT_DL4_PATH,
- ATT_UL1_PATH,
- ATT_UL2_PATH,
- ATT_UL3_PATH,
- ATT_UL4_PATH,
- ATT_DL1_H,
- ATT_DL1_L,
- ATT_DL2_H,
- ATT_DL2_L,
- ATT_DL3_H,
- ATT_DL3_L,
- ATT_DL4_H,
- ATT_DL4_L,
- ATT_UL1_H,
- ATT_UL1_L,
- ATT_UL2_H,
- ATT_UL2_L,
- ATT_UL3_H,
- ATT_UL3_L,
- ATT_UL4_H,
- ATT_UL4_L,
- ULO_P1_Level1_H,
- ULO_P1_Level1_L,
- ULO_P2_Level2_H,
- ULO_P2_Level2_L,
- ULO_P3_Level3_H,
- ULO_P3_Level3_L,
- ULO_P4_Level4_H,
- ULO_P4_Level4_L,
- DLI_P1_Level1_H,
- DLI_P1_Level1_L,
- DLI_P2_Level2_H,
- DLI_P2_Level2_L,
- DLI_P3_Level3_H,
- DLI_P3_Level3_L,
- DLI_P4_Level4_H,
- DLI_P4_Level4_L,
- DET_TEMP,
- DLI_AGC_ON_OFF,
- ULO_ALC_ON_OFF,
- ULO_Level1_H,
- ULO_Level1_L,
- ULO_Level2_H,
- ULO_Level2_L,
- ULO_Level3_H,
- ULO_Level3_L,
- ULO_Level4_H,
- ULO_Level4_L,
- DLI_Level1_H,
- DLI_Level1_L,
- DLI_Level2_H,
- DLI_Level2_L,
- DLI_Level3_H,
- DLI_Level3_L,
- DLI_Level4_H,
- DLI_Level4_L,
- ULO_ALC_Threshold_H,
- ULO_ALC_Threshold_L,
- bluecell_User_DL1_H,
- bluecell_User_DL1_L,
- bluecell_User_DL2_H,
- bluecell_User_DL2_L,
- bluecell_User_DL3_H,
- bluecell_User_DL3_L,
- bluecell_User_DL4_H,
- bluecell_User_DL4_L,
- bluecell_User_UL1_H,
- bluecell_User_UL1_L,
- bluecell_User_UL2_H,
- bluecell_User_UL2_L,
- bluecell_User_UL3_H,
- bluecell_User_UL3_L,
- bluecell_User_UL4_H,
- bluecell_User_UL4_L,
- bluecell_User_TEMP_H,
- bluecell_User_TEMP_L,
- bluecell_User_TEMP_OFFSET,
- Temp_High_Threshold,
- Temp_High_Threshold_Default,
- DLI_Level_High_Threshold_H,
- DLI_Level_High_Threshold_L,
- DLI_Level_Low_Threshold_H,
- DLI_Level_Low_Threshold_L,
- DLI_Level_High_Low_Threshold_default,
- ALARM_TEMP_HIGH, //bit
- ALARM_DLI_Level,
- ALARM_DLI_SHTUTDOWN,
- ALARM_DLI_AGC_Alarm,
- ALARM_ULO_ALC_Alarm,
- ALARM_ULO_Level,
- ALARM_ULO_SHTUTDOWN,
- ALARM_MASK1,
- ALARM_MASK2,
- ALARM_MASK3,
- ALARM_MASK4,
- ALARM_MASK5,
- ALARM_TESTMODE,
- ALARM_Test_Dummy1,
- ALARM_Test_Dummy2,
- ALARM_Test_Dummy3,
- ALARM_Test_Dummy4,
- ALARM_Test_Dummy5,
- CPUVERSION1,
- CPUVERSION2,
- CPUVERSION3,
- CPU_Current_Bank,
- CPU_Bank_Select,//Reboot_by,
- CPU_Bank1_Image_Version1,
- CPU_Bank1_Image_Version2,
- CPU_Bank1_Image_Version3,
- CPU_Bank1_Image_BuildTime1,
- CPU_Bank1_Image_BuildTime2,
- CPU_Bank1_Image_BuildTime3,
- CPU_Bank1_Image_BuildTime4,
- CPU_Bank1_Image_BuildTime5,
- CPU_Bank1_Image_BuildTime6,
- CPU_Bank1_Image_Name,
- CPU_Bank2_Image_Version1 = CPU_Bank1_Image_Name +32,
- CPU_Bank2_Image_Version2,
- CPU_Bank2_Image_Version3,
- CPU_Bank2_Image_BuildTime1,
- CPU_Bank2_Image_BuildTime2,
- CPU_Bank2_Image_BuildTime3,
- CPU_Bank2_Image_BuildTime4,
- CPU_Bank2_Image_BuildTime5,
- CPU_Bank2_Image_BuildTime6,
- CPU_Bank2_Image_Name,
- S_W_Reset= CPU_Bank2_Image_Name + 32,
- Factory_Set_Initialization,
- Temp_High_Alarm,
- LED_TEST,
- NODE,
- Type,
- PCB_Version,
- Serial_Number = PCB_Version + 2, // INDEX : 20
- Manufacture = Serial_Number +20,
- Manufacture_Date,
- Freq_ID = Manufacture_Date + 3,
- Carrier_ID,
- Carrier_ON_OFF,
- DLI_Level_High_Alarm1,
- DLI_Level_High_Alarm2,
- DLI_Level_High_Alarm3,
- DLI_Level_High_Alarm4,
- DLI_Level_Low_Alarm1,
- DLI_Level_Low_Alarm2,
- DLI_Level_Low_Alarm3,
- DLI_Level_Low_Alarm4,
- DLI_FRBT_Atten1_H,
- DLI_FRBT_Atten1_L,
- DLI_FRBT_Atten2_H,
- DLI_FRBT_Atten2_L,
- DLI_FRBT_Atten3_H,
- DLI_FRBT_Atten3_L,
- DLI_FRBT_Atten4_H,
- DLI_FRBT_Atten4_L,
- DLI_FRBT_D_Day,
- DLI_FRBT_Status,
- DLI_FRBT_ON_OFF,
- DLI_AGC_Threshold_H,
- DLI_AGC_Threshold_L,
- DLI_AGC_Threshold_default,
- DLI_Shutdown_ON_OFF,
- DLI_Shutdown_Threshold_H,
- DLI_Shutdown_Threshold_L,
- DLI_Shutdown_Threshold_Default,
- DLI_Shutdown_Retry_Count1,
- DLI_Shutdown_Retry_Count2,
- DLI_Shutdown_Retry_Count3,
- DLI_Shutdown_Retry_Count4,
- DLI_AGC_Alarm1,
- DLI_AGC_Alarm2,
- DLI_AGC_Alarm3,
- DLI_AGC_Alarm4,
- DLI_Shutdown_Alarm1,
- DLI_Shutdown_Alarm2,
- DLI_Shutdown_Alarm3,
- DLI_Shutdown_Alarm4,
- ULO_Level_High_Threshold_H,
- ULO_Level_High_Threshold_L,
- ULO_Level_High_Threshold_default,
- ULO_Level_High_Alarm1,
- ULO_Level_High_Alarm2,
- ULO_Level_High_Alarm3,
- ULO_Level_High_Alarm4,
- ULO_ALC_Threshold_Default,
- ULO_Shutdown_ON_OFF,
- ULO_Shutdown_Threshold_H,
- ULO_Shutdown_Threshold_L,
- ULO_Shutdown_Threshold_Default,
- ULO_Shutdown_Retry_Count1,
- ULO_Shutdown_Retry_Count2,
- ULO_Shutdown_Retry_Count3,
- ULO_Shutdown_Retry_Count4,
- ULO_ALC_Alarm1,
- ULO_ALC_Alarm2,
- ULO_ALC_Alarm3,
- ULO_ALC_Alarm4,
- ULO_Shutdown_Alarm1,
- ULO_Shutdown_Alarm2,
- ULO_Shutdown_Alarm3,
- ULO_Shutdown_Alarm4,
- MBIC_ULO_ALC_Atten1_H,
- MBIC_ULO_ALC_Atten1_L,
- MBIC_ULO_ALC_Atten2_H,
- MBIC_ULO_ALC_Atten2_L,
- MBIC_ULO_ALC_Atten3_H,
- MBIC_ULO_ALC_Atten3_L,
- MBIC_ULO_ALC_Atten4_H,
- MBIC_ULO_ALC_Atten4_L,
- DL_Det_ALL_Offset,
- MBIC_Download_Auto_Restart_Set,
- Path_TempSave_Bit,/*DL1 / DL 2 /DL3 /DL4 /UL1/UL2/UL3/UL4*/
- Path_TempShutdown_Set,/*DL1 / DL 2 /DL3 /DL4 /UL1/UL2/UL3/UL4*/
- SelfTest,
- SelfTest_ATT_DL1_H,
- SelfTest_ATT_DL1_L,
- SelfTest_ATT_DL2_H,
- SelfTest_ATT_DL2_L,
- SelfTest_ATT_DL3_H,
- SelfTest_ATT_DL3_L,
- SelfTest_ATT_DL4_H,
- SelfTest_ATT_DL4_L,
- SelfTest_ATT_UL1_H,
- SelfTest_ATT_UL1_L,
- SelfTest_ATT_UL2_H,
- SelfTest_ATT_UL2_L,
- SelfTest_ATT_UL3_H,
- SelfTest_ATT_UL3_L,
- SelfTest_ATT_UL4_H,
- SelfTest_ATT_UL4_L,
- Reserve = SelfTest_ATT_UL4_L + 15,
- /**/
- bluecell_crc_H,
- bluecell_crc_L,
- bluecell_etx,
- };
- const byte Reqdatastartindex = 4;
- //private delegate void StringSend(object label, String str);
- private void Numeric_Text_Set(object label, String str)
- {
- NumericUpDown Temp_label = (NumericUpDown)label;
- Temp_label.Text = str;
- }
- private void TextBox_Text_Set(object label, String str)
- {
- TextBox Temp_label = (TextBox)label;
- Temp_label.Text = str;
- }
- private void String_Text_Set(object label, String str)
- {
- String Temp_label = (String)label;
- Temp_label = str;
- }
- private void Label_Text_Set(object label, String str)
- {
- Label Temp_label = (Label)label;
- Temp_label.Text = str;
- }
- private void Table_Text_Set(object label, String str)
- {
- label = str;
- }
- private String ComboBox_Text_Get(object data)
- {
- ComboBox Temp_data = (ComboBox)data;
- return Temp_data.Text;
- }
- private void PicVisible_Text_Set(object label, bool set)
- {
- PictureBox Temp_pic = (PictureBox)label;
- Temp_pic.Visible = set;
- }
- private void CheckBoxVisible_Text_Set(object label, bool set)
- {
- CheckBox Temp_pic = (CheckBox) label;
- Temp_pic.Checked = set;
- }
- private void Button_Text_Set(object label, string val)
- {
- Button temp_button = (Button)label;
- temp_button.Text = val;
- }
- private Double ADCValueTodBmConvert(DataGridView table,object[] RefData, object[] AdcData, object Currdata)
- {
- /*
- * RefData : Dbm 값
- AdcData : Dbm과 매칭되어있는 ADC값
- Currdata : 현재 ADC 값
- */
- object data = Currdata; // 현재 ADC 값
- double[] Vitual_array = new double[10];
- double step = 0;
- double temp,temp1;
- Double ret = 0xFF,Currentret = 0;
- int LastIndex = 0;
- int dot = 0;
- for(int i = 0; i < table.RowCount; i++)
- {
- try
- {
- step = (Convert.ToDouble(AdcData[i]) - Convert.ToDouble(AdcData[i + 1])) *0.1;
- for (int a = 0; a < 10; a++)
- {
- Vitual_array[a] = Convert.ToDouble(AdcData[i]) - (step * a);
- /*현재 ADC 값과 테이블의 ADC값의 모든값들을 마이너스 합 후 */
- Currentret = Convert.ToDouble(Vitual_array[a]) - Convert.ToDouble(data);
- /*만약 0보다 작을 시 절대값을 취해준다.*/
- if (Currentret < 0)
- {
- Currentret = (Currentret * -2) + Currentret;
- }
- /*만약 현재 결과 값이 이전 결과 값보다
- * 작을 경우 그값이 최종 결과 값이다.*/
- if (ret >= Currentret)
- {
- ret = Currentret;
- LastIndex = i;
- dot = a;
- }
- }
- }
- catch { }
-
- }
- temp = Convert.ToDouble(AdcData[LastIndex]);
- temp1 = Convert.ToDouble(Currdata);
- if (temp1 < temp)
- return Convert.ToDouble(RefData[LastIndex + 1]) + (dot * 0.1);
- else
- return Convert.ToDouble(RefData[0]);
- }
-
- public void GUIDataStatusSet(byte[] buf)
- {
- double Volt_Calc_val = 0.001;//3.3 / 4095;
- double adcdata = 0;
- Int16 dBmdata = 0;
- short LiMitdata = 0;
- short AttData = 0;
- if (buf[(int)BluecellReqIndex.DLI_AGC_ON_OFF] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_AGC, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_AGC, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ULO_ALC_ON_OFF] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_ALC, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_ALC, "ON");// = false;
- }
- switch (buf[(int)BluecellReqIndex.Type])
- {
- case (int)HFR_CardType_t.MBIC_3_7G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "3.7G DCM"); break;
- case (int)HFR_CardType_t.MBIC_3_8G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "3.8G KDDI");break;
- case (int)HFR_CardType_t.MBIC_3_9G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "3.9G RAKUTEN");break;
- case (int)HFR_CardType_t.MBIC_4_0G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "4.0G SMB");break;
- case (int)HFR_CardType_t.MBIC_4_1G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "4.1G KDDI");break;
- case (int)HFR_CardType_t.MBIC_4_6G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "4.6G DCM");break;
- case (int)HFR_CardType_t.MBIC_4_7G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LOCAL1"); break;
- case (int)HFR_CardType_t.MBIC_4_8G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LOCAL2"); break;
- case (int)HFR_CardType_t.MBIC_4_9G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "RESERVE1");break;
- case (int)HFR_CardType_t.MBIC_5_0G: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "RESERVE2");break;
- case (int)HFR_CardType_t.MBIC_DCM : this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LTE-DCM");break;
- case (int)HFR_CardType_t.MBIC_SBM : this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LTE-SBM");break;
- case (int)HFR_CardType_t.MBIC_KDDI: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "LTE-KDDI"); break;
- default: this.Invoke(new StringSend(TextBox_Text_Set), textBox_CardType, "ID None"); break;
- }
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DLI_FRBT_D_Day, buf[(int)BluecellReqIndex.DLI_FRBT_D_Day].ToString());
- if(buf[(int)BluecellReqIndex.CPU_Current_Bank] == 1)
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_CurrBank, "Bank 1");// = false;
- else if (buf[(int)BluecellReqIndex.CPU_Current_Bank] == 2)
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_CurrBank, "Bank 2");// = false;
- else
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_CurrBank, "Unknown");// = false;
- if (buf[(int)BluecellReqIndex.DLI_FRBT_Status] == 0)
- {
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_Status, "IDLE");// = false;
- }
- else if (buf[(int)BluecellReqIndex.DLI_FRBT_Status] == 1)
- {
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_Status, "TRACKING");// = false;
- }
- else if (buf[(int)BluecellReqIndex.DLI_FRBT_Status] == 2)
- {
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_Status, "RUNNING");// = false;
- }
- if(buf[(int)BluecellReqIndex.DLI_FRBT_ON_OFF] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_FRBT_ONOFF, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_FRBT_ONOFF, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.Carrier_ON_OFF] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_Carrier, "OFF");// = false;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox1_Carrier, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_Carrier, "ON");// = false;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox1_Carrier, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.Path_TempShutdown_Set] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_TempShutdown, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_TempShutdown, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.SelfTest] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_SelfTest1, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_SelfTest1, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.SelfTest] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_SelfTest2, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_SelfTest2, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.SelfTest] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_SelfTest3, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_SelfTest3, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.SelfTest] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_SelfTest4, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_SelfTest4, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ATT_DL1_PATH] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL1_PATH, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL1_PATH, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ATT_DL2_PATH] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL2_PATH, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL2_PATH, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ATT_DL3_PATH] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL3_PATH, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL3_PATH, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ATT_DL4_PATH] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL4_PATH, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL4_PATH, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ATT_UL1_PATH] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL1_PATH, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL1_PATH, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ATT_UL2_PATH] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL2_PATH, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL2_PATH, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ATT_UL3_PATH] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL3_PATH, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL3_PATH, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ATT_UL4_PATH] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL4_PATH, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL4_PATH, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ALARM_TEMP_HIGH] != 0x80)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_TempHigh_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_TempHigh_Alarm_OFF, true);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_TempHigh_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_TempHigh_Alarm_OFF, false);// = false;
- }
- if (buf[(int)BluecellReqIndex.ALARM_DLI_Level] == 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_OFF, true);// = false;
- }
- else
- {
- /**
- *
- * DLI HIGH ALARM PART
- *
- * **/
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P1_LEVEL_HIGH) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_High_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P2_LEVEL_HIGH) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_High_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P3_LEVEL_HIGH) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_High_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P4_LEVEL_HIGH) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_High_Alarm_OFF, true);// = false;
- }
- /**
- *
- * DLI LOW ALARM PART
- *
- * **/
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P1_LEVEL_LOW) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path1_Low_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P2_LEVEL_LOW) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path2_Low_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P3_LEVEL_LOW) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path3_Low_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_Level] & ALARM_DLI_P4_LEVEL_LOW) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DLI_Path4_Low_Alarm_OFF, true);// = false;
- }
- }
- if (buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] == 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_OFF, true);// = false;
- }
- else
- {
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] & ALARM_DLI_SHUTDOWN_P1) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL1_Shutdown_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] & ALARM_DLI_SHUTDOWN_P2) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL2_Shutdown_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] & ALARM_DLI_SHUTDOWN_P3) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL3_Shutdown_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_SHTUTDOWN] & ALARM_DLI_SHUTDOWN_P4) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_DL4_Shutdown_Alarm_OFF, true);// = false;
- }
- }
-
- if (buf[(int)BluecellReqIndex.DLI_Shutdown_ON_OFF] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL_Shutdown, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_DL_Shutdown, "ON");// = false;
- }
-
- if (buf[(int)BluecellReqIndex.ULO_Shutdown_ON_OFF] == 0)
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL_Shutdown, "OFF");// = false;
- }
- else
- {
- this.Invoke(new StringSend(Button_Text_Set), button_UL_Shutdown, "ON");// = false;
- }
- if (buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] == 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_OFF, true);// = false;
- }
- else
- {
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] & ALARM_AGC_P1) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC1_Alarm_OFF, true);// = fals
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] & ALARM_AGC_P2) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC2_Alarm_OFF, true);// = fals
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] & ALARM_AGC_P3) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC3_Alarm_OFF, true);// = fals
- }
- if ((buf[(int)BluecellReqIndex.ALARM_DLI_AGC_Alarm] & ALARM_AGC_P4) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_AGC4_Alarm_OFF, true);// = fals
- }
-
- }
- if (buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] == 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_OFF, true);// = false;
- }
- else
- {
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] & ALARM_ALC_P1) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC1_Alarm_OFF, true);// = fals
- }
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] & ALARM_ALC_P2) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC2_Alarm_OFF, true);// = fals
- }
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] & ALARM_ALC_P3) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC3_Alarm_OFF, true);// = fals
- }
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_ALC_Alarm] & ALARM_ALC_P4) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ALC4_Alarm_OFF, true);// = fals
- }
- }
- if (buf[(int)BluecellReqIndex.ALARM_ULO_Level] == 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path1_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path2_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path3_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path4_High_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path1_High_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path2_High_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path3_High_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path4_High_Alarm_OFF, true);// = false;
-
- }
- else
- {
- /**
- *
- * ULO HIGH ALARM PART
- *
- * **/
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_Level] & ALARM_ULO_P1_LEVEL_HIGH) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path1_High_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path1_High_Alarm_OFF, false);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_Level] & ALARM_ULO_P2_LEVEL_HIGH) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path2_High_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path2_High_Alarm_OFF, false);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_Level] & ALARM_ULO_P3_LEVEL_HIGH) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path3_High_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path3_High_Alarm_OFF, false);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_Level] & ALARM_ULO_P4_LEVEL_HIGH) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path4_High_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_ULO_Path4_High_Alarm_OFF, false);// = false;
- }
-
- }
- if (buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] == 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_OFF, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_OFF, true);// = false;
- }
- else
- {
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] & ALARM_ULO_SHUTDOWN_P1) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL1_Shutdown_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] & ALARM_ULO_SHUTDOWN_P2) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL2_Shutdown_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] & ALARM_ULO_SHUTDOWN_P3) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL3_Shutdown_Alarm_OFF, true);// = false;
- }
- if ((buf[(int)BluecellReqIndex.ALARM_ULO_SHTUTDOWN] & ALARM_ULO_SHUTDOWN_P4) > 0)
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_ON, true);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_OFF, false);// = false;
- }
- else
- {
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_ON, false);// = false;
- this.Invoke(new SWVisible(PicVisible_Text_Set), pictureBox_UL4_Shutdown_Alarm_OFF, true);// = false;
- }
- }
- this.Invoke(new SWVisible(CheckBoxVisible_Text_Set), checkBox_Fix, IamSetting_Get());// = false;
- if (IamSetting_Get() == false)
- {
- LiMitdata = 0;
- LiMitdata += buf[(int)BluecellReqIndex.Temp_High_Threshold];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Temp_Threshold, LiMitdata.ToString());
- LiMitdata = 0;
- LiMitdata += buf[(int)BluecellReqIndex.Temp_High_Threshold_Default];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Temp_Threshold_Default, LiMitdata.ToString("N2"));
- LiMitdata = 0;
- LiMitdata += buf[(int)BluecellReqIndex.bluecell_User_TEMP_OFFSET];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Temperature_Offset, LiMitdata.ToString());
- LiMitdata = 0;
- LiMitdata += buf[(int)BluecellReqIndex.ALARM_MASK1];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_MASK, LiMitdata.ToString());
- LiMitdata = 0;
- LiMitdata += (short)((buf[(int)BluecellReqIndex.DLI_AGC_Threshold_H] << 8) & 0xFF00);
- LiMitdata += (short)(buf[(int)BluecellReqIndex.DLI_AGC_Threshold_L] & 0x00FF);
- LiMitdata /= 10;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DLI_AGC_Threshold, LiMitdata.ToString());
- LiMitdata = 0;
- LiMitdata += (short)((buf[(int)BluecellReqIndex.ULO_ALC_Threshold_H] << 8) & 0xFF00);
- LiMitdata += (short)(buf[(int)BluecellReqIndex.ULO_ALC_Threshold_L] & 0x00FF);
- LiMitdata /= 10;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_ULO_ALC_Threshold, LiMitdata.ToString());
- AttData = (short)(((buf[(int)BluecellReqIndex.ATT_DL1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_DL1_L] & 0x00FF));
- adcdata = AttData *0.1;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_DL1, adcdata.ToString("N2"));
- AttData = (short)(((buf[(int)BluecellReqIndex.ATT_DL2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_DL2_L] & 0x00FF));
- adcdata = AttData *0.1;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_DL2, adcdata.ToString("N2"));
- AttData = (short)(((buf[(int)BluecellReqIndex.ATT_DL3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_DL3_L] & 0x00FF));
- adcdata = AttData *0.1;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_DL3, adcdata.ToString("N2"));
- AttData = (short)(((buf[(int)BluecellReqIndex.ATT_DL4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_DL4_L] & 0x00FF));
- adcdata = AttData *0.1;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_DL4, adcdata.ToString("N2"));
- AttData = (short)(((buf[(int)BluecellReqIndex.ATT_UL1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_UL1_L] & 0x00FF));
- adcdata = AttData *0.1;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL1, adcdata.ToString("N2"));
- AttData = (short)(((buf[(int)BluecellReqIndex.ATT_UL2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_UL2_L] & 0x00FF));
- adcdata = AttData *0.1;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL2, adcdata.ToString("N2"));
- AttData = (short)(((buf[(int)BluecellReqIndex.ATT_UL3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_UL3_L] & 0x00FF));
- adcdata = AttData *0.1;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL3, adcdata.ToString("N2"));
- AttData = (short)(((buf[(int)BluecellReqIndex.ATT_UL4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ATT_UL4_L] & 0x00FF));
- adcdata = AttData *0.1;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ATT_UL4, adcdata.ToString("N2"));
- AttData = (short)(buf[(int)BluecellReqIndex.Path1_GainValue]);
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Path1_GainValue, AttData.ToString());
- AttData = (short)(buf[(int)BluecellReqIndex.Path2_GainValue]);
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Path2_GainValue, AttData.ToString());
- AttData = (short)(buf[(int)BluecellReqIndex.Path3_GainValue]);
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Path3_GainValue, AttData.ToString());
- AttData = (short)(buf[(int)BluecellReqIndex.Path4_GainValue]);
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_Path4_GainValue, AttData.ToString());
- //this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC4_MAX, adcdata.ToString("N2"));
- adcdata = 0;
- AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_DL1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_DL1_L] & 0x00FF));
- adcdata = AttData *0.1;
- /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
- {
- adcdata = (0xffff - adcdata) + 1;
- adcdata *= -1;
- }
- adcdata = AttData *0.1;*/
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DL1_User, adcdata.ToString("N2"));
- adcdata = 0;
- AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_DL2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_DL2_L] & 0x00FF));
- adcdata = (AttData) *0.1;
- //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_DL2_H] << 8) & 0xFF00);
- //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_DL2_L] & 0x00FF);
- /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
- {
- adcdata = (0xffff - adcdata) + 1;
- adcdata *= -1;
- }
- adcdata = AttData *0.1;*/
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DL2_User, adcdata.ToString("N2"));
- adcdata = 0;
- AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_DL3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_DL3_L] & 0x00FF));
- adcdata = AttData *0.1;
- //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_DL3_H] << 8) & 0xFF00);
- //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_DL3_L] & 0x00FF);
- /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
- {
- adcdata = (0xffff - adcdata) + 1;
- adcdata *= -1;
- }
- adcdata = AttData *0.1;*/
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DL3_User, adcdata.ToString("N2"));
- adcdata = 0;
- AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_DL4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_DL4_L] & 0x00FF));
- adcdata = AttData *0.1;
- //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_DL4_H] << 8) & 0xFF00);
- //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_DL4_L] & 0x00FF);
- /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
- {
- adcdata = (0xffff - adcdata) + 1;
- adcdata *= -1;
- }
- adcdata = AttData *0.1;*/
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_DL4_User, adcdata.ToString("N2"));
- adcdata = 0;
- AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_UL1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_UL1_L] & 0x00FF));
- adcdata = AttData *0.1;
- //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_UL1_H] << 8) & 0xFF00);
- //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_UL1_L] & 0x00FF);
- /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
- {
- adcdata = (0xffff - adcdata) + 1;
- adcdata *= -1;
- }
- adcdata = AttData *0.1;*/
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_UL1_User, adcdata.ToString("N2"));
- adcdata = 0;
- AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_UL2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_UL2_L] & 0x00FF));
- adcdata = AttData *0.1;
- //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_UL2_H] << 8) & 0xFF00);
- //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_UL2_L] & 0x00FF);
- /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
- {
- adcdata = (0xffff - adcdata) + 1;
- adcdata *= -1;
- }
- adcdata = AttData *0.1;*/
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_UL2_User, adcdata.ToString("N2"));
- adcdata = 0;
- AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_UL3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_UL3_L] & 0x00FF));
- adcdata = AttData *0.1;
- //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_UL3_H] << 8) & 0xFF00);
- //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_UL3_L] & 0x00FF);
- /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
- {
- adcdata = (0xffff - adcdata) + 1;
- adcdata *= -1;
- }
- adcdata = AttData *0.1;*/
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_UL3_User, adcdata.ToString("N2"));
- adcdata = 0;
- AttData = (short)(((buf[(int)BluecellReqIndex.bluecell_User_UL4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.bluecell_User_UL4_L] & 0x00FF));
- adcdata = AttData *0.1;
- //adcdata += ((buf[(int)BluecellReqIndex.bluecell_User_UL4_H] << 8) & 0xFF00);
- //adcdata += (buf[(int)BluecellReqIndex.bluecell_User_UL4_L] & 0x00FF);
- /*if ((((int)(adcdata) & 0xFF00) & 0xF000) == 0xF000)
- {
- adcdata = (0xffff - adcdata) + 1;
- adcdata *= -1;
- }
- adcdata = AttData *0.1;*/
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_UL4_User, adcdata.ToString("N2"));
- adcdata = 0;
-
- AttData = (short)(((buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten1_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten1_L] & 0x00FF));
- AttData /= 10;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC1, AttData.ToString());
- AttData = (short)(((buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten2_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten2_L] & 0x00FF));
- AttData /= 10;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC2, AttData.ToString());
- AttData = (short)(((buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten3_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten3_L] & 0x00FF));
- AttData /= 10;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC3, AttData.ToString());
- AttData = (short)(((buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten4_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.MBIC_ULO_ALC_Atten4_L] & 0x00FF));
- AttData /= 10;
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ALC4, AttData.ToString());
- }
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_MunufactureDate,
- buf[(int)BluecellReqIndex.Manufacture_Date].ToString()
- + buf[(int)BluecellReqIndex.Manufacture_Date + 1].ToString("D2")
- + buf[(int)BluecellReqIndex.Manufacture_Date + 2].ToString("D2"));
- string tempstr = "";
- for (int strindex = 0; strindex < 20; strindex++)
- tempstr += Convert.ToChar(buf[(int)BluecellReqIndex.Serial_Number + strindex]);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_SerialNumber, tempstr);
- tempstr = buf[(int)BluecellReqIndex.PCB_Version].ToString();
- tempstr += ".";
- tempstr += buf[(int)BluecellReqIndex.PCB_Version + 1].ToString();
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_PcbVersion, tempstr);
- tempstr = "";
- for (int strindex = 0; strindex < 31; strindex++)
- tempstr += Convert.ToChar(buf[(int)BluecellReqIndex.CPU_Bank1_Image_Name + strindex]);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_Bank1Name, tempstr);
- tempstr = "";
- for (int strindex = 0; strindex < 31; strindex++)
- tempstr += Convert.ToChar(buf[(int)BluecellReqIndex.CPU_Bank2_Image_Name + strindex]);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_Bank2Name, tempstr);
- AttData = (short)(((buf[(int)BluecellReqIndex.DLI_Shutdown_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.DLI_Shutdown_Threshold_L] & 0x00FF));
- AttData = Convert.ToInt16(AttData * 0.1);
- //this.Invoke(new StringSend(Numeric_Text_Set), hidden.numericUpDown_DLI_Shutdown_Threshold, AttData.ToString());
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL_ShutdownLimit, AttData.ToString());
- AttData = (short)(((buf[(int)BluecellReqIndex.ULO_Shutdown_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ULO_Shutdown_Threshold_L] & 0x00FF));
- AttData = Convert.ToInt16(AttData * 0.1);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_UL_ShutdownLimit, AttData.ToString());
- AttData = (short)(buf[(int)BluecellReqIndex.DL_Det_ALL_Offset]);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL1_TableOffset, ((sbyte)AttData).ToString());
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL2_TableOffset, ((sbyte)AttData).ToString());
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL3_TableOffset, ((sbyte)AttData).ToString());
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DL4_TableOffset, ((sbyte)AttData).ToString());
-
- AttData = (short)(((buf[(int)BluecellReqIndex.DLI_Level_High_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.DLI_Level_High_Threshold_L] & 0x00FF));
- AttData = Convert.ToInt16(AttData * 0.1);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DLI_Level_High_Threshold, AttData.ToString());
- AttData = (short)(((buf[(int)BluecellReqIndex.DLI_Level_Low_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.DLI_Level_Low_Threshold_L] & 0x00FF));
- AttData = Convert.ToInt16(AttData * 0.1);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DLI_Level_Low_Threshold, AttData.ToString());
- AttData = (short)(((buf[(int)BluecellReqIndex.ULO_Level_High_Threshold_H] << 8) & 0xFF00) | (buf[(int)BluecellReqIndex.ULO_Level_High_Threshold_L] & 0x00FF));
- AttData = Convert.ToInt16(AttData * 0.1);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_ULO_Level_High_Threshold, AttData.ToString());
- AttData = buf[(int)BluecellReqIndex.ULO_Shutdown_Retry_Count1];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownUL1, AttData.ToString());
- AttData = buf[(int)BluecellReqIndex.ULO_Shutdown_Retry_Count2];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownUL2, AttData.ToString());
- AttData = buf[(int)BluecellReqIndex.ULO_Shutdown_Retry_Count3];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownUL3, AttData.ToString());
- AttData = buf[(int)BluecellReqIndex.ULO_Shutdown_Retry_Count4];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownUL4, AttData.ToString());
- AttData = buf[(int)BluecellReqIndex.DLI_Shutdown_Retry_Count1];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownDL1, AttData.ToString());
- AttData = buf[(int)BluecellReqIndex.DLI_Shutdown_Retry_Count2];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownDL2, AttData.ToString());
- AttData = buf[(int)BluecellReqIndex.DLI_Shutdown_Retry_Count3];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownDL3, AttData.ToString());
- AttData = buf[(int)BluecellReqIndex.DLI_Shutdown_Retry_Count4];
- this.Invoke(new StringSend(Numeric_Text_Set), numericUpDown_ShutdownDL4, AttData.ToString());
- adcdata = 0;
- adcdata = ((buf[(int)BluecellReqIndex.DLI_P1_Level1_H] << 8) & 0xFF00);
- adcdata += (buf[(int)BluecellReqIndex.DLI_P1_Level1_L] & 0x00FF);
- adcdata *= Volt_Calc_val;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL1, adcdata.ToString("N3"));
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_Level1_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_Level1_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL1_dBm, (dBmdata * 0.1).ToString());
- adcdata = 0;
- adcdata = ((buf[(int)BluecellReqIndex.DLI_P2_Level2_H] << 8) & 0xFF00);
- adcdata += (buf[(int)BluecellReqIndex.DLI_P2_Level2_L] & 0x00FF);
- adcdata *= Volt_Calc_val;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL2, adcdata.ToString("N3"));
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_Level2_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_Level2_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL2_dBm, (dBmdata * 0.1).ToString());
- adcdata = 0;
- adcdata = ((buf[(int)BluecellReqIndex.DLI_P3_Level3_H] << 8) & 0xFF00);
- adcdata += (buf[(int)BluecellReqIndex.DLI_P3_Level3_L] & 0x00FF);
- adcdata *= Volt_Calc_val;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL3, adcdata.ToString("N3"));
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_Level3_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_Level3_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL3_dBm, (dBmdata * 0.1).ToString());
- adcdata = 0;
- adcdata = ((buf[(int)BluecellReqIndex.DLI_P4_Level4_H] << 8) & 0xFF00);
- adcdata += (buf[(int)BluecellReqIndex.DLI_P4_Level4_L] & 0x00FF);
- adcdata *= Volt_Calc_val;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL4, adcdata.ToString("N3"));
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_Level4_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_Level4_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_DL4_dBm, (dBmdata * 0.1).ToString());
- adcdata = 0;
- adcdata = ((buf[(int)BluecellReqIndex.ULO_P1_Level1_H] << 8) & 0xFF00);
- adcdata += (buf[(int)BluecellReqIndex.ULO_P1_Level1_L] & 0x00FF);
- adcdata *= Volt_Calc_val;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL1, adcdata.ToString("N3"));
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.ULO_Level1_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.ULO_Level1_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL1_dBm, (dBmdata * 0.1).ToString());
- adcdata = 0;
- adcdata = ((buf[(int)BluecellReqIndex.ULO_P2_Level2_H] << 8) & 0xFF00);
- adcdata += (buf[(int)BluecellReqIndex.ULO_P2_Level2_L] & 0x00FF);
- adcdata *= Volt_Calc_val;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL2, adcdata.ToString("N3"));
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.ULO_Level2_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.ULO_Level2_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL2_dBm, (dBmdata * 0.1).ToString());
- adcdata = 0;
- adcdata = ((buf[(int)BluecellReqIndex.ULO_P3_Level3_H] << 8) & 0xFF00);
- adcdata += (buf[(int)BluecellReqIndex.ULO_P3_Level3_L] & 0x00FF);
- adcdata *= Volt_Calc_val;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL3, adcdata.ToString("N3"));
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.ULO_Level3_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.ULO_Level3_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL3_dBm, (dBmdata * 0.1).ToString());
- adcdata = 0;
- adcdata = ((buf[(int)BluecellReqIndex.ULO_P4_Level4_H] << 8) & 0xFF00);
- adcdata += (buf[(int)BluecellReqIndex.ULO_P4_Level4_L] & 0x00FF);
- adcdata *= Volt_Calc_val;
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL4, adcdata.ToString("N3"));
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.ULO_Level4_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.ULO_Level4_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_DET_UL4_dBm, (dBmdata * 0.1).ToString());
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_FRBT_Atten1_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_FRBT_Atten1_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_DL1, (dBmdata * 0.1).ToString());
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_FRBT_Atten2_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_FRBT_Atten2_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_DL2, (dBmdata * 0.1).ToString());
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_FRBT_Atten3_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_FRBT_Atten3_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_DL3, (dBmdata * 0.1).ToString());
- dBmdata = 0;
- dBmdata = (short)((buf[(int)BluecellReqIndex.DLI_FRBT_Atten4_H] << 8) & 0xFF00);
- dBmdata += (short)(buf[(int)BluecellReqIndex.DLI_FRBT_Atten4_L] & 0x00FF);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_FRBT_DL4, (dBmdata * 0.1).ToString());
- adcdata = 0;
- #if false
- adcdata += ((buf[(int)BluecellReqIndex.DET_TEMP_H] << 8) & 0xFF00);
- adcdata += (buf[(int)BluecellReqIndex.DET_TEMP_L] & 0x00FF);
- adcdata = adcdata * 3.3 / 4095;
- adcdata = (adcdata - 0.5) * 100;
- #else
- adcdata = (sbyte)(buf[(int)BluecellReqIndex.DET_TEMP]);
- #endif
- this.Invoke(new StringSend(Label_Text_Set), label_Temp, adcdata.ToString("N2") + "°C");
- adcdata = 0;
- //string tmp = Convert.ToInt32(buf[(int)BluecellReqIndex.CPUVERSION3],16).ToString();
- char pad = '0';
- string version = Convert.ToString(buf[(int)BluecellReqIndex.CPUVERSION1]).PadLeft(2,pad)
- + "."
- + Convert.ToString(buf[(int)BluecellReqIndex.CPUVERSION2]).PadLeft(2, pad)
- + "."
- + Convert.ToInt32(buf[(int)BluecellReqIndex.CPUVERSION3]).ToString("X").PadLeft(2, pad);
- //Convert.ToInt32(buf[(int)BluecellReqIndex.CPUVERSION3], 16).ToString();
- //adcdata += (buf[(int)BluecellReqIndex.CPUVERSION2])/10;
- //adcdata += (buf[(int)BluecellReqIndex.CPUVERSION3]);
- this.Invoke(new StringSend(TextBox_Text_Set), textBox_CpuVersion, version);
-
-
- hidden.TableCurrentOutputSetting();
- }
-
- object[] DET_DL1_Table = new object[128];
- object[] DET_DL2_Table = new object[128];
- object[] DET_DL3_Table = new object[128];
- object[] DET_DL4_Table = new object[128];
- object[] DET_UL1_Table = new object[128];
- object[] DET_UL2_Table = new object[128];
- object[] DET_UL3_Table = new object[128];
- object[] DET_UL4_Table = new object[128];
- object[] DET_DL1_RefTable = new object[128];
- object[] DET_DL2_RefTable = new object[128];
- object[] DET_DL3_RefTable = new object[128];
- object[] DET_DL4_RefTable = new object[128];
- object[] DET_UL1_RefTable = new object[128];
- object[] DET_UL2_RefTable = new object[128];
- object[] DET_UL3_RefTable = new object[128];
- object[] DET_UL4_RefTable = new object[128];
-
-
- public void TableDataStatusSet(byte[] buf)
- {
- hidden.TableDataStatusSet(buf);
- }
- public void DateLabelInputFunc(string date)
- {
- this.Invoke(new StringSend(Label_Text_Set), label_CompileDate, date);
- }
- private void ATT_Enter(object sender, KeyEventArgs e)
- {
- if (e.KeyCode == Keys.Enter)
- {
- //button_ATT_Click_1(sender, null);
- button_ATT_Click_2(sender, null);
- //to do
- }
- else if(e.KeyCode == Keys.Escape)
- {
- Activi_Change__Setting(null,null);
- }
- else
- {
- return;
- }
- }
- private bool IamSetting = false;
- private void Activi_Change__SettingComplete(object sender, EventArgs e)
- {
- IamSetting = true;
- }
- public void Activi_Change__Setting(object sender, EventArgs e)
- {
- IamSetting = false;
- }
- public bool IamSetting_Get()
- {
- return IamSetting;
- }
- private void checkBox_Fix_CheckedChanged(object sender, EventArgs e)
- {
- }
- public const byte DET_TableMaxLength = 160 + 1+ 6 + 2; // Header + Type + Length + CRCINDEX + TableIndex + ..... + CRC
- public const byte ATT_TableMaxLength = 96 + 1 + 6 + 2; // Header + Type + Length + CRCINDEX + TableIndex + ..... + CRC
- public const byte Temp_TableMaxLength = 96 + 1 + 6 + 2; // Header + Type + Length + CRCINDEX + TableIndex + ..... + CRC
- const byte TableGetMaxLength = 1 + 7 + 1;
-
- private void button_Save_Click(object sender, EventArgs e)
- {
- byte[] temp_buf = new byte[TableGetMaxLength];
- Int16 Length =
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_StatusSave;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = TableGetMaxLength - 2;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = (byte)1;
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- ReqTimer_Cnt = 0;
- }
- private void numericUpDown_User_KeyDown(object sender, KeyEventArgs e)
- {
- NumericUpDown numeric = (NumericUpDown)sender;
- const byte TableGetMaxLength = 9;
- byte tmp_H = 0;
- byte tmp_L = 0;
- ReqTimer_Cnt = 0;
- if (e.KeyCode == Keys.Enter)
- {
- byte[] temp_buf = new byte[TableGetMaxLength];
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = Convert.ToByte(((TableGetMaxLength - 3) & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte((TableGetMaxLength - 3) & 0x00FF);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
- if ( numeric.Name == "numericUpDown_Temp_Threshold"
- || numeric.Name == "numericUpDown_Temp_Threshold_Default"
- || numeric.Name == "numericUpDown_Temperature_Offset"
- || numeric.Name.Contains("Default") == true)
- {
- Int16 UserData = Convert.ToInt16(numeric.Value);
- //tmp_H = Convert.ToByte((UserData & 0xFF00) >> 8);
- tmp_L = Convert.ToByte((UserData & 0x00FF));
- //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = tmp_H;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = tmp_L;
- }
- else
- {
- Int16 UserData = Convert.ToInt16(numeric.Value * 10);
- tmp_H = Convert.ToByte((UserData & 0xFF00) >> 8);
- tmp_L = Convert.ToByte((UserData & 0x00FF));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = tmp_H;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = tmp_L;
- }
- switch (numeric.Name)
- {
- case "numericUpDown_Temp_Threshold":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Temp_High_Threshold;
- break;
- case "numericUpDown_Temp_Threshold_Default":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Temp_High_Threshold_Default;
- break;
- case "numericUpDown_Temperature_Offset":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Temperature_Offset;
- break;
- case "numericUpDown_DL1_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DL1_USER;
- break;
- case "numericUpDown_DL2_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DL2_USER;
- break;
- case "numericUpDown_DL3_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DL3_USER;
- break;
- case "numericUpDown_DL4_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DL4_USER;
- break;
- case "numericUpDown_UL1_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_UL1_USER;
-
- break;
- case "numericUpDown_UL2_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_UL2_USER;
- break;
- case "numericUpDown_UL3_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_UL3_USER;
- break;
- case "numericUpDown_UL4_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_UL4_USER;
- break;
- case "numericUpDown_TEMP_User":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_TEMP_USER;
- break;
- case "numericUpDown_DLI_Level_High_Threshold":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Level_High_Threshold;
- break;
- case "numericUpDown_DLI_Level_Low_Threshold":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Level_Low_Threshold;
- break;
- case "numericUpDown_DLI_Level_High_Low_Threshold_default":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Level_High_Low_Threshold_default;
- break;
- case "numericUpDown_DLI_AGC_Threshold":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_AGC_Threshold;
- break;
- case "numericUpDown_DLI_AGC_Threshold_Default":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_AGC_Threshold_Default;
- break;
- case "numericUpDown_DLI_Shutdown_Threshold":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Shutdown_Threshold;
- break;
- case "numericUpDown_DLI_Shutdown_Threshold_Default":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Shutdown_Threshold_Default;
- break;
- case "numericUpDown_ULO_Level_High_Threshold":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_Level_High_Threshold;
- break;
- case "numericUpDown_DLI_Level_High_Threshold_default":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_DLI_Level_High_Low_Threshold_default;
- break;
- case "numericUpDown_ULO_ALC_Threshold":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_ALC_Threshold;
- break;
- case "numericUpDown_ULO_ALC_Threshold_Default":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_ALC_Threshold_Default;
- break;
- case "numericUpDown_ULO_Shutdown_Threshold":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_Shutdown_Threshold;
- break;
- case "numericUpDown_ULO_Shutdown_Threshold_Default":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_ULO_Shutdown_Threshold_Default;
- break;
- case "numericUpDown_MASK":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Alarm_Mask;
- break;
- case "numericUpDown_ALC1":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.BLuecell_ATT_ALC1;
- break;
- case "numericUpDown_ALC2":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.BLuecell_ATT_ALC2;
- break;
- case "numericUpDown_ALC3":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.BLuecell_ATT_ALC3;
- break;
- case "numericUpDown_ALC4":
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type]
- = (byte)Bluecell_BootProtocol.DATATYPE.BLuecell_ATT_ALC4;
- break;
- default:break;
- }
- Crc16 crc = new Crc16();
- UInt16 CRCRET = crc.CRC16_Generate(temp_buf, Convert.ToByte((TableGetMaxLength - 3) & 0x00FF));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = Convert.ToByte(CRCRET & 0x00FF);
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- ReqTimer_Cnt = 0;
- //to do
- }
- else if (e.KeyCode == Keys.Escape)
- {
- Activi_Change__Setting(null, null);
- }
- else
- {
- return;
- }
- }
- private void button_Reset_Click(object sender, EventArgs e)
- {
- label_CompileDate.Text = "";
- byte[] temp_buf = new byte[TableGetMaxLength];
- 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 };
- // serial.Serial_DataSend(Temp_MBICResetCmd, Temp_MBICResetCmd.Length);
- //return;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.BLUECELL_SOFTWARERESET;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = Convert.ToByte((TableGetMaxLength - 2 & 0xFF00 )>> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte((TableGetMaxLength - 2 & 0x00FF));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = (byte)1;
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- ReqTimer_Cnt = 0;
- }
- private void numericUpDown_ATT_DL1_ValueChanged(object sender, EventArgs e)
- {
- }
-
- private void button_LedTest_Click(object sender, EventArgs e)
- {
- byte[] temp_buf = new byte[BLUECELL_RESET_LENGTH];
- Button button = (Button)sender;
- DATATYPE datatype;
- ReqTimer_Cnt = 0;
- switch (button.Name)
- {
- case "button_LedTest":
- datatype = DATATYPE.Bluecell_LED_TEST;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 1;
- break;
- default:
- MessageBox.Show("잘 못된 값 입니다. 확인 부탁드립니다.");
- return;
- }
- //pictureBox.Visible = false;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = 6;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = 1; //CRC
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- }
- UInt32[] crc32_tab = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419, 0x706af48f,
- 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4, 0xe0d5e91e, 0x97d2d988,
- 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07, 0x90bf1d91, 0x1db71064, 0x6ab020f2,
- 0xf3b97148, 0x84be41de, 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7,
- 0x136c9856, 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4, 0xa2677172,
- 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b, 0x35b5a8fa, 0x42b2986c,
- 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3, 0x45df5c75, 0xdcd60dcf, 0xabd13d59,
- 0x26d930ac, 0x51de003a, 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423,
- 0xcfba9599, 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190, 0x01db7106,
- 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f, 0x9fbfe4a5, 0xe8b8d433,
- 0x7807c9a2, 0x0f00f934, 0x9609a88e, 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d,
- 0x91646c97, 0xe6635c01, 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e,
- 0x6c0695ed, 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3, 0xfbd44c65,
- 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2, 0x4adfa541, 0x3dd895d7,
- 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a, 0x346ed9fc, 0xad678846, 0xda60b8d0,
- 0x44042d73, 0x33031de5, 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa,
- 0xbe0b1010, 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17, 0x2eb40d81,
- 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6, 0x03b6e20c, 0x74b1d29a,
- 0xead54739, 0x9dd277af, 0x04db2615, 0x73dc1683, 0xe3630b12, 0x94643b84,
- 0x0d6d6a3e, 0x7a6a5aa8, 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1,
- 0xf00f9344, 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a, 0x67dd4acc,
- 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5, 0xd6d6a3e8, 0xa1d1937e,
- 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1, 0xa6bc5767, 0x3fb506dd, 0x48b2364b,
- 0xd80d2bda, 0xaf0a1b4c, 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55,
- 0x316e8eef, 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe, 0xb2bd0b28,
- 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31, 0x2cd99e8b, 0x5bdeae1d,
- 0x9b64c2b0, 0xec63f226, 0x756aa39c, 0x026d930a, 0x9c0906a9, 0xeb0e363f,
- 0x72076785, 0x05005713, 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38,
- 0x92d28e9b, 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1, 0x18b74777,
- 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c, 0x8f659eff, 0xf862ae69,
- 0x616bffd3, 0x166ccf45, 0xa00ae278, 0xd70dd2ee, 0x4e048354, 0x3903b3c2,
- 0xa7672661, 0xd06016f7, 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc,
- 0x40df0b66, 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605, 0xcdd70693,
- 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8, 0x5d681b02, 0x2a6f2b94,
- 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
- };
- public UInt32 crc32(byte[] buf, UInt32 size)
- {
-
- UInt32 crcret = 0;
- int a = 0;
-
- crcret = crcret ^ ~0U;
-
- while (size-- > 0) {
- //printf("index : size : %d buf %x \r\n", size,* p);
- crcret = crc32_tab[(crcret ^ buf[a++]) & 0xFF] ^ (crcret >> 8);
- }
-
- return crcret ^ ~0U;
- }
- public byte[] MBIC_BootLoader_DataArray;
- byte[] MBIC_Add_BootLoader_DataArray = new byte[128];
- const string MBIC_HeaderName = "JT-NRDAS ";
-
- public byte[] DataToConvertHex(string date)
- {
- char[] tmpret;
- byte[] ret = new byte[6];
- tmpret = date.ToCharArray();
- for (int i = 0; i < date.Length/2; i++)
- {
- ret[i] = Convert.ToByte((tmpret[i * 2] & 0x0F) * 10) ;
- ret[i] += Convert.ToByte((tmpret[(i * 2) + 1] & 0x0F));
- }
- return ret;
- }
- public Crc16 crc = new Crc16();
- byte[] MBIC_BootLoaderData;
- public MBIC_DownLoadWnc mbic_downloadwnc = new MBIC_DownLoadWnc();
- private void button_Test_Click(object sender, EventArgs e)
- {
- #if false
- string MBIC_HeaderFileName = "jhfs-mbic-nrdas-v00.00." + numericUpDown_Version.Text+ ".mbc";
- char[] tempchardata;
- int TotalFrame = 0;
- OpenFileDialog Mbic_ofd = new OpenFileDialog();
- UInt32 Crcret = 0;
- byte[] tempdata = new byte[1027];
- int i = 0;
- int SendDataLength = 0;
- UInt16 CrcRet = 0;
- timer_JdasMbic.Stop(); //타이머를 멈춘다.
- //파일오픈창 생성 및 설정
- Mbic_ofd.Title = "업데이터 파일 탐색기";
- Mbic_ofd.FileName = "*.bin";
- Mbic_ofd.Filter = "binary 파일 (*.binary,*.bin) | *.binary;, *.bin; | 모든 파일 (*.*) | *.*";
- string s3 = DateTime.Now.ToString("yyMMddHHmmss");
- //string s3 = DateTime.Now.ToString("yyMMdd");
- //파일 오픈창 로드
- DialogResult dr = Mbic_ofd.ShowDialog();
- //OK버튼 클릭시
- if (dr == DialogResult.OK)
- {
- //File명과 확장자를 가지고 온다.
- string fileName = Mbic_ofd.SafeFileName;
-
- //File경로와 File명을 모두 가지고 온다.
- string fileFullName = Mbic_ofd.FileName;
-
- //File경로만 가지고 온다.
- string filePath = fileFullName.Replace(fileName, "");
- //this.serial.debug_hextoasciiConvert();
- //출력 예제용 로직
- // label1.Text = "File Name : " + fileName;
- // label2.Text = "Full Name : " + fileFullName;
- // label3.Text = "File Path : " + filePath;`
- //File경로 + 파일명 리턴
- //JT-NRDAS
- tempchardata = MBIC_HeaderName.ToCharArray();
- for(i = 0; i < tempchardata.Length; i++)
- {
- MBIC_Add_BootLoader_DataArray[i] = Convert.ToByte(tempchardata[i]);
- }
- MBIC_Add_BootLoader_DataArray[9] = 0x20; //file type : MBIC 0x20
- MBIC_Add_BootLoader_DataArray[10] = 0x00; //file type : CPU 0x00
- MBIC_Add_BootLoader_DataArray[11] = 0x00;//version
- MBIC_Add_BootLoader_DataArray[12] = 0x00;//version
- MBIC_Add_BootLoader_DataArray[13] = 0x01;//version
- tempchardata = MBIC_HeaderFileName.ToCharArray();
- for (i = 14; i < 14 + tempchardata.Length + 12; i++) // Total 41byte Filename
- {
- try
- {
- MBIC_Add_BootLoader_DataArray[i] = Convert.ToByte(tempchardata[i - 14]);
- }
- catch
- {
- MBIC_Add_BootLoader_DataArray[i] = 0x20;
- }
- }
-
- tempchardata = s3.ToCharArray();
- for (i = 55; i < 54 + tempchardata.Length / 2 + 1; i++)
- {
- MBIC_Add_BootLoader_DataArray[i] = DataToConvertHex(s3)[i - 55];
- }
- MBIC_BootLoader_DataArray = File.ReadAllBytes(Mbic_ofd.FileName);
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0xFF00) >> 8);
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128)& 0x00FF));
- Crcret = crc32(MBIC_BootLoader_DataArray, Convert.ToUInt32(MBIC_BootLoader_DataArray.Length));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0xFF000000) >> (8 * 3));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x00FF0000) >> (8 * 2));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x0000FF00) >> (8 * 1));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x000000FF) >> (8 * 0));
- for (i = 0; i < 62; i++)
- MBIC_Add_BootLoader_DataArray[66 + i] = 0x00;
- byte[] RetBinary = new byte[MBIC_Add_BootLoader_DataArray.Length + MBIC_BootLoader_DataArray.Length];
- Array.Copy(MBIC_Add_BootLoader_DataArray, 0, RetBinary, 0, MBIC_Add_BootLoader_DataArray.Length);
- Array.Copy(MBIC_BootLoader_DataArray, 0, RetBinary, MBIC_Add_BootLoader_DataArray.Length, MBIC_BootLoader_DataArray.Length);
- // System.IO.FileStream infile = new System.IO.FileStream("FileName.bin", System.IO.FileMode.Create); //파일 스트림 선언
- //infile.Write(RetBinary, 0, RetBinary.Length); //쓰기
- // infile.Close(); //꼭 닫아 주세요. 파일 입출력엔 엄청 중요하죠.
- MBIC_BootLoaderData = bluecell_BootProtocol.MBIC_HeaderMergeFunction(RetBinary, RetBinary.Length);
- /*Download Start Request*/
- /*tempdata[0] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0xFF000000) >> 24);
- tempdata[1] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0x00FF0000) >> 16);
- tempdata[2] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0x0000FF00) >> 8);
- tempdata[3] = Convert.ToByte(((MBIC_BootLoader_DataArray.Length + 128) & 0x000000FF));*/
- TotalFrame = MBIC_BootLoader_DataArray.Length / 1024;
- if(MBIC_BootLoader_DataArray.Length % 1024 > 0)
- {
- TotalFrame += 1;
- }
- tempdata[0] = Convert.ToByte(((TotalFrame) & 0xFF000000) >> 24);
- tempdata[1] = Convert.ToByte(((TotalFrame) & 0x00FF0000) >> 16);
- tempdata[2] = Convert.ToByte(((TotalFrame) & 0x0000FF00) >> 8);
- tempdata[3] = Convert.ToByte(((TotalFrame) & 0x000000FF));
- tempdata[4] = 0;
- tempdata[5] = 0;
- tempdata[6] = 0;
- tempdata[7] = 0;
- tempdata = bluecell_BootProtocol.MBIC_HeaderMergeFunction(tempdata, 8);
- tempdata[(int)MBICProt_st.MBIC_CMD_0] = 0x10;
- SendDataLength = 8 + 22 + 3;
- tempdata[(int)MBICProt_st.MBIC_LENGTH_0] = 0x00;
- tempdata[(int)MBICProt_st.MBIC_LENGTH_1] = (Byte)(SendDataLength - 25);
- tempdata[(int)MBICProt_st.MBIC_HEADERCHECKSUM_0] = crc.Chksum_Create(tempdata);
- CrcRet = crc.MBIC_CRC16_Generate(tempdata, SendDataLength - 25); //Length = Total Length - Header Length - Taile Length
- tempdata[SendDataLength - 3] = Convert.ToByte((CrcRet & 0xFF00) >> 8);
- tempdata[SendDataLength - 2] = Convert.ToByte(CrcRet & 0x00FF);
- tempdata[SendDataLength - 1] = 0x03;
- this.serial.Serial_DataSend(tempdata, 8 + 22 + 3);
- //this.serial.Serial_DataSend(MBIC_BootLoaderData, 1024 + 22 + 3);
- /*
- tempdata[0] = 0xbe;
- tempdata[1] = Termianl_Reset;
- tempdata[2] = 0x02;
- tempdata[3] = STH30_CreateCrc(tempdata, tempdata[2]);
- tempdata[4] = 0xeb;
- this.serial.Serial_DataSend(tempdata, 5);*/
- try
- {
- // Controller_Debug.Controller_TX_TextLoad(tempdata);
- }
- catch { }
- }
- //취소버튼 클릭시 또는 ESC키로 파일창을 종료 했을경우
- else if (dr == DialogResult.Cancel)
- {
- }
- #else
- timer_JdasMbic.Stop(); //타이머를 멈춘다.
- mbic_downloadwnc = new MBIC_DownLoadWnc();
- mbic_downloadwnc.Owner = this; //부모값넘김
- mbic_downloadwnc.Show();
- mbic_downloadwnc.main = this;
- #endif
- }
- private void button_Make_Click(object sender, EventArgs e)
- {
- char[] tempchardata;
- OpenFileDialog Mbic_ofd = new OpenFileDialog();
- UInt32 Crcret = 0;
- byte[] tempdata = new byte[1027];
- int i = 0;
- /*string dec = ;
- string hex = Convert.ToString(int.Parse(dec, 16).ToUpper();*/
- string hex = "24";
- string dec = Convert.ToInt32(hex, 10).ToString();
- char pad = '0';
- 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";
- //현재 사용자 바탕화면 경로
- string localpath = Environment.GetFolderPath(Environment.SpecialFolder.Desktop);
- timer_JdasMbic.Stop(); //타이머를 멈춘다.
- //파일오픈창 생성 및 설정
- Mbic_ofd.Title = "업데이터 파일 탐색기";
- Mbic_ofd.FileName = "*.bin";
- Mbic_ofd.Filter = "binary 파일 (*.binary,*.bin) | *.binary;, *.bin; | 모든 파일 (*.*) | *.*";
- string s3 = DateTime.Now.ToString("yyMMddHHmmss");
- //string s3 = DateTime.Now.ToString("yyMMdd");
- //파일 오픈창 로드
- DialogResult dr = Mbic_ofd.ShowDialog();
- //OK버튼 클릭시
- if (dr == DialogResult.OK)
- {
- //File명과 확장자를 가지고 온다.
- string fileName = Mbic_ofd.SafeFileName;
- //File경로와 File명을 모두 가지고 온다.
- string fileFullName = Mbic_ofd.FileName;
- //File경로만 가지고 온다.
- string filePath = fileFullName.Replace(fileName, "");
- //this.serial.debug_hextoasciiConvert();
- //출력 예제용 로직
- // label1.Text = "File Name : " + fileName;
- // label2.Text = "Full Name : " + fileFullName;
- // label3.Text = "File Path : " + filePath;`
- //File경로 + 파일명 리턴
- //JT-NRDAS
- tempchardata = MBIC_HeaderName.ToCharArray();
- for (i = 0; i < tempchardata.Length; i++)
- {
- MBIC_Add_BootLoader_DataArray[i] = Convert.ToByte(tempchardata[i]);
- }
- MBIC_Add_BootLoader_DataArray[9] = 0x20; //file type : MBIC 0x20
- MBIC_Add_BootLoader_DataArray[10] = 0x00; //file type : CPU 0x00
- MBIC_Add_BootLoader_DataArray[11] = Convert.ToByte(numericUpDown_Version1.Text, 16);//version
- MBIC_Add_BootLoader_DataArray[12] = Convert.ToByte(numericUpDown_Version2.Text, 16);//version
- MBIC_Add_BootLoader_DataArray[13] = Convert.ToByte(numericUpDown_Version3.Text,16);//version
- tempchardata = MBIC_HeaderFileName.ToCharArray();
- for (i = 14; i < 14 + tempchardata.Length + 12; i++) // Total 41byte Filename
- {
- try
- {
- MBIC_Add_BootLoader_DataArray[i] = Convert.ToByte(tempchardata[i - 14]);
- }
- catch
- {
- MBIC_Add_BootLoader_DataArray[i] = 0x20;
- }
- }
- tempchardata = s3.ToCharArray();
- for (i = 55; i < 55 + tempchardata.Length / 2 ; i++)
- {
- MBIC_Add_BootLoader_DataArray[i] = DataToConvertHex(s3)[i - 55];
- }
- MBIC_BootLoader_DataArray = File.ReadAllBytes(Mbic_ofd.FileName);
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((MBIC_BootLoader_DataArray.Length & 0xFF000000) >> (8 * 3));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((MBIC_BootLoader_DataArray.Length & 0x00FF0000) >> (8 * 2));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((MBIC_BootLoader_DataArray.Length & 0x0000FF00) >> (8 * 1));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((MBIC_BootLoader_DataArray.Length & 0x000000FF) >> (8 * 0));
- Crcret = crc32( MBIC_BootLoader_DataArray, Convert.ToUInt32(MBIC_BootLoader_DataArray.Length));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0xFF000000) >> (8 * 3));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x00FF0000) >> (8 * 2));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x0000FF00) >> (8 * 1));
- MBIC_Add_BootLoader_DataArray[i++] = Convert.ToByte((Crcret & 0x000000FF) >> (8 * 0));
- for (i = 0; i < 59; i++)
- MBIC_Add_BootLoader_DataArray[69 + i] = 0x00;
- byte[] RetBinary = new byte[MBIC_Add_BootLoader_DataArray.Length + MBIC_BootLoader_DataArray.Length];
- Array.Copy(MBIC_Add_BootLoader_DataArray, 0, RetBinary, 0, MBIC_Add_BootLoader_DataArray.Length);
- Array.Copy(MBIC_BootLoader_DataArray, 0, RetBinary, MBIC_Add_BootLoader_DataArray.Length, MBIC_BootLoader_DataArray.Length);
- System.IO.FileStream infile = new System.IO.FileStream(localpath+"\\" + MBIC_HeaderFileName, System.IO.FileMode.Create); //파일 스트림 선언
- infile.Write(RetBinary, 0, RetBinary.Length); //쓰기d
- infile.Close(); //꼭 닫아 주세요. 파일 입출력엔 엄청 중요하죠.
-
- }
- //취소버튼 클릭시 또는 ESC키로 파일창을 종료 했을경우
- else if (dr == DialogResult.Cancel)
- {
- }
- }
-
- private void comboBox_BankSel_SelectedIndexChanged(object sender, EventArgs e)
- {
- byte[] temp_buf = new byte[9];
- byte Length = 5;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_BankSelect;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = 5;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = Convert.ToByte(Convert.ToByte(comboBox_BankSel.SelectedIndex) + 1);
- UInt16 CRCRET = crc.CRC16_Generate(temp_buf, Length);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte(CRCRET & 0x00FF);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = 0xeb;
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- ReqTimer_Cnt = 0;
- }
- public IEnumerable<int> ExtractNumbers(string text)
- {
- text += " ";
- var temp = string.Empty;
- for (var i = 0; i < text.Length; i++)
- {
- if (char.IsDigit(text[i]))
- {
- if ('-'.Equals(text[i - 1]))
- {
- temp += text[i - 1];
- }
- temp += text[i];
- }
- else if (temp.Length > 0)
- {
- yield return int.Parse(temp);
- temp = string.Empty;
- }
- }
- }
- private void button1_Click(object sender, EventArgs e)
- {
- label_CompileDate.Text = "";
- byte[] temp_buf = new byte[TableGetMaxLength];
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = (byte)Bluecell_BootProtocol.DATATYPE.BLUECELL_SOFTWARERESET;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = Convert.ToByte((TableGetMaxLength - 4 & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = Convert.ToByte((TableGetMaxLength - 4 & 0x00FF));
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = TableGetMaxLength - 2;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = (byte)1;
- UInt16 CRCRET = crc.CRC16_Generate(temp_buf, TableGetMaxLength - 4);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte(CRCRET & 0x00FF);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = 0xeb;
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- ReqTimer_Cnt = 0;
- }
- private void button_FRBT_TimeSetting_Click(object sender, EventArgs e)
- {
- string Time = textBox_FRBT_TIME.Text;
- string[] Timearray = Time.Split('-');
- int i = 0;
- byte[] Timedata = new byte[6 + 4 + 3]; //Header CRC 4byte TYPE LENGTH 3byte
- Timedata[0] = 0xbe;
- Timedata[1] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_TimeSetting;
- Timedata[2] = 0;
- Timedata[3] = (byte)(Timedata.Length - 4);
- for (i = 0; i < 6; i++)
- Timedata[4 + i] = Convert.ToByte(Timearray[i]);
- UInt16 CRCRET = crc.CRC16_Generate(Timedata, Timedata[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
- Timedata[4 + i++] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
- Timedata[4 + i++] = Convert.ToByte(CRCRET & 0x00FF);
- serial.Serial_DataSend(Timedata, Timedata.Length);
- }
- private void button_FactorySet_Click(object sender, EventArgs e)
- {
- byte[] tempdata = new byte[1 + 4 + 3]; //Header CRC 4byte TYPE LENGTH 3byte
- tempdata[0] = 0xbe;
- tempdata[1] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_Factory_Set;
- tempdata[2] = 0;
- tempdata[3] = (byte)(tempdata.Length - 3);
- tempdata[5] = 1;
- UInt16 CRCRET = crc.CRC16_Generate(tempdata, tempdata[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
- tempdata[6] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
- tempdata[7] = Convert.ToByte(CRCRET & 0x00FF);
- serial.Serial_DataSend(tempdata, tempdata.Length);
- }
- private void button_Carrier_Click(object sender, EventArgs e)
- {
- byte[] tempdata = new byte[1 + 4 + 3]; //Header CRC 4byte TYPE LENGTH 3byte
- tempdata[0] = 0xbe;
- tempdata[1] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_CarrierOnOff;
- tempdata[2] = 0;
- tempdata[3] = (byte)(tempdata.Length - 4);
- tempdata[5] = 1;
- UInt16 CRCRET = crc.CRC16_Generate(tempdata, tempdata[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
- tempdata[6] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
- tempdata[7] = Convert.ToByte(CRCRET & 0x00FF);
- serial.Serial_DataSend(tempdata, tempdata.Length);
- }
- private void button_Carrier_OFF_Click(object sender, EventArgs e)
- {
- byte[] tempdata = new byte[1 + 4 + 3]; //Header CRC 4byte TYPE LENGTH 3byte
- tempdata[0] = 0xbe;
- tempdata[1] = (byte)Bluecell_BootProtocol.DATATYPE.Bluecell_CarrierOnOff;
- tempdata[2] = 0;
- tempdata[3] = (byte)(tempdata.Length - 4);
- tempdata[5] = 0;
- UInt16 CRCRET = crc.CRC16_Generate(tempdata, tempdata[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
- tempdata[6] = Convert.ToByte((CRCRET & 0xFF00) >> 8);
- tempdata[7] = Convert.ToByte(CRCRET & 0x00FF);
- serial.Serial_DataSend(tempdata, tempdata.Length);
- }
- private void button_PATH_Ctrl_Click(object sender, EventArgs e)
- {
- byte[] temp_buf = new byte[BLUECELL_RESET_LENGTH];
- Button button = (Button)sender;
- DATATYPE datatype;
- ReqTimer_Cnt = 0;
- if (button.Text == "OFF")
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 1;
- else
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
- switch (button.Name)
- {
- case "button_DL1_PATH":
- datatype = DATATYPE.ATT_DL1_PATH;
- break;
- case "button_DL2_PATH":
- datatype = DATATYPE.ATT_DL2_PATH;
- break;
- case "button_DL3_PATH":
- datatype = DATATYPE.ATT_DL3_PATH;
- break;
- case "button_DL4_PATH":
- datatype = DATATYPE.ATT_DL4_PATH;
- break;
- case "button_UL1_PATH":
- datatype = DATATYPE.ATT_UL1_PATH;
- break;
- case "button_UL2_PATH":
- datatype = DATATYPE.ATT_UL2_PATH;
- break;
- case "button_UL3_PATH":
- datatype = DATATYPE.ATT_UL3_PATH;
- break;
- case "button_UL4_PATH":
- datatype = DATATYPE.ATT_UL4_PATH;
- break;
- case "button_SelfTest1":
- datatype = DATATYPE.ATT_SelfTest;
- break;
- case "button_SelfTest2":
- datatype = DATATYPE.ATT_SelfTest;
- break;
- case "button_SelfTest3":
- datatype = DATATYPE.ATT_SelfTest;
- break;
- case "button_SelfTest4":
- datatype = DATATYPE.ATT_SelfTest;
- break;
- case "button_DL_Shutdown":
- datatype = DATATYPE.Bluecell_DLI_Shutdown_ON_OFF;
- break;
- case "button_UL_Shutdown":
- datatype = DATATYPE.Bluecell_ULO_Shutdown_ON_OFF;
- break;
- case "button_ALC":
- datatype = DATATYPE.Bluecell_ULO_ALC_ON_OFF;
- break;
- case "button_AGC":
- datatype = DATATYPE.Bluecell_DLI_AGC_ON_OFF;
- break;
- case "button_Carrier":
- datatype = DATATYPE.Bluecell_CarrierOnOff;
- break;
- case "button_TempShutdown":
- datatype = DATATYPE.Bluecell_Temp_Shutdown_Path_ON_OFF;
- break;
- case "button_LedTest":
- datatype = DATATYPE.Bluecell_LED_TEST;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 1;
- break;
- case "button_FRBT_ONOFF":
- datatype = DATATYPE.DLI_FRBT_ON_OFF;
- break;
- default:
- MessageBox.Show("잘 못된 값 입니다. 확인 부탁드립니다.");
- return;
- }
-
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = ((6 & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = (6 & 0x00FF);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
- //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = 0;
- UInt16 CRCRET = crc.CRC16_Generate(temp_buf, temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = Convert.ToByte((CRCRET & 0xFF00) >> 8);//CRC
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = Convert.ToByte(CRCRET & 0x00FF);//CRC
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- }
-
- private void panel_MainTitle_Paint(object sender, PaintEventArgs e)
- {
- /* LinearGradientBrush br = new LinearGradientBrush(this.ClientRectangle,
- Color.FromArgb(50, 56, 203),
- Color.FromArgb(70, 255, 255),
- 180,
- false);
- e.Graphics.FillRectangle(br, this.ClientRectangle);*/
- }
- private void panel_Serial_Paint(object sender, PaintEventArgs e)
- {
- }
- private Point mousePoint = new Point(0, 0);
- private void panel_MainTitle_MouseMove(object sender, MouseEventArgs e)
- {
- if ((e.Button & MouseButtons.Left) == MouseButtons.Left)
- {
- Location = new Point(this.Left - (mousePoint.X - e.X),
- this.Top - (mousePoint.Y - e.Y));
- }
- /* if (e.Button == MouseButtons.Left)
- {
- this.Location = new Point(this.Location.X + (mCurrentPosition.X + e.X), this.Location.Y + (mCurrentPosition.Y + e.Y));
- }*/
- }
- private void panel_MainTitle_DragEnter(object sender, DragEventArgs e)
- {
- /* if (e.Data.GetDataPresent(DataFormats.FileDrop))
- {
- e.Effect = DragDropEffects.All;
- }
- else
- {
- e.Effect = DragDropEffects.None;
- }*/
- }
- private void panel_MainTitle_MouseDown(object sender, MouseEventArgs e)
- {
- mousePoint = new Point(e.X, e.Y);
- }
- private void button_Exit_Click(object sender, EventArgs e)
- {
- Process.GetCurrentProcess().Kill();
- }
- private void button_ManufactureSet_Click(object sender, EventArgs e)
- {
- byte[] temp_buf = new byte[10];
- Button button = (Button)sender;
- DATATYPE datatype;
- ReqTimer_Cnt = 0;
- char[] tempchardata;
- string s3 = DateTime.Now.ToString("yyMMdd");
- tempchardata = s3.ToCharArray();
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = DataToConvertHex(s3)[0];
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 1] = DataToConvertHex(s3)[1];
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 2] = DataToConvertHex(s3)[2];
- datatype = DATATYPE.Bluecell_ManufactureDateSet;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = ((7 & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = (7 & 0x00FF);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
- //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
- UInt16 CRCRET = crc.CRC16_Generate(temp_buf, temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 3] = Convert.ToByte((CRCRET & 0xFF00) >> 8);//CRC
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + 4] = Convert.ToByte(CRCRET & 0x00FF);//CRC
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- }
- //Serial Number : BL-J37C00-20050004 Example
- private void button_SerialNumverSet_Click(object sender, EventArgs e)
- {
- byte[] temp_buf = new byte[26];
- int i = 0;
- Button button = (Button)sender;
- DATATYPE datatype;
- ReqTimer_Cnt = 0;
- char[] data = textBox_SerialNumber.Text.ToCharArray();
- //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = textBox_SerialNumber.Text.Split();
- datatype = DATATYPE.Bluecell_SerialNumberSet;
- for (i = 0; i < data.Length; i++)
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i] = (Byte)data[i];
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = ((23 & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = (23 & 0x00FF);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
- //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
- UInt16 CRCRET = crc.CRC16_Generate(temp_buf, temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i++] = Convert.ToByte((CRCRET & 0xFF00) >> 8);//CRC
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i++] = Convert.ToByte(CRCRET & 0x00FF);//CRC
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- }
- private void button_PCBVersionSet_Click(object sender, EventArgs e)
- {
- byte[] temp_buf = new byte[9];
- int i = 0;
- Button button = (Button)sender;
- DATATYPE datatype;
- ReqTimer_Cnt = 0;
- string[] data = textBox_PcbVersion.Text.Split('.');
- //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = textBox_SerialNumber.Text.Split();
- datatype = DATATYPE.Bluecell_PCBVersionSet;
- for (i = 0; i < data.Length; i++)
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i] = Convert.ToByte(data[i]);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Header] = BLUECELL_HEADER;
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Type] = Convert.ToByte(datatype);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_H] = ((6 & 0xFF00) >> 8);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L] = (6 & 0x00FF);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_CrcIndex] = 5;
- //temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data] = 0;
- UInt16 CRCRET = crc.CRC16_Generate(temp_buf, temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_Length_L]);
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i++] = Convert.ToByte((CRCRET & 0xFF00) >> 8);//CRC
- temp_buf[(int)Bluecell_ProtIndex_p.Bluecell_data + i++] = Convert.ToByte(CRCRET & 0x00FF);//CRC
- serial.Serial_DataSend(temp_buf, temp_buf.Length);
- }
- }
- class AutoClosingMessageBox
- {
- [System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
- static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
- [System.Runtime.InteropServices.DllImport("user32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)]
- static extern IntPtr SendMessage(IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam);
- System.Threading.Timer _timeoutTimer; //쓰레드 타이머
- string _caption;
- const int WM_CLOSE = 0x0010; //close 명령
- AutoClosingMessageBox(string text, string caption, int timeout)
- {
- _caption = caption;
- _timeoutTimer = new System.Threading.Timer(OnTimerElapsed,
- null, timeout, System.Threading.Timeout.Infinite);
- MessageBox.Show(text, caption);
- }
- //생성자 함수
- public static void Show(string text, string caption, int timeout)
- {
- new AutoClosingMessageBox(text, caption, timeout);
- }
- //시간이 다되면 close 메세지를 보냄
- void OnTimerElapsed(object state)
- {
- IntPtr mbWnd = FindWindow(null, _caption);
- if (mbWnd != IntPtr.Zero)
- SendMessage(mbWnd, WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
- _timeoutTimer.Dispose();
- }
- }
- }
|