当前位置: 首页>>代码示例>>Java>>正文


Java RawProtocolMessage类代码示例

本文整理汇总了Java中nu.nethome.util.ps.RawProtocolMessage的典型用法代码示例。如果您正苦于以下问题:Java RawProtocolMessage类的具体用法?Java RawProtocolMessage怎么用?Java RawProtocolMessage使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


RawProtocolMessage类属于nu.nethome.util.ps包,在下文中一共展示了RawProtocolMessage类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: addRawTableRow

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
protected void addRawTableRow(RawProtocolMessage message) {
      TableItem item1 = new TableItem(m_Table, SWT.NONE);
      String text[] = new String[NO_COLUMNS];
      DateFormat df = new SimpleDateFormat(Messages.getString("MainWindow.HHmmssSSS")); //$NON-NLS-1$
      Date now = new Date();
      text[0] = df.format(now);
      text[1] = "[Sample]";
      text[2] = "-";
      text[3] = "-";
double sampleLength = 0;
if (message.m_Samples.size() != 0) {
	sampleLength = 1000D * message.m_Samples.size() / message.m_SampleFrequency;
} else {
	for (Double pulse : message.m_PulseLengths) {
		sampleLength += pulse;
	}
	sampleLength = sampleLength / 1000.0;
}
      text[4] = String.format("%.2f ms", sampleLength);
      text[5] = "-";
      item1.setText(text);
      item1.setData(message);
  }
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:24,代码来源:MainWindow.java

示例2: ReportMessage

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
private void ReportMessage(boolean trimEnd) {
    // First we trim  off the space from the samples
    for (int i = samples.size() - 1; trimEnd && (i > sampleCountAtLastPulse); i--) {
        samples.remove(i);
    }
    RawProtocolMessage message = new RawProtocolMessage(pulsePositions, samples, sampleFrequency, pulseLengths);
    // Report the parsed message
    decoderSink.parsedMessage(message);
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:10,代码来源:RawDecoder.java

示例3: parsedRawMessage

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
public void parsedRawMessage(RawProtocolMessage message) {
	// Because all window operations has to be done in the Window thread,
	// we have to leave this for later execusion. The IrWindowMessage class
	// run-method will call the addTableRow method.
	if (m_ShowRaw) {
		Display.getDefault().asyncExec(new RawProtocolWindowMessage(message));
	}
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:9,代码来源:MainWindow.java

示例4: exportPulseData

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
/**
 * Export the pulse data of the currently selected sample
 */
protected void exportPulseData() {

	// Make sure we have a line selected
	if (m_Table.getSelectionCount() == 0)
		return;
	ProtocolMessage message = (ProtocolMessage) m_Table.getSelection()[0]
			.getData();

	// Check that it is a raw sample
	if (!message.getProtocol().equals("Raw")) {  //$NON-NLS-1$
		return;
	}
	RawProtocolMessage mess = (RawProtocolMessage) message;

	FileDialog save = new FileDialog(m_Shell, SWT.SAVE);
	save.setText(Messages.getString("MainWindow.ExportData")); //$NON-NLS-1$

	// Ask for export file name
	String fileName = save.open();
	if (fileName == null) {
		return;
	}

	// Save all pulses
	PrintWriter out;
	try {
		out = new PrintWriter(new FileWriter(fileName));
		char pulseType = 's';
		// Loop through all pulses
		for (double pulse : mess.m_PulseLengths) {
			out.println(String.format("%c%.0f", pulseType, pulse));  //$NON-NLS-1$
			pulseType = (pulseType == 's') ? 'm' : 's';
		}
		out.close();
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:42,代码来源:MainWindow.java

示例5: reanalyzePulseData

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
/**
 * Reanalyze the pulse data of the currently selected sample
 */
protected void reanalyzePulseData() {

	// Make sure we have a line selected
	if (m_Table.getSelectionCount() == 0)
		return;
	ProtocolMessage message = (ProtocolMessage) m_Table.getSelection()[0]
			.getData();

	// Check that it is a raw sample
	if (!message.getProtocol().equals("Raw")) {  //$NON-NLS-1$
		return;
	}
	RawProtocolMessage mess = (RawProtocolMessage) message;

	boolean currentlySampling = m_Model.isScanning();
	// Pause current sampler so we do not mix signals
	m_Model.stopScanning();

	// Loop through all pulses
	boolean state = false;
	//m_Model.getProtocolDecoders().parse(30000.0, false);
	for (double pulse : mess.m_PulseLengths) {
		// Feed pulses to decoders
		m_Model.getProtocolDecoders().parse(pulse, state);
		state = !state;
	}
	// Add a long quiet period to end detection
	m_Model.getProtocolDecoders().parse(200000.0, false);

	// Restart port (if it was sampling)
	if (currentlySampling) {
		m_Model.startScanning();
	}
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:38,代码来源:MainWindow.java

示例6: reanalyzeSampleData

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
/**
 * Export the pulse data of the currently selected sample
 */
protected void reanalyzeSampleData() {

	// Make sure we have a line selected
	if (m_Table.getSelectionCount() == 0)
		return;
	ProtocolMessage message = (ProtocolMessage) m_Table.getSelection()[0]
			.getData();

	// Check that it is a raw sample
	if (!message.getProtocol().equals("Raw")) {  //$NON-NLS-1$
		return;
	}
	RawProtocolMessage mess = (RawProtocolMessage) message;

	boolean currentlySampling = m_Model.isScanning();
	// Pause current sampler so we do not mix signals
	m_Model.stopScanning();

	// Loop through all samples
	for (int sample : mess.m_Samples) {
		// Feed pulses to decoders
		m_Model.getProtocolSamplers().addSample(sample);
	}
	// Add a quiet period (200ms)to end detection
	int numberOfEndSamples = m_Model.getFlankDetector().getSampleRate() / 5;
	for (int i = 0; i < numberOfEndSamples; i++) {
		m_Model.getProtocolSamplers().addSample(0);
	}

	// Restart port (if it was sampling)
	if (currentlySampling) {
		m_Model.startScanning();
	}
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:38,代码来源:MainWindow.java

示例7: SignalTab

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
public SignalTab(RawProtocolMessage message, CTabFolder chartFolder) {
    // Check what kind of data we have, if it is only pulses, then just generate
    // the pulse series and if we have samples, then generate the sampleSeries as well
    if (messageHasOnlyPulseData(message)) {
        signalSeriesCollection = createPlotDataFromPulsesOnly(message.m_PulseLengths);
    } else {
        signalSeriesCollection = createPlotDataFromSamplesAndPulses(message);
    }
    selectedPulseSeries = new XYSeries("Selected Pulses", false);
    signalSeriesCollection.addSeries(selectedPulseSeries);

    // Create tab for signal
    CTabItem signalTab = new CTabItem(chartFolder, SWT.NONE);
    signalTab.setText("Signal");

    // Create a Chart and a panel for signal
    JFreeChart chart = ChartFactory.createXYLineChart("Signal", "ms", "Amplitude", signalSeriesCollection, PlotOrientation.VERTICAL, true, false, false);
    ChartPanel chartPanel = new ChartPanel(chart);
    chartPanel.setPreferredSize(new Dimension(700, 290));
    RawSignalWindow.configurePanelLooks(chart, 2);

    // Create a ChartComposite on our window
    ChartComposite frame = new ChartComposite(chartFolder, SWT.NONE, chart, true);
    frame.setHorizontalAxisTrace(false);
    frame.setVerticalAxisTrace(false);
    frame.setDisplayToolTips(true);
    GridData gridDatap = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    gridDatap.grabExcessHorizontalSpace = true;
    gridDatap.grabExcessVerticalSpace = false;
    //gridDatap.heightHint = 270;
    frame.setLayoutData(gridDatap);
    signalTab.setControl(frame);
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:34,代码来源:SignalTab.java

示例8: createPlotDataFromSamplesAndPulses

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
XYSeriesCollection createPlotDataFromSamplesAndPulses(RawProtocolMessage message) {
    double x = 0.0;
    boolean level = false;
    int sampleNumber = 0;
    Iterator<Integer> pulses = message.m_PulseList.iterator();
    int nextPulse = pulses.hasNext() ? pulses.next() : 0;
    XYSeriesCollection signalSeriesCollection = new XYSeriesCollection();
    XYSeries pulseSeries = new XYSeries("Parsed data");
    XYSeries sampleSeries = new XYSeries("Raw data");

    // Loop through the samples and pulses and generate coordinates for plotting
    for (double value : message.m_Samples) {
        sampleSeries.add(x, value);
        // Check if we have reached a pulse flank
        if (sampleNumber == nextPulse) {
            pulseSeries.add(x, level ? PARSED_1 : PARSED_0);
            level = !level;
            pulseSeries.add(x, level ? PARSED_1 : PARSED_0);
            nextPulse = pulses.hasNext() ? pulses.next() : 0;
        }
        x += 1000.0 / message.m_SampleFrequency;
        sampleNumber++;
    }
    signalSeriesCollection.addSeries(pulseSeries);
    signalSeriesCollection.addSeries(sampleSeries);
    return signalSeriesCollection;
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:28,代码来源:SignalTab.java

示例9: PulseDistributionTab

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
public PulseDistributionTab(RawProtocolMessage message, CTabFolder chartFolder) {
    distributionData = createPulseDistributionPlot(message.m_PulseLengths);
    selectedIntervalSeries = new XYSeries("Selected Interval");
    distributionData.addSeries(selectedIntervalSeries);

    CTabItem distributionTab = new CTabItem(chartFolder, SWT.NONE);
    distributionTab.setText("Pulse length Distribution");

    // Create a Chart and a panel for pulse length distribution
    JFreeChart distributionChart = ChartFactory.createXYLineChart("Pulse Length Distribution", "Pulse Length (us)", "# Pulses", distributionData, PlotOrientation.VERTICAL, true, false, false);
    ChartPanel distributionChartPanel = new ChartPanel(distributionChart);
    RawSignalWindow.configurePanelLooks(distributionChart, 2);
    distributionChartPanel.setPreferredSize(new Dimension(700, 270));// 270

    // Make the mark line dashed, so we can see the space line when they overlap
    float pattern[] = {5.0f, 5.0f};
    BasicStroke stroke = new BasicStroke(1.0f, BasicStroke.CAP_BUTT, BasicStroke.JOIN_MITER, 1.0f, pattern, 0.0f);
    XYLineAndShapeRenderer renderer = (XYLineAndShapeRenderer) distributionChart.getXYPlot().getRenderer();
    renderer.setSeriesStroke(0, stroke);

    // Create a ChartComposite on our tab for pulse distribution
    ChartComposite distributionFrame = new ChartComposite(chartFolder, SWT.NONE, distributionChart, true);
    distributionFrame.setHorizontalAxisTrace(false);
    distributionFrame.setVerticalAxisTrace(false);
    distributionFrame.setDisplayToolTips(true);
    GridData distributionGridData = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_BEGINNING);
    distributionGridData.grabExcessHorizontalSpace = true;
    distributionGridData.grabExcessVerticalSpace = false;
    distributionGridData.heightHint = 270;
    distributionFrame.setLayoutData(distributionGridData);
    distributionTab.setControl(distributionFrame);
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:33,代码来源:PulseDistributionTab.java

示例10: parsedRawMessage

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
public void parsedRawMessage(RawProtocolMessage message) {
	m_View.parsedRawMessage(message);
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:4,代码来源:Main.java

示例11: createPlotDataFromSamplesAndPulses

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
private XYSeriesCollection createPlotDataFromSamplesAndPulses(RawProtocolMessage message) {

        // Loop through the samples and pulses and generate coordinates for plotting
        return signalTab.createPlotDataFromSamplesAndPulses(message);
    }
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:6,代码来源:RawSignalWindow.java

示例12: messageHasOnlyPulseData

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
private boolean messageHasOnlyPulseData(RawProtocolMessage message) {
    return signalTab.messageHasOnlyPulseData(message);
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:4,代码来源:RawSignalWindow.java

示例13: RawProtocolWindowMessage

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
public RawProtocolWindowMessage(RawProtocolMessage message) {
	this.message = message;
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:4,代码来源:MainWindow.java

示例14: messageHasOnlyPulseData

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
boolean messageHasOnlyPulseData(RawProtocolMessage message) {
    return message.m_Samples.size() == 0;
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:4,代码来源:SignalTab.java

示例15: markSelectedPulses

import nu.nethome.util.ps.RawProtocolMessage; //导入依赖的package包/类
void markSelectedPulses(double minLength, double maxLength, boolean isMark, RawProtocolMessage rawMessage) {
    Iterator<Integer> samples = rawMessage.m_Samples.iterator();
    Iterator<Integer> pulses = rawMessage.m_PulseList.iterator();

    double x = 0.0;
    double lastX = 0;
    int lastFlank = 0;
    boolean level = false;
    int sampleNumber = 0;
    int nextPulse = pulses.hasNext() ? pulses.next() : 0;

    // Remove the selection data series from the view to speed up handling
    signalSeriesCollection.removeSeries(selectedPulseSeries);

    // Clear them
    selectedPulseSeries.clear();

    // Check what kind of data we have, if it is only pulses, generate from them
    // and if we have samples, then generate from the samples
    if (messageHasOnlyPulseData(rawMessage)) {
        // Generate from pulse series
        for (double pulse : rawMessage.m_PulseLengths) {
            x += pulse;
            // Check if the pulse matches our interval
            if ((pulse >= (minLength - 0.5)) && (pulse <= (maxLength + 0.5)) && (isMark == level)) {
                // If it does, plot the pulse
                //m_SelectedPulseSeries.add(Double.NaN, Double.NaN);
                selectedPulseSeries.add(lastX / 1000, SELECTION_MARK);
                selectedPulseSeries.add(x / 1000, SELECTION_MARK);
                selectedPulseSeries.add(Double.NaN, Double.NaN);
            }
            lastX = x;
            level = !level;
        }
    } else {
        // Loop through the samples and pulses and plot the pulses matching the length interval
        while (samples.hasNext()) {
            samples.next();

            // Check if we have reached a pulse flank
            if (sampleNumber == nextPulse) {
                nextPulse = pulses.hasNext() ? pulses.next() : 0;

                // calculate the pulse length
                double length = (sampleNumber - lastFlank) * 1000000.0 / rawMessage.m_SampleFrequency;

                // Check if the pulse matches our interval
                if ((length >= (minLength - 0.5)) && (length <= (maxLength + 0.5)) && (isMark == level)) {
                    // If it does, plot the pulse
                    //m_SelectedPulseSeries.add(Double.NaN, Double.NaN);
                    selectedPulseSeries.add(lastX, SELECTION_MARK);
                    selectedPulseSeries.add(x, SELECTION_MARK);
                    selectedPulseSeries.add(Double.NaN, Double.NaN);
                }
                lastFlank = sampleNumber;
                lastX = x;
                level = !level;
            }
            x += 1000.0 / rawMessage.m_SampleFrequency;
            sampleNumber++;
        }
    }

    // Add the selection series to the graph again
    signalSeriesCollection.addSeries(selectedPulseSeries);
}
 
开发者ID:NetHome,项目名称:ProtocolAnalyzer,代码行数:67,代码来源:SignalTab.java


注:本文中的nu.nethome.util.ps.RawProtocolMessage类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。