using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Tango.BL;
using Tango.BL.Entities;
using Tango.BL.Enumerations;
using Tango.Core.Commands;
using Tango.PPC.Common;
using Tango.PPC.Common.Lubrication;
using Tango.Settings;
using Tango.SharedUI;
namespace Tango.PPC.Jobs.Dialogs
{
/// <summary>
/// Represents the a job type picker view model
/// </summary>
/// <seealso cref="Tango.SharedUI.DialogViewVM" />
public class JobCreationViewVM : DialogViewVM
{
private String _jobName;
public String JobName
{
get { return _jobName; }
set { _jobName = value;
RaisePropertyChangedAuto();
OKCommand.RaiseCanExecuteChanged();
}
}
private List<Rml> _rmls;
/// <summary>
/// Gets or sets the available RMLS.
/// </summary>
public List<Rml> Rmls
{
get { return _rmls; }
set { _rmls = value; RaisePropertyChangedAuto(); }
}
private Rml _selectedRML;
/// <summary>
/// Gets or sets the selected RML.
/// </summary>
public Rml SelectedRML
{
get { return _selectedRML; }
set {
if(_selectedRML != value)
{
_selectedRML = value;
OnRmlSelectionChanged();
RaisePropertyChangedAuto();
OKCommand.RaiseCanExecuteChanged();
}
}
}
private List<SpoolType> _spoolTypes;
/// <summary>
/// Gets or sets the available spool types.
/// </summary>
public List<SpoolType> SpoolTypes
{
get { return _spoolTypes; }
set { _spoolTypes = value;
RaisePropertyChangedAuto();
OKCommand.RaiseCanExecuteChanged();
}
}
private SpoolType _selectedSpoolType;
/// <summary>
/// Gets or sets the type of the selected spool.
/// </summary>
public SpoolType SelectedSpoolType
{
get { return _selectedSpoolType; }
/************************************************************************************************************************
* control.c
* Control module
*
* The control module is hardware agnostic, not related to a specific hardware module, to enable it to deal with hardware and system changes easily.
* The control module contains a high priority task that connects the hardware drivers
* below to the control algorithms of the high level system modules above.
*
* The control task is invoked by a message from a 1 millisecond timer interrupt.
* The module is based on system components registered in the control module, supplying callback hooks for information gathering and distribution.
* All control clients (drivers and modules) will not perform long procedures that will block the control task.
*
* Control interfaces:
* System Devices list:
*
* All control system input devices will be listed in a system-shared enumareted list, to create a common language between the modules and the drivers.
* (The list will include all hardware devices, but for this module only control input devices are valid)
* Drivers:
* Device registration: a driver that initializes a control input device will call the ControlDeviceRegister function with the deviceId,
* and a control callback hook. This callback is called with a deviceId as the parameter, and returns an unsigned 32bit integer
* as a read value and a call status. The callback will be a non-blocking call, and will indicate in the status value if the data is valid.
*
* It is the responsibility of the device driver to update the control information according to the module hardware requirements.
* If the polling of the information is immediate, it can be collected at the callback call (e.g. local GPI).
*
* Module registration � control: a module is registering to receive the value of the input from a specific device.
* The module indicates what will be the desired frequency of the device polling (in milliseconds).
* It supplies a callback routine that will receive the deviceId, the control value status and the control value.
* The callback will be a non-blocking call.
* The polling frequency is one of a specific list of frequencies: 1/10/100/1000 Hz. (others - TBD)
*
*
* Registering a request for control information from a device that is not registered will be rejected.
* The device registration process must be performed before module registration process.
*
* Unregistering: when control information is not needed, the module will unregister the device polling request from the control module.
* There is a separate call for control hooks and for report hooks.
* The unregistering command contains the callback function pointer, to enable distribution of control
* information of the same device to more than one destination.
*
**************************************************************************************************************************/
////////////////////////////////State machine operation////////////////////////////////////
//the state machine operation is used to operate in runtime correct profile flow execution
//by recieved esign flow of the user from the UI
///////////////////////////////////////////////////////////////////////////////////////////
#include "include.h"
#include <driverlib/timer.h>
#include <inc/hw_ints.h>
#include <PMR/Diagnostics/EventType.pb-c.h>
#include "drivers/FPGA/Full_Vme/FPGA_Programming_Up.h"
#include "drivers/adc_sampling/adc.h"
#include "drivers/FPGA/FPGA_GPIO/FPGA_GPIO.h"
#include "drivers/FPGA/FPGA_SPI_Comm.h"
#include "Modules/General/buttons.h"
#include "Modules/General/GeneralHardware.h"
#include "Modules/AlarmHandling/AlarmHandling.h"
#include "StateMachines/Printing/PrintingSTM.h"
#include "control.h"
#include "MillisecTask.h"
#define DURATION_LIMIT 6
/******************** Definitions ********************************************/
#define MAX_TANGO_CONTROL_DEVICES 100
/******************** STRUCTURES AND ENUMs ********************************************/
typedef struct
{
uint32_t PartId; // the identity of the inspected/controlled part in the Devices enum.
bool ControlActive;
uint32_t Parameter1;
uint16_t IfIndex;
uint32_t StartTick;
DataReadCBFunction ControlDataReadPtr;
ControlCBFunction ControlCallbackPtr;
uint32_t ControlTiming;
char *Name;
}ControlDeviceStruc;
typedef enum
{
OneMillisec,
}controlMessages;
typedef struct ControlMessage{
uint16_t messageId;
uint16_t msglen;
uint32_t tick;
uint8_t messageData[20];
}ControlMessageStruc;
int ControlPhaseDelay = 300; //the control task enters only after data gathering in the millisecond task is finished.
//this parameters defines how many microseconds in the delay. it is used only on starting the control loop on the first time
/******************** GLOBAL PARAMETERS ********************************************/
Mailbox_Handle ControlMsgQ = NULL;
Mailbox_Handle TenControlMsgQ = NULL;
bool ControlRestart;
static GateMutex_Handle gateControlDB;
Task_Handle Control_Task_Handle;
ControlDeviceStruc ControlArray[MAX_TANGO_CONTROL_DEVICES];
uint32_t ControlDatalog[MAX_TANGO_CONTROL_DEVICES];
#define MAX_BACKLOG_SIZE 100
uint16_t ControlBacklog[MAX_BACKLOG_SIZE]={0};
uint32_t ControlTime[MAX_TANGO_CONTROL_DEVICES]={0};
uint16_t backlogindex = 0;
uint32_t Control_timerBase = TIMER0_BASE; //Timer handle
uint32_t MaxHighDevices = 0xFF;
/******************** Functions ********************************************/
void OneMilliSecondFunction(UArg arg0);
//**********************************************************************
/******************** CODE ********************************************/
//**********************************************************************
uint32_t TemplateDataReadCBFunction (uint32_t deviceID, uint32_t Parameter1)
{
return 0;
}
void ControlInit(void)
{
int Device_i;
Error_Block eb;
//Mailbox_Params_init(&ControlMsgQ);
ControlMsgQ = Mailbox_create(sizeof(ControlMessageStruc), 1, NULL