Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions emulator/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
Tecla Emulator version 1.1
----------------------------------------------------------------------------------------------------------------------------------------------------
Written and Submitted by Akhil Rao aka akdroid

Tecla Emulator is built for emulation of Tecla Shield a device by Komodo Open Lab used for remote access.More details on http://komodoopenlab.com/
----------------------------------------------------------------------------------------------------------------------------------------------------
The emulator is basically a python script and requires Pybluez for accessing bluetooth.

****Important******
In order to use Tecla Emulator name your bluetooth device with TeclaShield prefix in order that TeclaAccess App can connect to the emulator.

How to run:

1)Download teclaemu.py
2)Open Terminal and cd to the directory where you downloaded the python script.
3)type the following command "python teclaemu.py"

List of Commands:

Keys => Function
------------------------------------------------------------------------
w/W => Generate Event on Jumper 1
s/S => Generate Event on Jumper 2
a/A => Generate Event on Jumper 3
d/D => Generate Event on Jumper 4
1 => Generate Event on Switch Port 1
2 => Generate Event on Switch Port 2
h/H => View possible commands
r/R => Generate Switch Release Event
t/T => Toggle Auto Switch Release Mode
q/Q => Quit

Notes:

1)Developers can adapt this script by changing the values of keys:bytevalue in the python dictionary - keyvalue as per their requirement
2)The current set of values works as per the Tecla Access App available in the andorid market.
3)The Keyboard may not function properly as of now.
4)Auto Switch Release Mode is a mode in which switch release events are also generated after a switch event is triggered.
When turned off,release event will have to be inserted manually by command r/R.Default value is true(on).When true(on)
release event cannot be sent using r/R command.



25 changes: 25 additions & 0 deletions emulator/Tecla-Emulator-Win/Readme.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Tecla Emulator GUI for Windows.

Tecla Emulator GUI is a GUI application for windows using bluecove Libraries and java swing that will emulate TeclaShield device completely.This application is available as a jar file ad can be used by developers to send eventsto Tecla Access Application on android.

All features of Tecla Access works including the keyboard.

For more information on Bluecove Libraries.

Bluecove : http://bluecove.org/

For more information on TeclaShield platform:

http://komodoopenlab.com/tecla/developers/tecla-for-device-manufacturers/

***Imortant***

In order to use,copy the dlls into your Java Runtime Environment folder.
Typically on Windows 7
C://Program Files/Java/jre/.

You will be able to see the gui only when you start the Tecla Access App and bluetooth on on your android phone.

***Download Link***

https://github.com/AKdroid/Tecla-emu/downloads
73 changes: 73 additions & 0 deletions emulator/Tecla-Emulator-Win/com/akdroid/btoothgui/BTserver.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
package com.akdroid.btoothgui;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;

import javax.bluetooth.*;
import javax.microedition.io.*;
public class BTserver extends Thread implements Runnable {

public UUID uuid; //it can be generated randomly
public String name ; //the name of the service
public String url ;
LocalDevice local ;
StreamConnectionNotifier server ;
StreamConnection conn ;
DataInputStream datain;
DataOutputStream dataout;
public BTserver(){
uuid = new UUID( //the uid of the service, it has to be unique,
"0000110100001000800000805F9B34FB", false);
name = "SPP"; //the name of the service
url = "btspp://localhost:" + uuid //the service url
+ ";name=" + name
+ ";authenticate=false;encrypt=false;";

System.out.println("Starting bluetooth device and making it discoverable");
try {
local = LocalDevice.getLocalDevice();
local.setDiscoverable(DiscoveryAgent.GIAC);
try {
server = (StreamConnectionNotifier)Connector.open(url);
conn = server.acceptAndOpen();
System.out.println("Client Connected...");
datain=new DataInputStream(conn.openDataInputStream());
dataout=new DataOutputStream(conn.openDataOutputStream());

} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
} catch (BluetoothStateException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void ping(){
Byte c;
while(true){
try {
if((c = datain.readByte()) > 0){
dataout.writeByte(c);
//System.out.println(c);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
public void run(){
ping();
}
public void send(Byte b){
try {
dataout.writeByte(b);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}

141 changes: 141 additions & 0 deletions emulator/Tecla-Emulator-Win/com/akdroid/btoothgui/GUinterface.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
package com.akdroid.btoothgui;
import java.awt.*;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.event.MouseEvent;

import java.awt.event.MouseListener;

import java.awt.image.BufferedImage;


public class GUinterface {

Window w;
Button ecu1,ecu2,ecu3,ecu4,e1,e2,e3;
JLabel status,switchstate,dummy;
BufferedImage im;
JFrame f;
JFrame d;
Byte state;
BTserver bt;//=new BTserver();
//bt.start();
GUinterface(){
w=null;
d=new JFrame("TeclaEmulator");
d.setBounds(100, 100, 600, 400);
state=0x3F;
gui_init();
bt=new BTserver();
bt.start();
}
public void gui_init()
{
f=new JFrame();
ecu1=new Button();
ecu2=new Button();
ecu3=new Button();
ecu4=new Button();
e1=new Button();
e2=new Button();
e3=new Button();
status=new JLabel();
switchstate=new JLabel();
dummy=new JLabel();
switchstate.setAlignmentX(JLabel.CENTER_ALIGNMENT);
status.setAlignmentX(JLabel.CENTER_ALIGNMENT);
ecu1.setLabel("ECU1");
ecu2.setLabel("ECU2");
ecu3.setLabel("ECU3");
ecu4.setLabel("ECU4");
e1.setLabel(" E1 ");
e2.setLabel(" E2 ");

d.add(ecu1);
d.add(ecu2);
d.add(ecu3);
d.add(ecu4);
d.add(e1);
d.add(e2);
d.add(status);
d.add(switchstate);
d.add(dummy);
int xoffset=50,yoffset=150;
ecu1.setBounds(125+xoffset, 40+yoffset, 100, 60);
ecu2.setBounds(125+xoffset, 120+yoffset, 100, 60);
ecu3.setBounds(5+xoffset, 120+yoffset, 100, 60);
ecu4.setBounds(245+xoffset, 120+yoffset, 100, 60);
e1.setBounds(365+xoffset, 40+yoffset, 100, 60);
//System.out.println("e2 bounds");
e2.setBounds(365+xoffset, 120+yoffset, 100, 60);
status.setBounds(xoffset-25, yoffset-50, 350, 60);
status.setForeground(new Color(0x0000FF));
status.setBackground(new Color(0xFFFFFF));
switchstate.setForeground(new Color(0x0000FF));
switchstate.setBackground(new Color(0xFF0000));
status.setText("Welcome to TeclaEmulator");
switchstate.setBounds(410 ,yoffset-50, 150, 60);
switchstate.setText("SwitchState = 0x3F");
ecu1.addMouseListener(new TeclaListener((byte)0x01,"ECU1"));
ecu2.addMouseListener(new TeclaListener((byte)0x02,"ECU2"));
ecu3.addMouseListener(new TeclaListener((byte)0x04,"ECU3"));
ecu4.addMouseListener(new TeclaListener((byte)0x08,"ECU4"));
e1.addMouseListener(new TeclaListener((byte)0x10,"E1"));
e2.addMouseListener(new TeclaListener((byte)0x20,"E2"));
//ecu1.setBounds(720, 220, 100, 80);
//d= new Dialog(w,"TeclaEmulator");
}
@SuppressWarnings("deprecation")
public void show(){
System.out.println("gui show");
d.show();

}
@SuppressWarnings("deprecation")
public void hide(){
d.hide();
}


class TeclaListener implements MouseListener {
Byte mask;
String name;
TeclaListener(byte st,String nm){
mask=st;
name=nm;
}

public void mouseClicked(MouseEvent arg0) {
// TODO Auto-generated method stub

}
@Override
public void mouseEntered(MouseEvent arg0) {
// TODO Auto-generated method stub

}
@Override
public void mouseExited(MouseEvent arg0) {
// TODO Auto-generated method stub

}
@Override
public void mousePressed(MouseEvent arg0) {
// TODO Auto-generated method stub
state=(byte) (state & ~mask);
switchstate.setText("switchstate = "+Integer.toHexString(state));
status.setText(name + " Pressed ");
bt.send(state);
}
@Override
public void mouseReleased(MouseEvent arg0) {
// TODO Auto-generated method stub
state=(byte) (state | mask);
switchstate.setText("switchstate = "+Integer.toHexString(state));
status.setText(name + " Released ");
bt.send(state);
}
}


}
20 changes: 20 additions & 0 deletions emulator/Tecla-Emulator-Win/com/akdroid/btoothgui/btooth.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package com.akdroid.btoothgui;

public class btooth {

/**
* @param args
*/

//@SuppressWarnings("deprecation")
public static void main(String[] args) {
GUinterface g1=new GUinterface();

g1.show();

//r.delay(10000);
//g1.hide();
//bt.ping();
}

}
7 changes: 7 additions & 0 deletions emulator/Tecla-Emulator-Win/javabtoothgui/.classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="lib" path="C:/Users/Akhil/Downloads/bluecove-2.1.1-SNAPSHOT.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
17 changes: 17 additions & 0 deletions emulator/Tecla-Emulator-Win/javabtoothgui/.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>javabtoothgui</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#Sat Apr 14 13:01:32 IST 2012
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading