cleanup mts

git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@244 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
kascade 2009-10-18 01:06:27 +00:00
parent 2e27699d56
commit d563c6d068
4 changed files with 22 additions and 44 deletions

View File

@ -23,11 +23,8 @@ import com4j.Com4jObject;
import com4j.IID;
import com4j.VTID;
/**
* IMTS Interface
*/
@IID("{FCE3DA3F-110C-4781-B751-ABDC039BCF18}")
public interface IMTS extends Com4jObject {
public interface MTS extends Com4jObject {
/**
* Get number of MTS ports available
*/
@ -44,14 +41,13 @@ public interface IMTS extends Com4jObject {
* CurrentMTSPort
*/
@VTID(9)
void currentPort(
int pVal);
void currentPort(int pVal);
/**
* MTS Port Name
*/
@VTID(10)
java.lang.String portName();
String portName();
/**
* Attempt an MTS Connection
@ -81,26 +77,25 @@ public interface IMTS extends Com4jObject {
* Current MTS Input
*/
@VTID(15)
void currentInput(
int pVal);
void currentInput(int pVal);
/**
* Name of Current Input
*/
@VTID(16)
java.lang.String inputName();
String inputName();
/**
* Units used by Input
*/
@VTID(17)
java.lang.String inputUnit();
String inputUnit();
/**
* Name of Device Providing Input
*/
@VTID(18)
java.lang.String inputDeviceName();
String inputDeviceName();
/**
* Type of Device Providing Input
@ -167,5 +162,4 @@ public interface IMTS extends Com4jObject {
*/
@VTID(29)
void startData();
}

View File

@ -17,39 +17,28 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.romraider.logger.innovate.mts.events;
package com.romraider.logger.innovate.mts;
import com4j.DISPID;
import com4j.IID;
/**
* _IMTSEvents Interface
*/
@IID("{4A8AA6AC-E180-433E-8871-A2F8D2413F03}")
public abstract class _IMTSEvents {
public interface MTSEvents {
/**
* Triggered to indicate MTS connection result
*/
@DISPID(1)
public void connectionEvent(
int result) {
throw new UnsupportedOperationException();
}
void connectionEvent(int result);
/**
* Triggered when an error occurs on the MTS data stream
*/
@DISPID(2)
public void connectionError() {
throw new UnsupportedOperationException();
}
void connectionError();
/**
* Triggered when new sample data is available
*/
@DISPID(3)
public void newData() {
throw new UnsupportedOperationException();
}
void newData();
}

View File

@ -19,20 +19,16 @@
package com.romraider.logger.innovate.mts;
import com4j.COM4J;
/**
* Defines methods to create COM objects
*/
public abstract class ClassFactory {
private ClassFactory() {
} // instantiation is not allowed
import static com4j.COM4J.createInstance;
public final class MTSFactory {
private MTSFactory() {
}
/**
* MTS SDK v1.0
*/
public static IMTS createMTS() {
return COM4J.createInstance(IMTS.class, "{74087A4E-4AF1-4F8C-BACB-3959C212AAD2}");
public static MTS createMTS() {
return createInstance(MTS.class, "{74087A4E-4AF1-4F8C-BACB-3959C212AAD2}");
}
}

View File

@ -19,12 +19,11 @@
package com.romraider.logger.innovate.mts;
import com.romraider.logger.innovate.mts.events._IMTSEvents;
import com4j.EventCookie;
public class Test extends _IMTSEvents {
public class Test implements MTSEvents {
private IMTS mts;
private MTS mts;
private EventCookie connectionEventCookie;
public Test() {
@ -73,7 +72,7 @@ public class Test extends _IMTSEvents {
public void Run() throws InterruptedException {
// create an instance of the MTSSDK COM component
mts = ClassFactory.createMTS();
mts = MTSFactory.createMTS();
// Note: you MUST call portCount() at least one before attempting to set
// the current inputPort or the inputPort(int) will not do anything!
@ -88,7 +87,7 @@ public class Test extends _IMTSEvents {
System.out.printf("Set current port to 0; port name = %s\n", portName);
// register for MTS component events
connectionEventCookie = mts.advise(_IMTSEvents.class, this);
connectionEventCookie = mts.advise(MTSEvents.class, this);
// attempt to connect to the specified device
System.out.println("connect() called.");