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

View File

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

View File

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

View File

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