/// <summary> /// Executes the translation process. /// </summary> /// <param name="context">The compilation context.</param> public void Execute(CompilationContext context) { if (context == null || context.Model == null) return; if (context.OutputStream == null || !context.OutputStream.CanWrite) throw new CompilationException("The translation output stream is null or not writable."); var translationCtx = new TranslationContext(); translationCtx.OutputStream = context.OutputStream; // write enum declarations var enumTranslator = new EnumTranslator(); foreach (var item in context.Model.Enums) enumTranslator.Translate(item, translationCtx); // write class declarations var classTranslator = new ClassTranslator(); foreach (var item in ClassSorter.Sort(context.Model.Classes)) classTranslator.Translate(item, translationCtx); // write global statements if (context.Model.GlobalStatements.Any()) { translationCtx.WriteLine(); foreach (var item in context.Model.GlobalStatements) translationCtx.WriteModel(item); } }
public ChartTitlePositions EvaluatePosition(IReportScopeInstance instance, OnDemandProcessingContext context) { context.SetupContext(base.m_chart, instance); return(EnumTranslator.TranslateChartTitlePosition(context.ReportRuntime.EvaluateChartTitlePositionExpression(this, base.Name, "Position"), context.ReportRuntime)); }
internal ChartAutoBool EvaluateReversed(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(m_chart, reportScopeInstance); return(EnumTranslator.TranslateChartAutoBool(context.ReportRuntime.EvaluateChartLegendReversedExpression(this, m_chart.Name), context.ReportRuntime)); }
internal ChartLegendLayouts EvaluateLayout(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(m_chart, reportScopeInstance); return(EnumTranslator.TranslateChartLegendLayout(context.ReportRuntime.EvaluateChartLegendLayoutExpression(this, m_chart.Name, "Layout"), context.ReportRuntime)); }
public GaugeTickMarkShapes EvaluateShape(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(base.m_gaugePanel, reportScopeInstance); return(EnumTranslator.TranslateGaugeTickMarkShapes(context.ReportRuntime.EvaluateTickMarkStyleShapeExpression(this, base.m_gaugePanel.Name), context.ReportRuntime)); }
public BackgroundGradientTypes EvaluateBackgroundGradientType(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(base.m_gaugePanel, reportScopeInstance); return(EnumTranslator.TranslateBackgroundGradientTypes(context.ReportRuntime.EvaluateScaleRangeBackgroundGradientTypeExpression(this, base.m_gaugePanel.Name), context.ReportRuntime)); }
internal MapAntiAliasing EvaluateAntiAliasing(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(this, reportScopeInstance); return(EnumTranslator.TranslateMapAntiAliasing(context.ReportRuntime.EvaluateMapAntiAliasingExpression(this, base.Name), context.ReportRuntime)); }
internal ChartAllowOutsideChartArea EvaluateAllowOutSidePlotArea(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(InstancePath, reportScopeInstance); return(EnumTranslator.TranslateChartAllowOutsideChartArea(context.ReportRuntime.EvaluateChartSmartLabelAllowOutSidePlotAreaExpression(this, m_chart.Name), context.ReportRuntime)); }
public ChartSeriesSubtype EvaluateSubtype(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(this, reportScopeInstance); return(EnumTranslator.TranslateChartSeriesSubtype(context.ReportRuntime.EvaluateChartSeriesSubtypeExpression(this, this.m_chart.Name), context.ReportRuntime)); }
internal TextOrientations EvaluateTextOrientation(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(m_chart, reportScopeInstance); return(EnumTranslator.TranslateTextOrientations(context.ReportRuntime.EvaluateChartAxisTitleTextOrientationExpression(this, m_chart.Name), context.ReportRuntime)); }
internal ChartMarkerTypes EvaluateChartMarkerType(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(InstancePath, reportScopeInstance); return(EnumTranslator.TranslateChartMarkerType(context.ReportRuntime.EvaluateChartMarkerType(this, m_chart.Name), context.ReportRuntime)); }
public ChartBreakLineType EvaluateBreakLineType(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(base.m_chart, reportScopeInstance); return(EnumTranslator.TranslateChartBreakLineType(context.ReportRuntime.EvaluateChartAxisScaleBreakBreakLineTypeExpression(this, base.m_chart.Name), context.ReportRuntime)); }
internal MapPolygonLabelPlacement EvaluateLabelPlacement(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(base.InstancePath, reportScopeInstance); return(EnumTranslator.TranslateMapPolygonLabelPlacement(context.ReportRuntime.EvaluateMapPolygonTemplateLabelPlacementExpression(this, m_map.Name), context.ReportRuntime)); }
internal MapLabelBehavior EvaluateLabelBehavior(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(m_map, reportScopeInstance); return(EnumTranslator.TranslateLabelBehavior(context.ReportRuntime.EvaluateMapColorScaleLabelBehaviorExpression(this, m_map.Name), context.ReportRuntime)); }
internal GaugePointerPlacements EvaluatePlacement(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(m_gaugePanel, reportScopeInstance); return(EnumTranslator.TranslateGaugePointerPlacements(context.ReportRuntime.EvaluateGaugePointerPlacementExpression(this, m_gaugePanel.Name), context.ReportRuntime)); }
internal PaletteHatchBehavior EvaluatePaletteHatchBehavior(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(this, reportScopeInstance); return(EnumTranslator.TranslatePaletteHatchBehavior(context.ReportRuntime.EvaluateChartPaletteHatchBehaviorExpression(this, base.Name), context.ReportRuntime)); }
public void Test_GetStringForValue_IllegalLanguage_ExpectArgumentException() { EnumTranslator enumTranslator = InitTranslations(); Assert.Throws <ArgumentException>(() => enumTranslator.GetStringForValue(VehicleType.Bicycle, new CultureInfo("es"))); }
internal ChartCalloutStyle EvaluateCalloutStyle(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(InstancePath, reportScopeInstance); return(EnumTranslator.TranslateChartCalloutStyle(context.ReportRuntime.EvaluateChartSmartLabelCalloutStyleExpression(this, m_chart.Name), context.ReportRuntime)); }
public static Table appendToTable(int i, int[] acc, Subject subject, Lesson lesson, Table tab) { if (subject is null) { return(tab); } // lp tab.AddCell(moduleTabCell(i.ToString())); // kod kursu var sufix = EnumTranslator.Translate(lesson.LessonType.ToString()).Substring(0, 1).ToUpper(); tab.AddCell(moduleTabCell(subject.Code + sufix + (lesson.IsGroup ? "p" : ""))); // nazwa kursu tab.AddCell(moduleTabCell(subject.NamePl + (subject.Lessons.Any(l => l.IsGroup) ? "GK" : ""))); // w acc[0] += lesson.LessonType == LessonType.Lecture ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Lecture ? (lesson.HoursAtUniversity / 15).ToString() : "")); // ćw acc[1] += lesson.LessonType == LessonType.Classes ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Classes ? (lesson.HoursAtUniversity / 15).ToString() : "")); // l acc[2] += lesson.LessonType == LessonType.Laboratory ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Laboratory ? (lesson.HoursAtUniversity / 15).ToString() : "")); // p acc[3] += lesson.LessonType == LessonType.Project ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Project ? (lesson.HoursAtUniversity / 15).ToString() : "")); // s acc[4] += lesson.LessonType == LessonType.Seminar ? lesson.HoursAtUniversity : 0; tab.AddCell(moduleTabCell( lesson.LessonType == LessonType.Seminar ? (lesson.HoursAtUniversity / 15).ToString() : "")); // symbol efektu uczenia tab.AddCell(moduleTabCell(subject.LearningOutcomeEvaluations.Aggregate("", (los, next) => los += next.LearningOutcomeSymbol + "\n", los => los))); // ZZU acc[5] += lesson.HoursAtUniversity; tab.AddCell(moduleTabCell(lesson.HoursAtUniversity.ToString())); //CNPS acc[6] += lesson.StudentWorkloadHours; tab.AddCell(moduleTabCell(lesson.StudentWorkloadHours.ToString())); //"łączna" acc[7] += lesson.Ects; tab.AddCell(moduleTabCell(lesson.Ects.ToString())); //"zajęć BK" acc[8] += lesson.EctsinclDirectTeacherStudentContactClasses; tab.AddCell(moduleTabCell(lesson.EctsinclDirectTeacherStudentContactClasses.ToString())); //"Forma kursu/grupy kursów" tab.AddCell(moduleTabCell("T")); //"Sposób zaliczenia" tab.AddCell(moduleTabCell(EnumTranslator.Translate(lesson.FormOfCrediting.ToString()))); //"ogólnouczelniany" tab.AddCell(moduleTabCell(subject.ModuleType == ModuleType.General ? "T" : "")); //"o charakterze praktycznym" tab.AddCell(moduleTabCell(lesson.LessonType == LessonType.Project || lesson.LessonType == LessonType.Laboratory ? $"P({lesson.Ects})" : "")); //"rodzaj" tab.AddCell(moduleTabCell(EnumTranslator.Translate(subject.ModuleType.ToString()))); //"typ" tab.AddCell(moduleTabCell(EnumTranslator.Translate(subject.TypeOfSubject.ToString()))); return(tab); }
internal MapMarkerStyle EvaluateMapMarkerStyle(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(m_map, reportScopeInstance); return(EnumTranslator.TranslateMapMarkerStyle(context.ReportRuntime.EvaluateMapMarkerMapMarkerStyleExpression(this, m_map.Name), context.ReportRuntime)); }
public List <string> Verify(Syllabus syllabus) { var errors = new List <string>(); // description if (syllabus.Description.NumOfSemesters < 1 || syllabus.Description.NumOfSemesters > 10) { errors.Add("Niepoprawna liczba semestrów. (Dopuszczalne wartości 1-10)"); } if (string.IsNullOrWhiteSpace(syllabus.Description.Prerequisites) || syllabus.Description.Prerequisites == ".") { errors.Add("Nieuzupełnione pole Wymagania wstępne."); } if (string.IsNullOrWhiteSpace(syllabus.Description.EmploymentOpportunities) || syllabus.Description.EmploymentOpportunities == ".") { errors.Add("Nieuzupełnione pole Sylwetka absolwenta."); } if (string.IsNullOrWhiteSpace(syllabus.Description.PossibilityOfContinuation) || syllabus.Description.PossibilityOfContinuation == ".") { errors.Add("Nieuzupełnione pole Możliwość kontynuacji studiów."); } if (syllabus.FieldOfStudy.Type == CourseType.FullTime && syllabus.FieldOfStudy.Level == DegreeLevel.FirstLevel && syllabus.Description.NumOfSemesters < 6) { errors.Add($"Studia stacjonarne pierwszego stopnia muszą trwać co najmniej 6 semestrów. Podana liczba semestrów: {syllabus.Description.NumOfSemesters}"); } // subjects var wrongSubjects = syllabus.SubjectDescriptions.Where(sd => sd.AssignedSemester > syllabus.Description.NumOfSemesters); foreach (var subject in wrongSubjects) { errors.Add($"Przedmiot {subject.Subject.Code} \"{subject.Subject.NamePl}\" posiada niepoprawny przypisany semestr."); } wrongSubjects = syllabus.SubjectDescriptions.Where(sd => sd.CompletionSemester != null && sd.AssignedSemester > sd.CompletionSemester); foreach (var subject in wrongSubjects) { errors.Add($"Przedmiot {subject.Subject.Code} \"{subject.Subject.NamePl}\" posiada przypisany semestr większy niż semestr ukończenia."); } // obligatory fields if (string.IsNullOrWhiteSpace(syllabus.ThesisCourse) || syllabus.ThesisCourse == ".") { errors.Add("Nieuzupełnione pole Praca dyplomowa."); } if (string.IsNullOrWhiteSpace(syllabus.ScopeOfDiplomaExam) || syllabus.ScopeOfDiplomaExam == ".") { errors.Add("Nieuzupełnione pole Zakres egzaminu dyplomowego."); } if (string.IsNullOrWhiteSpace(syllabus.IntershipType) || syllabus.IntershipType == ".") { errors.Add("Nieuzupełnione pole Praktyki."); } // ects var semestersSubjects = syllabus.SubjectDescriptions.Where(s => s.AssignedSemester > 0) .GroupBy(s => s.AssignedSemester); foreach (var semesterSubjects in semestersSubjects) { var totalEctsForSem = semesterSubjects.Sum(s => s.Subject.Lessons.Sum(l => l.Ects)); if (totalEctsForSem != 30) { errors.Add($"Semestr: {semesterSubjects.Key}. Liczba ECTS przypisanych przedmiotów ({totalEctsForSem}) jest niezgodna z oczekiwaną liczbą ECTS (30)."); } var totalStudentWorkload = semesterSubjects.Sum(s => s.Subject.Lessons.Sum(l => l.StudentWorkloadHours)); if (totalStudentWorkload < 750 || totalStudentWorkload > 900) { errors.Add($"Semestr: {semesterSubjects.Key}. Liczba godzin CNPS ({totalStudentWorkload}) poza dopuszczalnym przedziałem 750 - 900."); } } // elective subjects var subjectGroups = syllabus.SubjectDescriptions.Where(s => s.Subject.TypeOfSubject == TypeOfSubject.Elective) .GroupBy(s => new { s.Subject.ModuleType, s.Subject.KindOfSubject }); foreach (var subjectGroup in subjectGroups) { if (subjectGroup.Select(s => s.Subject.Lessons.Sum(l => l.Ects)).Distinct().Count() > 1) { errors.Add($"Grupa: {EnumTranslator.Translate(subjectGroup.Key.ModuleType.ToString())} {EnumTranslator.Translate(subjectGroup.Key.KindOfSubject.ToString())}. W grupie kursów wybieralnych nie może być przedmiotów o różnej liczbie ECTS."); } } // point limits foreach (var limit in syllabus.PointLimits) { var totalSubjectEcts = syllabus.SubjectDescriptions.Where(s => s.Subject.ModuleType == limit.ModuleType && (limit.KindOfSubject is null || s.Subject.KindOfSubject == limit.KindOfSubject) && (limit.TypeOfSubject is null || s.Subject.TypeOfSubject == limit.TypeOfSubject)) .Sum(s => s.Subject.Lessons.Sum(l => l.Ects)); if (totalSubjectEcts < limit.Points) { errors.Add($"Grupa: {EnumTranslator.Translate(limit.ModuleType.ToString())} {EnumTranslator.Translate(limit.KindOfSubject?.ToString() ?? string.Empty)} {EnumTranslator.Translate(limit.TypeOfSubject?.ToString() ?? string.Empty)}. Liczba punktów ECTS poniżej limitu ({limit.Points})."); } } // practical lessons var practicalLessons = syllabus.SubjectDescriptions.Where(s => s.AssignedSemester > 0).SelectMany(s => s.Subject.Lessons.Where(l => l.LessonType != LessonType.Lecture)); var practicalEcts = practicalLessons.Sum(l => l.Ects); if ((double)practicalEcts / syllabus.Description.Ects < 0.3) { errors.Add($"Zajęcia kształtujące umiejętności praktyczne posiadają mniej niż 30% punktów ECTS ({(int)((double)practicalEcts / syllabus.Description.Ects * 100)}%)"); } var practicalHours = practicalLessons.Sum(l => l.HoursAtUniversity); var totalHours = syllabus.SubjectDescriptions.Where(s => s.AssignedSemester > 0) .Sum(s => s.Subject.Lessons.Sum(l => l.HoursAtUniversity)); if ((double)practicalHours / totalHours < 0.4) { errors.Add($"Zajęcia kształtujące umiejętności praktyczne posiadają mniej niż 40% godzin ({(int)((double)practicalHours / totalHours * 100)}%)"); } return(errors); }
public ScaleRangePlacements EvaluatePlacement(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(base.m_gaugePanel, reportScopeInstance); return(EnumTranslator.TranslateScaleRangePlacements(context.ReportRuntime.EvaluateScaleRangePlacementExpression(this, base.m_gaugePanel.Name), context.ReportRuntime)); }
public AspNetCore.ReportingServices.OnDemandReportRendering.Image.SourceType EvaluateSource(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(this.m_map, reportScopeInstance); return(EnumTranslator.TranslateImageSourceType(context.ReportRuntime.EvaluateMapMarkerImageSourceExpression(this, this.m_map.Name), context.ReportRuntime)); }
/* * public void UpdateCurrentSettings(System.Windows.Forms.BindingSource bs, bool updatenow) * { * UpdateCurrentSettings(bs, false, MainV2.comPort); * } */ public void UpdateCurrentSettings(System.Windows.Forms.BindingSource bs, bool updatenow, IMAVLink mavinterface) { if (DateTime.Now > lastupdate.AddMilliseconds(19) || updatenow) // 50 hz { lastupdate = DateTime.Now; if (DateTime.Now.Second != lastwindcalc.Second) { lastwindcalc = DateTime.Now; dowindcalc(); } if (mavinterface.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT] != null) // status text { string logdata = DateTime.Now + " " + Encoding.ASCII.GetString(mavinterface.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT], 6, mavinterface.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT].Length - 6); int ind = logdata.IndexOf('\0'); if (ind != -1) { logdata = logdata.Substring(0, ind); } try { while (messages.Count > 5) { messages.RemoveAt(0); } messages.Add(logdata + "\n"); } catch { } mavinterface.packets[MAVLink.MAVLINK_MSG_ID_STATUSTEXT] = null; } byte[] bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_SCALED]; if (bytearray != null) // hil mavlink 0.9 { var hil = bytearray.ByteArrayToStructure <MAVLink.mavlink_rc_channels_scaled_t>(6); hilch1 = hil.chan1_scaled; hilch2 = hil.chan2_scaled; hilch3 = hil.chan3_scaled; hilch4 = hil.chan4_scaled; hilch5 = hil.chan5_scaled; hilch6 = hil.chan6_scaled; hilch7 = hil.chan7_scaled; hilch8 = hil.chan8_scaled; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_SCALED] = null; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_HIL_CONTROLS]; if (bytearray != null) // hil mavlink 0.9 and 1.0 { var hil = bytearray.ByteArrayToStructure <MAVLink.mavlink_hil_controls_t>(6); hilch1 = (int)(hil.roll_ailerons * 10000); hilch2 = (int)(hil.pitch_elevator * 10000); hilch3 = (int)(hil.throttle * 10000); hilch4 = (int)(hil.yaw_rudder * 10000); //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_HIL_CONTROLS] = null; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_HWSTATUS]; if (bytearray != null) { var hwstatus = bytearray.ByteArrayToStructure <MAVLink.mavlink_hwstatus_t>(6); hwvoltage = hwstatus.Vcc; i2cerrors = hwstatus.I2Cerr; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_HWSTATUS] = null; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT]; if (bytearray != null) { var nav = bytearray.ByteArrayToStructure <MAVLink.mavlink_nav_controller_output_t>(6); nav_roll = nav.nav_roll; nav_pitch = nav.nav_pitch; nav_bearing = nav.nav_bearing; target_bearing = nav.target_bearing; wp_dist = nav.wp_dist; alt_error = nav.alt_error; aspd_error = nav.aspd_error; xtrack_error = nav.xtrack_error; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_NAV_CONTROLLER_OUTPUT] = null; } #if MAVLINK10 bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_HEARTBEAT]; if (bytearray != null) { var hb = bytearray.ByteArrayToStructure <MAVLink.mavlink_heartbeat_t>(6); string oldmode = mode; mode = "Unknown"; if ((hb.base_mode & (byte)MAVLink.MAV_MODE_FLAG.CUSTOM_MODE_ENABLED) != 0) { if (hb.type == (byte)MAVLink.MAV_TYPE.FIXED_WING) { switch (hb.custom_mode) { case (byte)(Common.apmmodes.MANUAL): mode = "Manual"; break; case (byte)(Common.apmmodes.GUIDED): mode = "Guided"; break; case (byte)(Common.apmmodes.STABILIZE): mode = "Stabilize"; break; case (byte)(Common.apmmodes.FLY_BY_WIRE_A): mode = "FBW A"; break; case (byte)(Common.apmmodes.FLY_BY_WIRE_B): mode = "FBW B"; break; case (byte)(Common.apmmodes.AUTO): mode = "Auto"; break; case (byte)(Common.apmmodes.RTL): mode = "RTL"; break; case (byte)(Common.apmmodes.LOITER): mode = "Loiter"; break; case (byte)(Common.apmmodes.CIRCLE): mode = "Circle"; break; default: mode = "Unknown"; break; } } else if (hb.type == (byte)MAVLink.MAV_TYPE.QUADROTOR) { switch (hb.custom_mode) { case (byte)(Common.ac2modes.STABILIZE): mode = "Stabilize"; break; case (byte)(Common.ac2modes.ACRO): mode = "Acro"; break; case (byte)(Common.ac2modes.ALT_HOLD): mode = "Alt Hold"; break; case (byte)(Common.ac2modes.AUTO): mode = "Auto"; break; case (byte)(Common.ac2modes.GUIDED): mode = "Guided"; break; case (byte)(Common.ac2modes.LOITER): mode = "Loiter"; break; case (byte)(Common.ac2modes.RTL): mode = "RTL"; break; case (byte)(Common.ac2modes.CIRCLE): mode = "Circle"; break; case (byte)(Common.ac2modes.LAND): mode = "Land"; break; default: mode = "Unknown"; break; } } } if (oldmode != mode && MainV2.speechEnable && MainV2.getConfig("speechmodeenabled") == "True") { MainV2.speechEngine.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechmode"))); } } bytearray = mavinterface.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS]; if (bytearray != null) { var sysstatus = bytearray.ByteArrayToStructure <MAVLink.mavlink_sys_status_t>(6); battery_voltage = sysstatus.voltage_battery; battery_remaining = sysstatus.battery_remaining; packetdropremote = sysstatus.drop_rate_comm; //MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS] = null; } #else bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SYS_STATUS]; if (bytearray != null) { var sysstatus = bytearray.ByteArrayToStructure <MAVLink.mavlink_sys_status_t>(6); armed = sysstatus.status; string oldmode = mode; switch (sysstatus.mode) { case (byte)ArdupilotMega.MAVLink.MAV_MODE.MAV_MODE_UNINIT: switch (sysstatus.nav_mode) { case (byte)ArdupilotMega.MAVLink.MAV_NAV.MAV_NAV_GROUNDED: mode = "Initialising"; break; } break; case (byte)(100 + Common.ac2modes.STABILIZE): mode = EnumTranslator.GetDisplayText(Common.ac2modes.STABILIZE); break; case (byte)(100 + Common.ac2modes.ACRO): mode = EnumTranslator.GetDisplayText(Common.ac2modes.ACRO); break; case (byte)(100 + Common.ac2modes.ALT_HOLD): mode = EnumTranslator.GetDisplayText(Common.ac2modes.ALT_HOLD); break; case (byte)(100 + Common.ac2modes.AUTO): mode = EnumTranslator.GetDisplayText(Common.ac2modes.AUTO); break; case (byte)(100 + Common.ac2modes.GUIDED): mode = EnumTranslator.GetDisplayText(Common.ac2modes.GUIDED); break; case (byte)(100 + Common.ac2modes.LOITER): mode = EnumTranslator.GetDisplayText(Common.ac2modes.LOITER); break; case (byte)(100 + Common.ac2modes.RTL): mode = EnumTranslator.GetDisplayText(Common.ac2modes.RTL); break; case (byte)(100 + Common.ac2modes.CIRCLE): mode = EnumTranslator.GetDisplayText(Common.ac2modes.CIRCLE); break; case (byte)(100 + Common.ac2modes.LAND): mode = EnumTranslator.GetDisplayText(Common.ac2modes.LAND); break; case (byte)(100 + Common.ac2modes.APPROACH): mode = EnumTranslator.GetDisplayText(Common.ac2modes.APPROACH); break; case (byte)(100 + Common.ac2modes.POSITION): mode = EnumTranslator.GetDisplayText(Common.ac2modes.POSITION); break; case (byte)ArdupilotMega.MAVLink.MAV_MODE.MAV_MODE_MANUAL: mode = "Manual"; break; case (byte)ArdupilotMega.MAVLink.MAV_MODE.MAV_MODE_GUIDED: mode = "Guided"; break; case (byte)ArdupilotMega.MAVLink.MAV_MODE.MAV_MODE_TEST1: mode = "Stabilize"; break; case (byte)ArdupilotMega.MAVLink.MAV_MODE.MAV_MODE_TEST2: mode = "FBW A"; // fall though old switch (sysstatus.nav_mode) { case (byte)1: mode = "FBW A"; break; case (byte)2: mode = "FBW B"; break; case (byte)3: mode = "FBW C"; break; } break; case (byte)ArdupilotMega.MAVLink.MAV_MODE.MAV_MODE_TEST3: mode = "Circle"; break; case (byte)ArdupilotMega.MAVLink.MAV_MODE.MAV_MODE_AUTO: switch (sysstatus.nav_mode) { case (byte)ArdupilotMega.MAVLink.MAV_NAV.MAV_NAV_WAYPOINT: mode = "Auto"; break; case (byte)ArdupilotMega.MAVLink.MAV_NAV.MAV_NAV_RETURNING: mode = "RTL"; break; case (byte)ArdupilotMega.MAVLink.MAV_NAV.MAV_NAV_HOLD: case (byte)ArdupilotMega.MAVLink.MAV_NAV.MAV_NAV_LOITER: mode = "Loiter"; break; case (byte)ArdupilotMega.MAVLink.MAV_NAV.MAV_NAV_LIFTOFF: mode = "Takeoff"; break; case (byte)ArdupilotMega.MAVLink.MAV_NAV.MAV_NAV_LANDING: mode = "Land"; break; } break; default: mode = "Unknown"; break; } battery_voltage = sysstatus.vbat; battery_remaining = sysstatus.battery_remaining; packetdropremote = sysstatus.packet_drop; if (oldmode != mode && MainV2.speechEnable && MainV2.speechEngine != null && MainV2.getConfig("speechmodeenabled") == "True") { MainV2.speechEngine.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechmode"))); } //MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_SYS_STATUS] = null; } #endif bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SCALED_PRESSURE]; if (bytearray != null) { var pres = bytearray.ByteArrayToStructure <MAVLink.mavlink_scaled_pressure_t>(6); press_abs = pres.press_abs; press_temp = pres.temperature; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SENSOR_OFFSETS]; if (bytearray != null) { var sensofs = bytearray.ByteArrayToStructure <MAVLink.mavlink_sensor_offsets_t>(6); mag_ofs_x = sensofs.mag_ofs_x; mag_ofs_y = sensofs.mag_ofs_y; mag_ofs_z = sensofs.mag_ofs_z; mag_declination = sensofs.mag_declination; raw_press = sensofs.raw_press; raw_temp = sensofs.raw_temp; gyro_cal_x = sensofs.gyro_cal_x; gyro_cal_y = sensofs.gyro_cal_y; gyro_cal_z = sensofs.gyro_cal_z; accel_cal_x = sensofs.accel_cal_x; accel_cal_y = sensofs.accel_cal_y; accel_cal_z = sensofs.accel_cal_z; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_ATTITUDE]; if (bytearray != null) { var att = bytearray.ByteArrayToStructure <MAVLink.mavlink_attitude_t>(6); roll = att.roll * rad2deg; pitch = att.pitch * rad2deg; yaw = att.yaw * rad2deg; // Console.WriteLine(roll + " " + pitch + " " + yaw); //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_ATTITUDE] = null; } #if MAVLINK10 bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW_INT]; if (bytearray != null) { var gps = bytearray.ByteArrayToStructure <MAVLink.mavlink_gps_raw_int_t>(6); lat = gps.lat * 1.0e-7f; lng = gps.lon * 1.0e-7f; // alt = gps.alt; // using vfr as includes baro calc gpsstatus = gps.fix_type; // Console.WriteLine("gpsfix {0}",gpsstatus); gpshdop = gps.eph; groundspeed = gps.vel * 1.0e-2f; groundcourse = gps.cog * 1.0e-2f; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW] = null; } #else bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW]; if (bytearray != null) { var gps = bytearray.ByteArrayToStructure <MAVLink.mavlink_gps_raw_t>(6); lat = gps.lat; lng = gps.lon; // alt = gps.alt; // using vfr as includes baro calc gpsstatus = gps.fix_type; // Console.WriteLine("gpsfix {0}",gpsstatus); gpshdop = gps.eph; groundspeed = gps.v; groundcourse = gps.hdg; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_GPS_RAW] = null; } #endif bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GPS_STATUS]; if (bytearray != null) { var gps = bytearray.ByteArrayToStructure <MAVLink.mavlink_gps_status_t>(6); satcount = gps.satellites_visible; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RADIO]; if (bytearray != null) { var radio = bytearray.ByteArrayToStructure <MAVLink.mavlink_radio_t>(6); rssi = radio.rssi; remrssi = radio.remrssi; txbuffer = radio.txbuf; rxerrors = radio.rxerrors; noise = radio.noise; remnoise = radio.remnoise; fixedp = radio.fixedp; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GLOBAL_POSITION_INT]; if (bytearray != null) { var loc = bytearray.ByteArrayToStructure <MAVLink.mavlink_global_position_int_t>(6); //alt = loc.alt / 1000.0f; lat = loc.lat / 10000000.0f; lng = loc.lon / 10000000.0f; } #if MAVLINK10 bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_MISSION_CURRENT]; if (bytearray != null) { var wpcur = bytearray.ByteArrayToStructure <MAVLink.mavlink_mission_current_t>(6); int oldwp = (int)wpno; wpno = wpcur.seq; if (oldwp != wpno && MainV2.speechEnable && MainV2.getConfig("speechwaypointenabled") == "True") { MainV2.speechEngine.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechwaypoint"))); } //MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_WAYPOINT_CURRENT] = null; } #else bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_GLOBAL_POSITION]; if (bytearray != null) { var loc = bytearray.ByteArrayToStructure <MAVLink.mavlink_global_position_t>(6); alt = loc.alt; lat = loc.lat; lng = loc.lon; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_WAYPOINT_CURRENT]; if (bytearray != null) { var wpcur = bytearray.ByteArrayToStructure <MAVLink.mavlink_waypoint_current_t>(6); int oldwp = (int)wpno; wpno = wpcur.seq; if (oldwp != wpno && MainV2.speechEnable && MainV2.speechEngine != null && MainV2.getConfig("speechwaypointenabled") == "True") { MainV2.speechEngine.SpeakAsync(Common.speechConversion(MainV2.getConfig("speechwaypoint"))); } //MAVLink.packets[ArdupilotMega.MAVLink.MAVLINK_MSG_ID_WAYPOINT_CURRENT] = null; } #endif bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_RAW]; if (bytearray != null) { var rcin = bytearray.ByteArrayToStructure <MAVLink.mavlink_rc_channels_raw_t>(6); ch1in = rcin.chan1_raw; ch2in = rcin.chan2_raw; ch3in = rcin.chan3_raw; ch4in = rcin.chan4_raw; ch5in = rcin.chan5_raw; ch6in = rcin.chan6_raw; ch7in = rcin.chan7_raw; ch8in = rcin.chan8_raw; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_RC_CHANNELS_RAW] = null; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SERVO_OUTPUT_RAW]; if (bytearray != null) { var servoout = bytearray.ByteArrayToStructure <MAVLink.mavlink_servo_output_raw_t>(6); ch1out = servoout.servo1_raw; ch2out = servoout.servo2_raw; ch3out = servoout.servo3_raw; ch4out = servoout.servo4_raw; ch5out = servoout.servo5_raw; ch6out = servoout.servo6_raw; ch7out = servoout.servo7_raw; ch8out = servoout.servo8_raw; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_SERVO_OUTPUT_RAW] = null; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_RAW_IMU]; if (bytearray != null) { var imu = bytearray.ByteArrayToStructure <MAVLink.mavlink_raw_imu_t>(6); gx = imu.xgyro; gy = imu.ygyro; gz = imu.zgyro; ax = imu.xacc; ay = imu.yacc; az = imu.zacc; mx = imu.xmag; my = imu.ymag; mz = imu.zmag; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_RAW_IMU] = null; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_SCALED_IMU]; if (bytearray != null) { var imu = bytearray.ByteArrayToStructure <MAVLink.mavlink_scaled_imu_t>(6); gx = imu.xgyro; gy = imu.ygyro; gz = imu.zgyro; ax = imu.xacc; ay = imu.yacc; az = imu.zacc; //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_RAW_IMU] = null; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_VFR_HUD]; if (bytearray != null) { var vfr = bytearray.ByteArrayToStructure <MAVLink.mavlink_vfr_hud_t>(6); groundspeed = vfr.groundspeed; airspeed = vfr.airspeed; alt = vfr.alt; // this might include baro //climbrate = vfr.climb; if ((DateTime.Now - lastalt).TotalSeconds >= 0.2 && oldalt != alt) { climbrate = (alt - oldalt) / (float)(DateTime.Now - lastalt).TotalSeconds; verticalspeed = (alt - oldalt) / (float)(DateTime.Now - lastalt).TotalSeconds; if (float.IsInfinity(_verticalspeed)) { _verticalspeed = 0; } lastalt = DateTime.Now; oldalt = alt; } //MAVLink.packets[MAVLink.MAVLINK_MSG_ID_VFR_HUD] = null; } bytearray = mavinterface.packets[MAVLink.MAVLINK_MSG_ID_MEMINFO]; if (bytearray != null) { var mem = bytearray.ByteArrayToStructure <MAVLink.mavlink_meminfo_t>(6); freemem = mem.freemem; brklevel = mem.brkval; } } //Console.WriteLine(DateTime.Now.Millisecond + " start "); // update form try { if (bs != null) { //System.Diagnostics.Debug.WriteLine(DateTime.Now.Millisecond); //Console.WriteLine(DateTime.Now.Millisecond); bs.DataSource = this; //Console.WriteLine(DateTime.Now.Millisecond + " 1 " + updatenow); bs.ResetBindings(false); //Console.WriteLine(DateTime.Now.Millisecond + " done "); } } catch { log.InfoFormat("CurrentState Binding error"); } }
public MapResizeMode EvaluateResizeMode(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(this.m_map, reportScopeInstance); return(EnumTranslator.TranslateMapResizeMode(context.ReportRuntime.EvaluateMapMarkerImageResizeModeExpression(this, this.m_map.Name), context.ReportRuntime)); }
internal ChartSeparators EvaluateColumnSeparator(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(m_chart, reportScopeInstance); return(EnumTranslator.TranslateChartSeparator(context.ReportRuntime.EvaluateChartLegendColumnSeparatorExpression(this, m_chart.Name, "ColumnSeparator"), context.ReportRuntime)); }
internal LinearPointerTypes EvaluateType(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(m_gaugePanel, reportScopeInstance); return(EnumTranslator.TranslateLinearPointerTypes(context.ReportRuntime.EvaluateLinearPointerTypeExpression(this, m_gaugePanel.Name), context.ReportRuntime)); }
public MapTextAntiAliasingQuality EvaluateTextAntiAliasingQuality(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(this, reportScopeInstance); return(EnumTranslator.TranslateMapTextAntiAliasingQuality(context.ReportRuntime.EvaluateMapTextAntiAliasingQualityExpression(this, base.Name), context.ReportRuntime)); }
public ChartSeparators EvaluateHeaderSeparator(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(base.m_chart, reportScopeInstance); return(EnumTranslator.TranslateChartSeparator(context.ReportRuntime.EvaluateChartLegendHeaderSeparatorExpression(this, base.m_chart.Name, "HeaderSeparator"), context.ReportRuntime)); }
internal Unit EvaluateUnit(IReportScopeInstance reportScopeInstance, OnDemandProcessingContext context) { context.SetupContext(m_map, reportScopeInstance); return(EnumTranslator.TranslateUnit(context.ReportRuntime.EvaluateMapSizeUnitExpression(this, m_map.Name), context.ReportRuntime)); }
public DataSet SearchPackageList(string keyword, string category, string unitCode, Common.Entities.Enum.PackageClientType clientType, Common.Entities.Enum.PackageTrait trait, int page, int pageSize, out int pageCount, out int recordCount, string uid, int is_webapp) { if (pageSize == 0) { pageSize = 10; } string sClientType = EnumTranslator.TransPackageClientTypeToString(clientType); string sql = "select * from smc_packageext where 1=1"; sql += " and pe_usefulststus=1"; if (!String.IsNullOrEmpty(keyword)) { sql += " and pe_Name like '%" + keyword + "%'"; } if (!String.IsNullOrEmpty(category)) { sql += " and pe_CategoryID like '%" + category + "%'"; } if (!String.IsNullOrEmpty(unitCode)) { sql += " and pe_UnitCode = '" + unitCode + "'"; } if (!String.IsNullOrEmpty(sClientType)) { sql += " and pe_ClientType = '" + sClientType + "'"; } if (is_webapp > 0) { sql += " and tablename='WebApplication' "; } else if (is_webapp < 0) { sql += " and tablename <>'WebApplication' "; } if (trait != Common.Entities.Enum.PackageTrait.All) { if (trait == Common.Entities.Enum.PackageTrait.Bibei) { sql += " and pe_Isbb=1"; } else if (trait == Common.Entities.Enum.PackageTrait.Tuijian) { sql += " and pe_IsTJ=1"; } } string order = "pe_CreatedTime desc"; if (trait == Common.Entities.Enum.PackageTrait.Sc) { sql = "select ext.* from smc_collect c join smc_packageext ext on ext.pe_id=c.pe_id where c.uid='" + uid + "'"; sql += " and ext.pe_usefulststus=1"; order = "ext.pe_CreatedTime desc"; } string tableName = SmartBox.Console.Common.StoredProcedureHelper.GetTableName(sql); string columns = SmartBox.Console.Common.StoredProcedureHelper.GetColumns(sql); string where = SmartBox.Console.Common.StoredProcedureHelper.GetWhere(sql); if (trait == Common.Entities.Enum.PackageTrait.ZX) { columns = " top 20 " + columns; } string table = sql; SqlParameter[] pars = new SqlParameter[] { new SqlParameter("@TableName", tableName), new SqlParameter("@Columns", columns), new SqlParameter("@CurrentPageIndex", page), new SqlParameter("@PageSize", pageSize), new SqlParameter("@RecordCount", 0), new SqlParameter("@PAGECOUNT", 0), new SqlParameter("@OrderByColumns", order), new SqlParameter("@Where", where), new SqlParameter("@WITH", "") }; pars[4].Direction = ParameterDirection.InputOutput; pars[5].Direction = ParameterDirection.InputOutput; DataSet ds = this.ExecuteDataset("Select_Pagination_ex", CommandType.StoredProcedure, pars); pageCount = Convert.ToInt32(pars[5].Value); recordCount = Convert.ToInt32(pars[4].Value); return(ds); }