This commit is contained in:
Victor 2018-11-15 11:46:50 +02:00
commit 68c6522131
11 changed files with 1964 additions and 0 deletions

83
build.xml Normal file
View File

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<project name="aSignalization" default="jar" basedir=".">
<description>Builds, tests, and runs the project .</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
pre-init: called before initialization of project properties
post-init: called after initialization of project properties
pre-preprocess: called before text preprocessing of sources
post-preprocess: called after text preprocessing of sources
pre-compile: called before source compilation
post-compile: called after source compilation
pre-obfuscate: called before obfuscation
post-obfuscate: called after obfuscation
pre-preverify: called before preverification
post-preverify: called after preverification
pre-jar: called before jar building
post-jar: called after jar building
pre-build: called before final distribution building
post-build: called after final distribution building
pre-clean: called before cleaning build products
post-clean: called after cleaning build products
Example of pluging a my-special-task after the compilation could look like
<target name="post-compile">
<my-special-task>
<fileset dir="${build.classes.dir}"/>
</my-special-task>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Other way how to customize the build is by overriding existing main targets.
The target of interest are:
preprocess: preprocessing
extract-libs: extraction of libraries and resources
compile: compilation
create-jad: construction of jad and jar manifest source
obfuscate: obfuscation
preverify: preverification
jar: jar archive building
run: execution
debug: execution in debug mode
build: building of the final distribution
javadoc: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="init,jar">
<my-special-exec jadfile="${dist.dir}/${dist.jad}"/>
</target>
Be careful about correct dependencies when overriding original target.
Again, for list of available properties which you can use check the target
you are overriding in nbproject/build-impl.xml file.
A special target for-all-configs can be used to run some specific targets for
all project configurations in a sequence. File nbproject/build-impl.xml
already contains some "for-all" targets:
jar-all
javadoc-all
clean-all
Example of definition of target iterating over all project configurations:
<target name="jar-all">
<property name="target.to.call" value="jar"/>
<antcall target="for-all-configs"/>
</target>
-->
</project>

1368
nbproject/build-impl.xml Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,8 @@
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
build.xml.data.CRC32=5cc831b7
build.xml.script.CRC32=0bcbf57a
build.xml.stylesheet.CRC32=03eab09b
nbproject/build-impl.xml.data.CRC32=5cc831b7
nbproject/build-impl.xml.script.CRC32=b2b47958
nbproject/build-impl.xml.stylesheet.CRC32=a4fc63f1

View File

@ -0,0 +1,7 @@
#Mon Jun 21 20:28:59 EEST 2010
netbeans.user=C\:\\Users\\aNNiMON\\.netbeans\\6.9m1
javadoc.preview=true
deployment.counter=33
config.active=
deployment.number=0.0.32
app-version.autoincrement=true

View File

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/1"/>
</project-private>

View File

@ -0,0 +1,140 @@
abilities=MMAPI=1.1,SATSAJCRMI=1.0,SATSACRYPTO=1.0,JSR82=1.1,NOKIAUI=1.0,JSR226=1.0,MIDP=2.1,JSR229=1.1.0,SATSAAPDU=1.0,CLDC=1.1,JSR177=1.0,JSR179=1.0.1,J2MEWS=1.0,VSCL=2.1,WMA=2.0,JSR172=1.0,SEMC_EXT_JP8=1.0,ColorScreen,OBEX=1.0,NokiaUI=1.0,JSR238=1.0,JSR239=1.0,JSR211=1.0,JSR234=1.0,ScreenWidth=240,lib/semc_ext_jp8.jar=1.0,MascotV3=1.0,JSR75=1.0,JSR184=1.1,SATSAPKI=1.0,ScreenHeight=321,ScreenColorDepth=8,JSR180=1.0.1,J2MEXMLRPC=1.0,
all.configurations=\
application.args=
application.description=
application.description.detail=
application.name=
application.vendor=Vendor
build.classes.dir=${build.dir}/compiled
build.classes.excludes=**/*.java,**/*.form,**/*.class,**/.nbintdb,**/*.mvd,**/*.wsclient,**/*.vmd
build.dir=build/${config.active}
build.root.dir=build
debug.level=debug
deployment.copy.target=deploy
deployment.instance=default
deployment.jarurl=${dist.jar}
deployment.method=NONE
deployment.override.jarurl=false
dist.dir=dist/${config.active}
dist.jad=aSignalization.jad
dist.jar=aSignalization.jar
dist.javadoc.dir=${dist.dir}/doc
dist.root.dir=dist
extra.classpath=
filter.exclude.tests=false
filter.excludes=
filter.more.excludes=**/overview.html,**/package.html
filter.use.standard=true
jar.compress=true
javac.debug=true
javac.deprecation=false
javac.encoding=windows-1251
javac.optimize=false
javac.source=1.3
javac.target=1.3
javadoc.author=false
javadoc.encoding=
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
libs.classpath=
main.class=
main.class.class=applet
manifest.apipermissions=
manifest.file=manifest.mf
manifest.jad=
manifest.manifest=
manifest.midlets=MIDlet-1: aSignalization,/icon.png,Main\n
manifest.others=MIDlet-Vendor: aNNiMON\nMIDlet-Name: aSignalization\nMIDlet-Version: 1.2\n
manifest.pushregistry=
name=AntiTheft
no.dependencies=false
nokiaS80.application.icon=
nsicom.application.monitorhost=
nsicom.application.runremote=
nsicom.application.runverbose=
nsicom.remoteapp.location=\\My Documents\\NetBeans Applications
nsicom.remotevm.location=\\Windows\\creme\\bin\\CrEme.exe
obfuscated.classes.dir=${build.dir}/obfuscated
obfuscation.custom=-keep public class * extends javax.microedition.midlet.MIDlet \n-dontusemixedcaseclassnames
obfuscation.level=1
obfuscator.destjar=${build.dir}/obfuscated.jar
obfuscator.srcjar=${build.dir}/before-obfuscation.jar
platform.active=Sony_Ericsson_SDK_2_5_0_4_for_the_Java_TM__ME_Platform_Emulator_
platform.active.description=Sony Ericsson SDK 2.5.0.4 for the Java(TM) ME Platform(Emulator)
platform.apis=JSR234-1.0,SATSA-APDU-1.0,JSR211-1.0,JSR75-1.0,J2ME-WS-1.0,J2ME-XMLRPC-1.0,JSR82-1.1,SATSA-JCRMI-1.0,SATSA-CRYPTO-1.0,JSR239-1.0,JSR179-1.0.1,MascotV3-1.0,JSR184-1.1,JSR238-1.0,MMAPI-1.1,JSR256-1.1,NokiaUI-1.0,JSR229-1.1.0,SATSA-PKI-1.0,JSR180-1.0.1,JSR226-1.0,JSR177-1.0,SEMC_EXT_JP8-1.0,VSCL-2.0,VSCL-2.1,WMA-2.0
platform.bootclasspath=${platform.home}/lib/mascotv3.jar:${platform.home}/lib/jsr226.jar:${platform.home}/lib/jsr256.jar:${platform.home}/lib/satsa-crypto.jar:${platform.home}/lib/jsr229.jar:${platform.home}/lib/jsr238.jar:${platform.home}/lib/j2me-xmlrpc.jar:${platform.home}/lib/jsr211.jar:${platform.home}/lib/vscl21.jar:${platform.home}/lib/satsa-jcrmi.jar:${platform.home}/lib/jsr082.jar:${platform.home}/lib/satsa-apdu.jar:${platform.home}/lib/jsr184.jar:${platform.home}/lib/nokiaext.jar:${platform.home}/lib/jsr239.jar:${platform.home}/lib/jsr75.jar:${platform.home}/lib/satsa-pki.jar:${platform.home}/lib/jsr179.jar:${platform.home}/lib/jsr180.jar:${platform.home}/lib/vscl.jar:${platform.home}/lib/mmapi.jar:${platform.home}/lib/j2me-ws.jar:${platform.home}/lib/wma20.jar:${platform.home}/lib/jsr234.jar:${platform.home}/lib/semc_ext_jp8.jar:${platform.home}/lib/cldcapi11.jar:${platform.home}/lib/midpapi20.jar
platform.configuration=CLDC-1.1
platform.device=SonyEricsson_JP8_240x320_Emu
platform.fat.jar=true
platform.profile=MIDP-2.0
platform.trigger=CLDC
platform.type=UEI-1.0.1
preprocessed.dir=${build.dir}/preprocessed
preverify.classes.dir=${build.dir}/preverified
preverify.sources.dir=${build.dir}/preverifysrc
resources.dir=resources
ricoh.application.email=
ricoh.application.fax=
ricoh.application.icon=
ricoh.application.target-jar=
ricoh.application.telephone=
ricoh.application.uid=12092230
ricoh.application.version=
ricoh.dalp.application-desc.auto-run=false
ricoh.dalp.application-desc.energy-save=
ricoh.dalp.application-desc.exec-auth=
ricoh.dalp.application-desc.visible=true
ricoh.dalp.argument=
ricoh.dalp.codebase=
ricoh.dalp.display-mode.color=true
ricoh.dalp.display-mode.is-4line-support=false
ricoh.dalp.display-mode.is-hvga-support=true
ricoh.dalp.display-mode.is-vga-support=false
ricoh.dalp.display-mode.is-wvga-support=false
ricoh.dalp.information.abbreviation=
ricoh.dalp.information.icon.basepath=
ricoh.dalp.information.icon.location=
ricoh.dalp.information.is-icon-used=true
ricoh.dalp.install.destination=hdd
ricoh.dalp.install.mode.auto=true
ricoh.dalp.install.work-dir=hdd
ricoh.dalp.is-managed=true
ricoh.dalp.resources.dsdk.version=2.0
ricoh.dalp.resources.jar.basepath=
ricoh.dalp.resources.jar.version=
ricoh.dalp.version=
ricoh.icon.invert=false
ricoh.platform.target.version=
run.cmd.options=
run.jvmargs=
run.method=STANDARD
run.security.domain=trusted
run.use.security.domain=false
savaje.application.icon=
savaje.application.icon.focused=
savaje.application.icon.small=
savaje.application.uid=TBD
savaje.bundle.base=
savaje.bundle.debug=false
savaje.bundle.debug.port=
semc.application.caps=
semc.application.icon=
semc.application.icon.count=
semc.application.icon.splash=
semc.application.icon.splash.installonly=false
semc.application.uid=E3059127
semc.certificate.path=
semc.private.key.password=
semc.private.key.path=
sign.alias=
sign.enabled=false
sign.keystore=
src.dir=src
use.emptyapis=true
use.preprocessor=true

10
nbproject/project.xml Normal file
View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.kjava.j2meproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2me-project">
<name>aSignalization</name>
<minimum-ant-version>1.6</minimum-ant-version>
</data>
</configuration>
</project>

BIN
src/1.mp3 Normal file

Binary file not shown.

262
src/Canv.java Normal file
View File

@ -0,0 +1,262 @@
import java.io.IOException;
import java.util.Calendar;
import javax.microedition.io.Connector;
import javax.microedition.lcdui.*;
import javax.microedition.media.*;
import javax.microedition.media.control.VolumeControl;
import javax.microedition.sensor.*;
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
/**
*
* @author aNNiMON
*/
public class Canv extends Canvas implements Runnable, DataListener {
private int w,h;
// Глобальные Данные
private boolean run;
private int stx, sty, stz;
private int sensetivity, signalmode, time;
private long currentTime;
private boolean logmode;
private Image I;
private Graphics G;
private Thread thr;
private Player player;
private VolumeControl vc;
private final Font medFont = Font.getFont(Font.FACE_SYSTEM, Font.STYLE_BOLD, Font.SIZE_MEDIUM);
private int[] channels = new int[3];
private String[] channelNames = new String[3];
private SensorConnection sensor;
private String URL, temp;
public Canv() {
setFullScreenMode(true);
logmode = run = false;
currentTime = time = signalmode = 0;
temp = getTime(1);
sensetivity = 300;
thr = new Thread(this);
w = getWidth();
h = getHeight();
I = Image.createImage(w, h);
G = I.getGraphics();
getInfo();
thr.start();
}
protected void paint(Graphics g) {
drawCanvas(G);
g.drawImage(I, 0, 0, 20);
}
private void drawCanvas(Graphics g) {
g.setColor(0);
g.fillRect(0, 0, w, h);
g.setFont(medFont);
g.setColor(0x227A6F);
if(run) {
g.drawString(getTime(1), w/2, 5, 17);
if(currentTime>1 && ((System.currentTimeMillis()-currentTime)>time*1000)) bubu();
repaint();
}else{
int fh = medFont.getHeight()+3;
g.drawString("Чувствительность", w/2, 5, 17);
g.drawString("4 - | "+String.valueOf(sensetivity)+" | 6 +", w/2, 5+fh, 17);
String md = logmode ? "Лог в файл" : "Сигнализация";
g.drawString("2 - Режим: "+md, w/2, 8+fh*2, 17);
g.drawString("5 - Старт", w/2, 8+fh*3, 17);
if(!logmode) {
switch(signalmode) {
case 0: md = "Звук и вибро"; break;
case 1: md = "Звук"; break;
case 2: md = "Вибро"; break;
}
g.drawString("8 - "+md, w/2, 8+fh*4, 17);
g.drawString("Сработать через (сек)", w/2, 8+fh*5, 17);
g.drawString("7 - | "+time+" | 9 +", w/2, 4+fh*6, 17);
}
}
}
public void keyPressed(int key) {
if(run) return;
int ga=getGameAction(key);
switch(ga) {
case LEFT:
if(sensetivity>100) sensetivity-=100;
break;
case RIGHT:
if(sensetivity<1000) sensetivity+=100;
break;
case UP:
logmode=!logmode;
break;
case DOWN:
if(!logmode) {
signalmode++;
if(signalmode>2) signalmode=0;
}
break;
case FIRE:
stx=channels[0]; sty=channels[1]; stz=channels[2];
run=true;
if(logmode) Main.midlet.save(getTime(1));
break;
default:
if(!logmode) {
if(key==KEY_NUM7) {
time--;
if(time<0) time = 0;
}else if(key==KEY_NUM9) {
time++;
if(time>500) time = 500;
}
}
}
repaint();
}
public void keyRepeated(int key) {
if(key==KEY_STAR/* && currentTime == 1*/) {
run = false;
currentTime = 0;
if (player != null) {
try {
player.stop();
} catch (MediaException ex) {
ex.printStackTrace();
}
player = null;
}
repaint();
}/*else if(key==KEY_POUND) {
currentTime = 1;
repaint();
}*/else keyPressed(key);
}
public void setPositions(int x, int y, int z) {
if(run) {
int zx, zy, zz;
zx = Math.abs(stx-x);
zy = Math.abs(sty-y);
zz = Math.abs(stz-z);
if(zx>sensetivity || zy>sensetivity || zz>sensetivity) {
if(!logmode) {
currentTime = System.currentTimeMillis();
//bubu();
}
else {
String t=getTime(1);
if(!temp.equals(t)) {
Main.midlet.write(t+"\n");
temp=t;
}
}
}
stx=x; sty=y; stz=z;
repaint();
}
}
private void bubu() {
if (player == null && signalmode!=2) {
try {
player = Manager.createPlayer(getClass().getResourceAsStream("/1.mp3"), "audio/mpeg");
player.realize();
player.prefetch();
vc = (VolumeControl) player.getControl("VolumeControl");
vc.setLevel(100);
player.setLoopCount(-1);
player.start();
} catch (Exception ex) {
player = null;
}
}
}
public void run() {
while(true) {
if(currentTime>1 && ((System.currentTimeMillis()-currentTime)>time*1000)) {
if(run && signalmode!=1) Main.midlet.dsp.vibrate(100);
}else
try {
Thread.sleep(1000);
} catch (InterruptedException ex) {
ex.printStackTrace();
}
}
}
public void dataReceived(SensorConnection sensor, Data[] data, boolean isDataLost) {
//Save the data
for (int i = 0; i < data.length; i++) {
if (data[i].getChannelInfo().getName().compareTo(channelNames[0]) == 0) {
channels[0] = data[i].getIntValues()[0];
} else if (data[i].getChannelInfo().getName().compareTo(channelNames[1]) == 0) {
channels[1] = data[i].getIntValues()[0];
} else if (data[i].getChannelInfo().getName().compareTo(channelNames[2]) == 0) {
channels[2] = data[i].getIntValues()[0];
}
}
setPositions(channels[0], channels[1], channels[2]);
}
private void getInfo() {
SensorInfo[] info = SensorManager.findSensors("acceleration", null);
for (int i = 0; i < info.length; i++) {
SensorInfo s = info[i];
URL = s.getUrl();
ChannelInfo[] ci = s.getChannelInfos();
for (int r = 0; r < ci.length; r++) {
ChannelInfo c = ci[r];
channelNames[r] = c.getName();
}
}
try {
sensor = (SensorConnection) Connector.open(URL);
sensor.setDataListener(this, 1);
} catch (IOException ex) {
ex.printStackTrace();
}
}
public static String getTime(int mode) {
String dd, mm, yy, _h, m, s;
Calendar cal = Calendar.getInstance ();
dd = String.valueOf (cal.get (Calendar.DAY_OF_MONTH));
if (dd.length () == 1)
dd = "0" + dd;
mm = String.valueOf (cal.get (Calendar.MONTH) + 1);
if (mm.length () == 1)
mm = "0" + mm;
yy = String.valueOf (cal.get (Calendar.YEAR));
_h = String.valueOf (cal.get (Calendar.HOUR_OF_DAY));
if (_h.length () == 1)
_h = "0" + _h;
m = String.valueOf (cal.get (Calendar.MINUTE));
if (m.length () == 1)
m = "0" + m;
s = String.valueOf (cal.get (Calendar.SECOND));
if (s.length () == 1)
s = "0" + s;
String time;
if(mode==1) time = _h+":"+m+":"+s;
else if(mode==2) time = (dd+"."+mm+"."+yy.substring(2));
else time = (dd+"."+mm+"."+yy.substring(2)+" "+_h+":"+m+":"+s);
return time;
}
}

82
src/Main.java Normal file
View File

@ -0,0 +1,82 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.*;
import javax.microedition.io.Connector;
import javax.microedition.io.file.FileConnection;
import javax.microedition.lcdui.Display;
import javax.microedition.midlet.*;
/**
* @author aNNiMON
*/
public class Main extends MIDlet {
public static Main midlet;
private FileConnection fc;
private OutputStream os;
public Display dsp;
public static byte log = 0;
public Main() {
midlet = this;
dsp = Display.getDisplay(this);
}
public void startApp() {
dsp.setCurrent(new Canv());
}
public void pauseApp() {
}
public void destroyApp(boolean unco) {
if(fc!=null) {
try {
os.flush();
os.close();
fc.close();
} catch (IOException ex) {
ex.printStackTrace();
}
}
notifyDestroyed();
}
public void save(String path) {
try {
os = init(path);
write(os, "aSignalization Log File\nby aNNiMON\n");
} catch (IOException ex) {
ex.printStackTrace();
}
}
public void write(String text) {
try {
write(os, text);
} catch (IOException ex) {
ex.printStackTrace();
}
}
public OutputStream init(String path) throws IOException {
fc = (FileConnection) Connector.open("file:///c:/other/aSignalization"+path.replace(':', '_')+".txt");
if(fc.exists()) {
fc.delete();
}
fc.create();
log++;
return fc.openOutputStream();
}
public void write(OutputStream os, String text) throws IOException {
for(int j=0; j<text.length(); j++) {
os.write(text.charAt(j));
}
}
}

BIN
src/icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 346 B