sysperfana/perfinvestigator/com.nokia.carbide.cpp.pi.power/src/com/nokia/carbide/cpp/pi/power/PwrSample.java
author Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
Wed, 23 Jun 2010 15:05:09 +0300
changeset 12 ae255c9aa552
parent 2 b9ab3b238396
permissions -rw-r--r--
Performance Investigator Carbide extension 2.4.0
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     1
/*
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     2
 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     3
 * All rights reserved.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     4
 * This component and the accompanying materials are made available
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     6
 * which accompanies this distribution, and is available
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     8
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
     9
 * Initial Contributors:
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    10
 * Nokia Corporation - initial contribution.
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    11
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    12
 * Contributors:
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    13
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    14
 * Description: 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    15
 *
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    16
 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    17
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    18
package com.nokia.carbide.cpp.pi.power;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    19
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    20
import com.nokia.carbide.cpp.internal.pi.model.GenericSample;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    21
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    22
/**
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    23
 * A class representing a multimeter reading in amperes
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    24
 */
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    25
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    26
public class PwrSample extends GenericSample 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    27
{   
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    28
	private static final long serialVersionUID = 3943366134331361386L;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    29
	public double current;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    30
    public double capacity;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    31
    public double voltage;
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    32
    public int backlight;
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    33
    
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    34
    public PwrSample( long time, double ampValue, double voltage, double capacity ) 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    35
	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    36
        this.current = ampValue;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    37
        this.capacity = capacity;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    38
        this.voltage = voltage;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    39
        this.sampleSynchTime = time;
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    40
    }
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    41
    
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    42
    public PwrSample( long time, double ampValue, double voltage, double capacity, int backlight) 
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    43
	{
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    44
        this.current = ampValue;
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    45
        this.capacity = capacity;
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    46
        this.voltage = voltage;
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    47
        this.sampleSynchTime = time;
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    48
        this.backlight = backlight;
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    49
    }
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    50
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    51
    public String toString() 
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    52
	{
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    53
        return Messages.getString("PwrSample.toString1") + this.sampleSynchTime + Messages.getString("PwrSample.toString2") //$NON-NLS-1$ //$NON-NLS-2$
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    54
        		+ this.current + Messages.getString("PwrSample.toString3") + this.voltage + Messages.getString("PwrSample.toString4") //$NON-NLS-1$ //$NON-NLS-2$
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    55
        		+ this.capacity +Messages.getString("PwrSample.toString5")+ PwrSample.getBacklightInformation(backlight) +Messages.getString("PwrSample.toString6"); //$NON-NLS-1$ //$NON-NLS-2$
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    56
    }
12
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    57
    
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    58
    public static String getBacklightInformation(int code){
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    59
		switch (code) {
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    60
		case 0:	
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    61
			return Messages.getString("PwrSample.backlightUnknown"); //$NON-NLS-1$
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    62
		case 1:		
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    63
			return Messages.getString("PwrSample.backlightOn"); //$NON-NLS-1$
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    64
		case 2:	
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    65
			return Messages.getString("PwrSample.backlightOff"); //$NON-NLS-1$
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    66
		case 3:		
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    67
			return Messages.getString("PwrSample.backlightBlink"); //$NON-NLS-1$
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    68
		default:
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    69
			return Messages.getString("PwrSample.backlightUnknown"); //$NON-NLS-1$
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    70
		}	
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    71
	}
ae255c9aa552 Performance Investigator Carbide extension 2.4.0
Toni Pulkkinen <ext-toni.p.pulkkinen@nokia.com>
parents: 2
diff changeset
    72
	
2
b9ab3b238396 Initial version of Performance Investigator under EPL
Matti Laitinen <matti.t.laitinen@nokia.com>
parents:
diff changeset
    73
}