sketches arduino

Esse commit está contido em:
vsenger
2013-11-14 12:02:11 -02:00
commit b4ef91fc6d
1642 arquivos alterados com 96186 adições e 0 exclusões
@@ -0,0 +1,110 @@
/*
SparkFun Cellular Shield - Pass-Through Sample Sketch
SparkFun Electronics
Written by Ryan Owens
3/8/10
Description: This sketch is written to interface an Arduino Duemillanove to a Cellular Shield from SparkFun Electronics.
The cellular shield can be purchased here: http://www.sparkfun.com/commerce/product_info.php?products_id=9607
In this sketch serial commands are passed from a terminal program to the SM5100B cellular module; and responses from the cellular
module are posted in the terminal. More information is found in the sketch comments.
An activated SIM card must be inserted into the SIM card holder on the board in order to use the device!
This sketch utilizes the NewSoftSerial library written by Mikal Hart of Arduiniana. The library can be downloaded at this URL:
http://arduiniana.org/libraries/NewSoftSerial/
This code is provided under the Creative Commons Attribution License. More information can be found here:
http://creativecommons.org/licenses/by/3.0/
(Use our code freely! Please just remember to give us credit where it's due. Thanks!)
*/
#include <SoftwareSerial.h> //Include the NewSoftSerial library to send serial commands to the cellular module.
#include <string.h> //Used for string manipulations
char incoming_char=0; //Will hold the incoming character from the Serial Port.
SoftwareSerial cell(2,3); //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.
void setup()
{
//Initialize serial ports for communication.
Serial.begin(9600);
cell.begin(9600);
//Let's get started!
Serial.println("Starting SM5100B Communication...");
}
void loop() {
//If a character comes in from the cellular module...
if(cell.available() >0)
{
incoming_char=cell.read(); //Get the character from the cellular serial port.
Serial.print(incoming_char); //Print the incoming character to the terminal.
}
//If a character is coming from the terminal to the Arduino...
if(Serial.available() >0)
{
incoming_char=Serial.read(); //Get the character coming from the terminal
cell.print(incoming_char); //Send the character to the cellular module.
}
}
/* SM5100B Quck Reference for AT Command Set
*Unless otherwise noted AT commands are ended by pressing the 'enter' key.
1.) Make sure the proper GSM band has been selected for your country. For the US the band must be set to 7.
To set the band, use this command: AT+SBAND=7
2.) After powering on the Arduino with the shield installed, verify that the module reads and recognizes the SIM card.
With a terimal window open and set to Arduino port and 9600 buad, power on the Arduino. The startup sequence should look something
like this:
Starting SM5100B Communication...
+SIND: 1
+SIND: 10,"SM",1,"FD",1,"LD",1,"MC",1,"RC",1,"ME",1
Communication with the module starts after the first line is displayed. The second line of communication, +SIND: 10, tells us if the module
can see a SIM card. If the SIM card is detected every other field is a 1; if the SIM card is not detected every other field is a 0.
3.) Wait for a network connection before you start sending commands. After the +SIND: 10 response the module will automatically start trying
to connect to a network. Wait until you receive the following repsones:
+SIND: 11
+SIND: 3
+SIND: 4
The +SIND response from the cellular module tells the the modules status. Here's a quick run-down of the response meanings:
0 SIM card removed
1 SIM card inserted
2 Ring melody
3 AT module is partially ready
4 AT module is totally ready
5 ID of released calls
6 Released call whose ID=<idx>
7 The network service is available for an emergency call
8 The network is lost
9 Audio ON
10 Show the status of each phonebook after init phrase
11 Registered to network
After registering on the network you can begin interaction. Here are a few simple and useful commands to get started:
To make a call:
AT command - ATDxxxyyyzzzz
Phone number with the format: (xxx)yyy-zzz
If you make a phone call make sure to reference the devices datasheet to hook up a microphone and speaker to the shield.
To send a txt message:
AT command - AT+CMGF=1
This command sets the text message mode to 'text.'
AT command = AT+CMGS="xxxyyyzzzz"(carriage return)'Text to send'(CTRL+Z)
This command is slightly confusing to describe. The phone number, in the format (xxx)yyy-zzzz goes inside double quotations. Press 'enter' after closing the quotations.
Next enter the text to be send. End the AT command by sending CTRL+Z. This character can't be sent from Arduino's terminal. Use an alternate terminal program like Hyperterminal,
Tera Term, Bray Terminal or X-CTU.
The SM5100B module can do much more than this! Check out the datasheets on the product page to learn more about the module.*/
@@ -0,0 +1,98 @@
char comando[30];
char comandoOK[30];
int contador = 0;
void ethernet() {
EthernetClient client = server.available();
if (client) {
//debug Serial.println("comecando...");
contador =0;
limpa();
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
//debug Serial.print(c);
//Serial.println("aaa");
comando[contador++]=c;
if (c == '\n') {
//debug Serial.println("\nComando recebido");
//if(c=='\n') {
//debug Serial.print("COMANDO ORIGINAL: ");
//debug Serial.println(comando);
contador=0;
//debug Serial.print("Comando OK antes: ");
//debug Serial.println(comandoOK);
limpaOK();
//debug Serial.print("Comando OK depois do limpa: ");
//debug Serial.println(comandoOK);
for(int x=5;x<30;x++) {
if(comando[x]==' ') break;
comandoOK[contador++]=comando[x];
//Serial.println(x);
}
//debug Serial.println("Comando OK depois: ");
//debug Serial.println(comandoOK);
//limpa();
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
//debug Serial.println("Vai executar...");
homeDevice.execute(comandoOK);
//debug Serial.println("Terminou...");
client.println("</html>");
client.flush();
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
//debug Serial.println("Finalizou...");
// give the web browser time to receive the data
delay(5);
// close the connection:
client.stop();
//Serial.println("client disonnected");
}
}
void limpa() {
for(int x=0;x<30;x++) {
comando[x]='\0';
comandoOK[x]='\0';
}
}
void limpaOK() {
//Serial.print("dentro do limpa antes: ");
//Serial.println(comandoOK);
for(int x=0;x<30;x++) {
comandoOK[x]='\0';
}
//Serial.print("dentro do limpa depois: ");
//Serial.println(comandoOK);
}
@@ -0,0 +1,36 @@
#include "Device.h"
#include <SPI.h>
#include <Ethernet.h>
#include <IRremote.h>
Device homeDevice=Device("central-device");
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xEC, 0x09 }; //Atentar ao MAC unico de cada placa!
IPAddress ip(192,168,0, 203);
EthernetServer server(80);
void setup() {
Serial.begin(115200);
homeDevice.add("LED", DIGITAL, 13);
homeDevice.add("L1F", DIGITAL, 6); //Luz 1 frontal
homeDevice.add("L1T", DIGITAL, 7); // Luz 1 tras
homeDevice.add("L2F", DIGITAL, 8); // Luz 2 frontal
homeDevice.add("L2T", DIGITAL, 9); // Luz 2 tras
//homeDevice.add("light", ANALOG, 3);
//homeDevice.add("temp", ANALOG, 2);
//homeDevice.add("ir", CUSTOM, 3, irSender_read , irSender_write);
//homeDevice.add("panasonic", CUSTOM, 0, rs232_read, rs232_write);
//homeDevice.add("rs2321", CUSTOM, 0, rs232_read, rs232_write);
Ethernet.begin(mac, ip);
server.begin();
}
void loop() {
//Para aceitar requisições por Serial
//homeDevice.loop();
//Para aceitar requisições por TCP/IP
ethernet();
}
@@ -0,0 +1,58 @@
char comando[30];
char comandoOK[30];
int contador = 0;
void ethernet() {
EthernetClient client = server.available();
if (client) {
contador =0;
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
//Serial.println("aaa");
comando[contador++]=c;
if(c=='\n') {
//Serial.print("COMANDO: ");
//Serial.println(comando);
contador=0;
for(int x=5;x<30;x++) {
if(comando[x]==' ') break;
comandoOK[contador++]=comando[x];
//Serial.println(x);
}
limpa();
//Serial.print("COMANDO OK: ");
//Serial.println(comandoOK);
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
client.println(homeDevice.execute(comandoOK));
client.flush();
break;
}
}
}
// give the web browser time to receive the data
delay(5);
// close the connection:
client.stop();
//Serial.println("client disonnected");
}
}
void limpa() {
for(int x=0;x<30;x++) {
comando[x]='\0';
comandoOK[x]='\0';
}
}
@@ -0,0 +1,26 @@
IRsend irsend;
//unsigned int rawCodes[] = { 19850,1250,450,1200,450,400,1250,1250,400,400,1250,400,1250,450,1200,450,1250,1250,400,400,1250,450,1200,450};
// m1150 s550 m1100 s550 m300 s1300 m1200 s500 m300 s1350 m300 s1350 m350 s1300 m350 s1300 m1150 s550 m300 s1350 m300 s1350 m300
unsigned int rawUp[] = { 1150 ,550 ,1100 ,550 ,300 ,1300 ,1200 ,500 ,300 ,1350 ,300 ,1350 ,350 ,1300 ,350 ,1300 ,1150 ,550 ,300 ,1350 ,300 ,1350 ,300};
unsigned int rawDown[] = { 1150 ,550 ,1100 ,550 ,300 ,1350 ,1100 ,550 ,300 ,1350 ,300 ,1350 ,1150 ,500 ,300 ,1400 ,300 ,1300 ,350 ,1350 ,300 ,1350 ,300};
char* irSender_write(char* args) {
int codigo = atoi(args);
if(codigo==0) {
irsend.sendRaw(rawUp,23,38);
}
else if(codigo==1) {
irsend.sendRaw(rawDown,23,38);
}
//else if(codigo==2) { //Faltou o STOP da tela
//}
}
//Nao tem leitura de emissor de IR...
char* irSender_read() {
char* r="\0";
}
@@ -0,0 +1,31 @@
char* rs232_write1(char* args) {
int codigo = atoi(args);
if(codigo==1) {
Serial.write(0x02); //Power On
Serial.write("PON");
Serial.write(0x03);
}
else if(codigo==2) { //Power Off
Serial.write(0x02);
Serial.write("POF");
Serial.write(0x03);
}
else if(codigo==3) { //Volume UP
Serial.write(0x02);
Serial.write("AUU");
Serial.write(0x03);
}
else if(codigo==4) { //Volume Down
Serial.write(0x02);
Serial.write("AUD");
Serial.write(0x03);
}
}
char* rs232_read1() {
char* r="\0";
//while(Serial.available()) {
// Serial.print((char) Serial.read());
//}
}
@@ -0,0 +1,29 @@
#include "Device.h"
#include <SPI.h>
#include <Ethernet.h>
#include <IRremote.h>
Device homeDevice=Device("central-device");
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xEC, 0x26 }; //Atentar ao MAC unico de cada placa!
IPAddress ip(192,168,0, 201);
EthernetServer server(80);
void setup() {
homeDevice.add("tela1", CUSTOM, 3, irSender_read , irSender_write);
//panasonic com max232 - 19200
Serial.begin(19200);
homeDevice.add("pana1", CUSTOM, 0, rs232_read1, rs232_write1);
Ethernet.begin(mac, ip);
server.begin();
}
void loop() {
//Para aceitar requisições por Serial
//homeDevice.loop();
//Para aceitar requisições por TCP/IP
ethernet();
}
@@ -0,0 +1,58 @@
char comando[30];
char comandoOK[30];
int contador = 0;
void ethernet() {
EthernetClient client = server.available();
if (client) {
contador =0;
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
//Serial.println("aaa");
comando[contador++]=c;
if(c=='\n') {
//Serial.print("COMANDO: ");
//Serial.println(comando);
contador=0;
for(int x=5;x<30;x++) {
if(comando[x]==' ') break;
comandoOK[contador++]=comando[x];
//Serial.println(x);
}
limpa();
//Serial.print("COMANDO OK: ");
//Serial.println(comandoOK);
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
client.println(homeDevice.execute(comandoOK));
client.flush();
break;
}
}
}
// give the web browser time to receive the data
delay(5);
// close the connection:
client.stop();
//Serial.println("client disonnected");
}
}
void limpa() {
for(int x=0;x<30;x++) {
comando[x]=='\0';
comandoOK[x]=='\0';
}
}
@@ -0,0 +1,26 @@
IRsend irsend;
//unsigned int rawCodes[] = { 19850,1250,450,1200,450,400,1250,1250,400,400,1250,400,1250,450,1200,450,1250,1250,400,400,1250,450,1200,450};
// m1150 s550 m1100 s550 m300 s1300 m1200 s500 m300 s1350 m300 s1350 m350 s1300 m350 s1300 m1150 s550 m300 s1350 m300 s1350 m300
unsigned int rawUp[] = { 1150 ,550 ,1100 ,550 ,300 ,1300 ,1200 ,500 ,300 ,1350 ,300 ,1350 ,350 ,1300 ,350 ,1300 ,1150 ,550 ,300 ,1350 ,300 ,1350 ,300};
unsigned int rawDown[] = { 1150 ,550 ,1100 ,550 ,300 ,1350 ,1100 ,550 ,300 ,1350 ,300 ,1350 ,1150 ,500 ,300 ,1400 ,300 ,1300 ,350 ,1350 ,300 ,1350 ,300};
char* irSender_write(char* args) {
int codigo = atoi(args);
if(codigo==0) {
irsend.sendRaw(rawUp,23,38);
}
else if(codigo==1) {
irsend.sendRaw(rawDown,23,38);
}
//else if(codigo==2) { //Faltou o STOP da tela
//}
}
//Nao tem leitura de emissor de IR...
char* irSender_read() {
char* r="\0";
}
@@ -0,0 +1,32 @@
char* rs232_write1(char* args) {
Serial.begin(19200);
int codigo = atoi(args);
if(codigo==1) {
Serial.write(0x02); //Power On
Serial.write("PON");
Serial.write(0x03);
}
else if(codigo==2) { //Power Off
Serial.write(0x02);
Serial.write("POF");
Serial.write(0x03);
}
else if(codigo==3) { //Volume UP
Serial.write(0x02);
Serial.write("AUU");
Serial.write(0x03);
}
else if(codigo==4) { //Volume Down
Serial.write(0x02);
Serial.write("AUD");
Serial.write(0x03);
}
}
char* rs232_read1() {
char* r="\0";
//while(Serial.available()) {
// Serial.print((char) Serial.read());
//}
}
@@ -0,0 +1,28 @@
#include "Device.h"
#include <SPI.h>
#include <Ethernet.h>
#include <IRremote.h>
Device homeDevice=Device("central-device");
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xEC, 0x7D }; //Atentar ao MAC unico de cada placa!
IPAddress ip(192,168,0, 202);
EthernetServer server(80);
void setup() {
homeDevice.add("tela2", CUSTOM, 3, irSender_read , irSender_write);
homeDevice.add("pana2", CUSTOM, 0, rs232_read1, rs232_write1);
Ethernet.begin(mac, ip);
server.begin();
}
void loop() {
//Para aceitar requisições por Serial
//homeDevice.loop();
//Para aceitar requisições por TCP/IP
ethernet();
}
@@ -0,0 +1,98 @@
char comando[30];
char comandoOK[30];
int contador = 0;
void ethernet() {
EthernetClient client = server.available();
if (client) {
//debug Serial.println("comecando...");
contador =0;
limpa();
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
//debug Serial.print(c);
//Serial.println("aaa");
comando[contador++]=c;
if (c == '\n') {
//debug Serial.println("\nComando recebido");
//if(c=='\n') {
//debug Serial.print("COMANDO ORIGINAL: ");
//debug Serial.println(comando);
contador=0;
//debug Serial.print("Comando OK antes: ");
//debug Serial.println(comandoOK);
limpaOK();
//debug Serial.print("Comando OK depois do limpa: ");
//debug Serial.println(comandoOK);
for(int x=5;x<30;x++) {
if(comando[x]==' ') break;
comandoOK[contador++]=comando[x];
//Serial.println(x);
}
//debug Serial.println("Comando OK depois: ");
//debug Serial.println(comandoOK);
//limpa();
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
client.println("<!DOCTYPE HTML>");
client.println("<html>");
//debug Serial.println("Vai executar...");
homeDevice.execute(comandoOK);
//debug Serial.println("Terminou...");
client.println("</html>");
client.flush();
break;
}
if (c == '\n') {
// you're starting a new line
currentLineIsBlank = true;
}
else if (c != '\r') {
// you've gotten a character on the current line
currentLineIsBlank = false;
}
}
}
//debug Serial.println("Finalizou...");
// give the web browser time to receive the data
delay(5);
// close the connection:
client.stop();
//Serial.println("client disonnected");
}
}
void limpa() {
for(int x=0;x<30;x++) {
comando[x]='\0';
comandoOK[x]='\0';
}
}
void limpaOK() {
//Serial.print("dentro do limpa antes: ");
//Serial.println(comandoOK);
for(int x=0;x<30;x++) {
comandoOK[x]='\0';
}
//Serial.print("dentro do limpa depois: ");
//Serial.println(comandoOK);
}
7
@@ -0,0 +1,77 @@
//codigos para matrix switcher Kramer, IN-OUT, ex 11 -> In 1, Out 1.
char* kramer_write(char* args) {
Serial.begin(9600); //kramer serial - conectar no UNO no TX1 e RX0, lembrar de soltar os fios antes de subir firmware
int codigo = atoi(args);
//Serial.println("vamos la");
if(codigo==11) {
Serial.write(0x01);
Serial.write(0x81);
Serial.write(0x81);
Serial.write(0x81);
}
else if(codigo==12) {
Serial.write(0x01);
Serial.write(0x81);
Serial.write(0x82);
Serial.write(0x81);
}
else if(codigo==21) {
Serial.write(0x01);
Serial.write(0x82);
Serial.write(0x81);
Serial.write(0x81);
}
else if(codigo==22) {
Serial.write(0x01);
Serial.write(0x82);
Serial.write(0x82);
Serial.write(0x81);
}
else if(codigo==31) {
Serial.write(0x01);
Serial.write(0x83);
Serial.write(0x81);
Serial.write(0x81);
}
else if(codigo==32) {
Serial.write(0x01);
Serial.write(0x83);
Serial.write(0x82);
Serial.write(0x81);
}
else if(codigo==41) {
Serial.write(0x01);
Serial.write(0x84);
Serial.write(0x81);
Serial.write(0x81);
}
else if(codigo==42) {
Serial.write(0x01);
Serial.write(0x84);
Serial.write(0x82);
Serial.write(0x81);
}
}
char* kramer_read() {
char* r="\0";
//while(Serial.available()) {
// Serial.print((char) Serial.read());
//}
}
@@ -0,0 +1,34 @@
#include "Device.h"
#include <SPI.h>
#include <Ethernet.h>
#include <IRremote.h>
Device homeDevice=Device("central-device");
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xEC, 0x0F };
IPAddress ip(192,168,0, 210);
EthernetServer server(80);
void setup() {
//Serial.begin(115200);
//homeDevice.add("LED", DIGITAL, 6);
//homeDevice.add("relay1", DIGITAL, 6);
//homeDevice.add("relay2", DIGITAL, 7);
//homeDevice.add("light", ANALOG, 3);
//homeDevice.add("temp", ANALOG, 2);
homeDevice.add("teac1", CUSTOM, 3, irSender_read , irSender_write);
//homeDevice.add("teac2", CUSTOM, 3, irSender_read , irSender_write);
homeDevice.add("kramer", CUSTOM, 0, kramer_read, kramer_write); //kramer na serial - TX1/RX1
//homeDevice.add("polycom", CUSTOM, 0, polycom_read, polycom_write); //polycom na serial2
Ethernet.begin(mac, ip);
server.begin();
}
void loop() {
//Para aceitar requisições por Serial
//homeDevice.loop();
//Para aceitar requisições por TCP/IP
ethernet();
}
@@ -0,0 +1,37 @@
IRsend irsend;
char* irSender_write(char* args) {
int codigo = atoi(args);
if(codigo==0) {
irsend.sendNEC(0x81CEE01F,32); //on off
}
else if(codigo==1) {
irsend.sendNEC(0x81CE807F,32); //Phono
}
else if(codigo==2) {
irsend.sendNEC(0x81CEC03F,32); //FM
}
else if(codigo==3) {
irsend.sendNEC(0x81CE40BF,32); //CD - PC1
}
else if(codigo==4) {
irsend.sendNEC(0x81CE08F7,32); //AUX - Polycom
}
else if(codigo==5) {
irsend.sendNEC(0x81CE20DF,32); //TAPE MONITOR
}
else if(codigo==6) {
irsend.sendNEC(0x81CE609F,32); //Volume Down
}
else if(codigo==7) {
irsend.sendNEC(0x81CEA05F,32); //Volume UP
}
else if(codigo==8) {
irsend.sendNEC(0x81CE10EF,32); //MUTE
}
}
//Nao tem leitura de emissor de IR...
char* irSender_read() {
char* r="\0";
}
@@ -0,0 +1,58 @@
char comando[30];
char comandoOK[30];
int contador = 0;
void ethernet() {
EthernetClient client = server.available();
if (client) {
contador =0;
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
//Serial.println("aaa");
comando[contador++]=c;
if(c=='\n') {
///Serial.print("COMANDO: ");
//Serial.println(comando);
contador=0;
for(int x=5;x<30;x++) {
if(comando[x]==' ') break;
comandoOK[contador++]=comando[x];
//Serial.println(x);
}
limpa();
//Serial.print("COMANDO OK: ");
//Serial.println(comandoOK);
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
client.println(homeDevice.execute(comandoOK));
client.flush();
break;
}
}
}
// give the web browser time to receive the data
delay(5);
// close the connection:
client.stop();
//Serial.println("client disonnected");
}
}
void limpa() {
for(int x=0;x<30;x++) {
comando[x]=='\0';
comandoOK[x]=='\0';
}
}
@@ -0,0 +1,24 @@
/*char* polycom_write(char* args) {
//Serial.println("Iniciando comunicao com Polycom");
//Serial1.begin(19200);
int codigo = atoi(args);
if(codigo==1) {
//Serial1.println("camera near 2");
}
else if(codigo==2) {
//Serial1.print("reboot\r\n");
}
}
char* polycom_read() {
char* r="\0";
Serial.println("Recebendo REsposta");
while(Serial1.available()) {
Serial.print((char) Serial1.read(),DEC);
}
}
*/
@@ -0,0 +1,28 @@
#include "Device.h"
#include <SPI.h>
#include <Ethernet.h>
#include <IRremote.h>
Device homeDevice=Device("central-device");
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xEC, 0x0A };
IPAddress ip(192,168,0, 211);
EthernetServer server(80);
void setup() {
homeDevice.add("teac2", CUSTOM, 3, irSender_read , irSender_write);
//homeDevice.add("polycom", CUSTOM, 0, polycom_read, polycom_write); //polycom ainda nao esta sendo controlado
Ethernet.begin(mac, ip);
server.begin();
}
void loop() {
//Para aceitar requisições por Serial
//homeDevice.loop();
//Para aceitar requisições por TCP/IP
ethernet();
}
@@ -0,0 +1,37 @@
IRsend irsend;
char* irSender_write(char* args) {
int codigo = atoi(args);
if(codigo==0) {
irsend.sendNEC(0x81CEE01F,32); //on off
}
else if(codigo==1) {
irsend.sendNEC(0x81CE807F,32); //Phono
}
else if(codigo==2) {
irsend.sendNEC(0x81CEC03F,32); //FM
}
else if(codigo==3) {
irsend.sendNEC(0x81CE40BF,32); //CD - PC1
}
else if(codigo==4) {
irsend.sendNEC(0x81CE08F7,32); //AUX - Polycom
}
else if(codigo==5) {
irsend.sendNEC(0x81CE20DF,32); //TAPE MONITOR
}
else if(codigo==6) {
irsend.sendNEC(0x81CE609F,32); //Volume Down
}
else if(codigo==7) {
irsend.sendNEC(0x81CEA05F,32); //Volume UP
}
else if(codigo==8) {
irsend.sendNEC(0x81CE10EF,32); //MUTE
}
}
//Nao tem leitura de emissor de IR...
char* irSender_read() {
char* r="\0";
}
@@ -0,0 +1,12 @@
int distancia;
void desviar() {
robot.mudarServo(90);
distancia = robot.sensorDistancia(1);
if(distancia>0 && distancia<15) {
robot.motores.girar(3);
robot.esperar(700);
robot.motores.movimentoAleatorio(3);
robot.esperar(500);
}
robot.motores.frente(3);
}
@@ -0,0 +1,70 @@
#include "DevBot.h"
#include "Servo.h"
#include "NewPing.h"
void setup()
{
robot.configurar(bateria_7_volts);
robot.configurar(motor_6_volts);
robot.configurar(servo_comum);
robot.configurar(programME_v2);
robot.configurar(sensor_distancia_trigecho);
robot.iniciar();
robot.modo(0, controleRemoto);
robot.modo(1, android);
robot.modo(2, desviar);
robot.modo(3, testes);
robot.modo(4, medoDoEscuro);
robot.mudarServo(90);
}
void loop()
{
robot.loop();
}
void controleRemoto() {
robot.controleRemoto();
}
void testes() {
robot.enviar("distancia ");
robot.enviar(robot.sensorDistancia(1));
robot.esperar(200);
/*
robot.enviar("Idle - Parado");
robot.enviar("Luz");
robot.enviar(robot.sensorLuz());
robot.enviar("Temperatura");
robot.enviar(robot.sensorTemperatura());
robot.esperar(500);
robot.enviar("Frente");
robot.motores.frente(3);
robot.esperar(3000);
robot.motores.parar();
robot.esperar(2000);
robot.enviar("Re");
robot.motores.re(3);
robot.esperar(3000);
robot.motores.parar();
robot.esperar(2000);
robot.enviar("Girar Sentido Horario");
robot.motores.girar(3,0);
robot.esperar(3000);
robot.motores.parar();
robot.esperar(2000);
robot.enviar("Girar Sentido Anti-horario");
robot.motores.girar(3,1);
robot.esperar(3000);
robot.motores.parar();
robot.esperar(10000); */
}
@@ -0,0 +1,118 @@
#include <MeetAndroid.h>
MeetAndroid meetAndroid;
int modoAndroid=1;
void android() {
meetAndroid.registerFunction(androidSensorProximidade, 'A');
meetAndroid.registerFunction(androidAcelerometro, 'C');
meetAndroid.registerFunction(androidBussola, 'B');
meetAndroid.registerFunction(androidMudarModo, 'M');
while(!robot.mudouModo()) {
meetAndroid.receive();
//delay(50);
}
}
void androidMudarModo(byte flag, byte numOfValues) {
int length = meetAndroid.stringLength();
// define an array with the appropriate size which will store the string
char comando[length];
// tell MeetAndroid to put the string into your prepared array
meetAndroid.getString(comando);
char c[1];
c[0]=comando[0];
modoAndroid = atoi(c);
//if(modoAndroid<0 || modoAndroid>5) modoAndroid=1;
}
void androidAcelerometro(byte flag, byte numOfValues) {
float acelerometro[3];
meetAndroid.getFloatValues(acelerometro);
if(modoAndroid==1) {
if(acelerometro[0]>-3 && acelerometro[0]<3) {
if(acelerometro[1]<3) {
robot.motores.re(map(acelerometro[1],-3,-10,1,5));
}
else if(acelerometro[1]>3) {
robot.motores.frente(map(acelerometro[1],3,10,1,5));
}
else if(acelerometro[1]>-3 && acelerometro[1]<3) {
robot.motores.parar();
}
}
else if(acelerometro[0]<-3) { //para esquerda
if(acelerometro[1]>-3 && acelerometro[1]<3) { //esquerda no eixo
robot.motores.girar(map(acelerometro[0],-3,-10,1,5),0);
}
else {
robot.motores.esquerda(3);
}
}
else if(acelerometro[0]>3) { //para direita
if(acelerometro[1]>-3 && acelerometro[1]<3) { //direita no eixo
robot.motores.girar(map(acelerometro[0],-3,-10,1,5),1);
}
else {
robot.motores.direita(3);
}
}
}
}
void androidSensorProximidade(byte flag, byte numOfValues) {
int state = meetAndroid.getInt();
if(modoAndroid!=3) return;
if(state==0) {
for(int x=0;x<3;x++) {
robot.motores.girar(4,0);
delay(250);
robot.motores.girar(4,1);
delay(250);
robot.motores.girar(4,0);
delay(250);
robot.motores.girar(4,1);
delay(250);
robot.motores.parar();
}
}
}
void androidBussola(byte flag, byte numOfValues) {
int bussola = meetAndroid.getInt();
if(modoAndroid!=2) return;
if(bussola>350 && bussola<360) {
robot.motores.girar(3,1);
delay(80);
robot.motores.parar();
}
else if(bussola>180 && bussola<350) {
robot.motores.girar(3,1);
delay(200);
robot.motores.parar();
}
else if(bussola>15 && bussola<180) {
robot.motores.girar(3,0);
delay(200);
robot.motores.parar();
}
else if(bussola>3 && bussola<15) {
robot.motores.girar(3,0);
delay(80);
robot.motores.parar();
}
else if(bussola>0 && bussola<3) {
robot.motores.parar();
}
}
@@ -0,0 +1,31 @@
int escuridao = 700; //quanto menor o numero, maior a iluminacao do ambiente.
int luzAtual;
boolean estaClaro() {
return luzAtual<escuridao;
}
void medoDoEscuro() {
luzAtual = robot.sensorLuz();
//esta claro
while(estaClaro()) {
robot.motores.frente(4);
robot.esperar(100);
if(robot.mudouModo()) return; //metodo de libertacao do while se o robo mudar de modo
luzAtual = robot.sensorLuz();
}
//ficou escuro...
while(!estaClaro()) {
robot.motores.re(4);
robot.esperar(100);
if(robot.mudouModo()) return;
luzAtual = robot.sensorLuz();
}
//no esta mais escuro..
robot.motores.girar(4);
robot.esperar(500);
robot.motores.movimentoAleatorio(4);
robot.esperar(500);
}
@@ -0,0 +1,51 @@
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
unsigned long botao_1 = 2640478335;
unsigned long botao_4 = 2640453855;
unsigned long botao_2 = 2640462015;
unsigned long codigo;//variável que recebe o código
decode_results results;
void setup()
{
Serial.begin(115200);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
codigo = results.value;
Serial.println(results.value, DEC);
Serial.println(codigo);
irrecv.resume(); // Receive the next value
}
if(codigo==botao_1){
pinMode(8, OUTPUT);
Serial.println(codigo);
digitalWrite(8, HIGH);
//delay(500);
//digitalWrite(8, LOW);
codigo=0;
}
else if (codigo==botao_2){
Serial.println(codigo);
digitalWrite(8, LOW);
//delay(500);
//digitalWrite(8, LOW);
codigo=0;
}
}
@@ -0,0 +1,63 @@
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include "Device.h"
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
unsigned long botao_1 = 2640478335;
unsigned long botao_4 = 2640453855;
unsigned long botao_2 = 2640462015;
unsigned long codigo;//variável que recebe o código
decode_results results;
Device homeDevice=Device("central-device");
void setup()
{
//homeDevice.add("speaker", DIGITAL, 4);
homeDevice.add("relay1", DIGITAL, 8);
//homeDevice.add("relay2", DIGITAL, 9);
homeDevice.add("light", ANALOG, 3);
homeDevice.add("temp", ANALOG, 2);
//homeDevice.add("pwm-aux1", PWM, 3);
//h/omeDevice.add("pwm-aux2", PWM, 5);
irrecv.enableIRIn(); // Start the receiver
Serial.begin(115200);
}
void loop() {
if (irrecv.decode(&results)) {
codigo = results.value;
Serial.println(results.value, DEC);
//Serial.println(results.value, DEC);
irrecv.resume(); // Receive the next value
}
if(codigo==botao_1){
pinMode(8, OUTPUT);
Serial.println(codigo);
digitalWrite(8, HIGH);
//delay(500);
//digitalWrite(8, LOW);
codigo=0;
}
else if (codigo==botao_2){
Serial.println(codigo);
digitalWrite(8, LOW);
//delay(500);
//digitalWrite(8, LOW);
codigo=0;
}
//homeDevice.loop();
}
@@ -0,0 +1,50 @@
/*
* IRremote: IRrecvDemo - demonstrates receiving IR codes with IRrecv
* An IR detector/demodulator must be connected to the input RECV_PIN.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 11;
IRrecv irrecv(RECV_PIN);
unsigned long botao_1 = 2640478335;
unsigned long botao_4 = 2640453855;
unsigned long botao_2 = 2640462015;
unsigned long codigo;//variável que recebe o código
decode_results results;
void setup()
{
Serial.begin(115200);
irrecv.enableIRIn(); // Start the receiver
}
void loop() {
if (irrecv.decode(&results)) {
codigo = results.value;
Serial.println(results.value, DEC);
irrecv.resume(); // Receive the next value
}
if(codigo==botao_1){
pinMode(8, OUTPUT);
Serial.println(codigo);
digitalWrite(8, HIGH);
//delay(500);
//digitalWrite(8, LOW);
codigo=0;
}
else if (codigo==botao_2){
Serial.println(codigo);
digitalWrite(8, LOW);
//delay(500);
//digitalWrite(8, LOW);
codigo=0;
}
}
@@ -0,0 +1,29 @@
/*
* IRremote: IRsendDemo - demonstrates sending IR codes with IRsend
* An IR LED must be connected to Arduino PWM pin 3.
* Version 0.1 July, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
IRsend irsend;
unsigned long botao_desligar = 33472575;
void setup()
{
Serial.begin(115200);
//irsend.enableIROut(5);
}
void loop() {
for(int x=0;x<3;x++) {
irsend.sendNEC(botao_desligar,32);
delay(100);
}
}
@@ -0,0 +1,176 @@
/*
* IRrecord: record and play back IR signals as a minimal
* An IR detector/demodulator must be connected to the input RECV_PIN.
* An IR LED must be connected to the output PWM pin 3.
* A button must be connected to the input BUTTON_PIN; this is the
* send button.
* A visible LED can be connected to STATUS_PIN to provide status.
*
* The logic is:
* If the button is pressed, send the IR code.
* If an IR code is received, record it.
*
* Version 0.11 September, 2009
* Copyright 2009 Ken Shirriff
* http://arcfn.com
*/
#include <IRremote.h>
int RECV_PIN = 11;
int BUTTON_PIN = 2;
int STATUS_PIN = 13;
IRrecv irrecv(RECV_PIN);
IRsend irsend;
decode_results results;
void setup()
{
Serial.begin(9600);
irrecv.enableIRIn(); // Start the receiver
pinMode(BUTTON_PIN, INPUT);
pinMode(STATUS_PIN, OUTPUT);
}
// Storage for the recorded code
int codeType = -1; // The type of code
unsigned long codeValue; // The code value if not raw
unsigned int rawCodes[RAWBUF]; // The durations if raw
int codeLen; // The length of the code
int toggle = 0; // The RC5/6 toggle state
// Stores the code for later playback
// Most of this code is just logging
void storeCode(decode_results *results) {
codeType = results->decode_type;
int count = results->rawlen;
if (codeType == UNKNOWN) {
Serial.println("Received unknown code, saving as raw");
codeLen = results->rawlen - 1;
// To store raw codes:
// Drop first value (gap)
// Convert from ticks to microseconds
// Tweak marks shorter, and spaces longer to cancel out IR receiver distortion
for (int i = 1; i <= codeLen; i++) {
if (i % 2) {
// Mark
rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK - MARK_EXCESS;
Serial.print(" m");
}
else {
// Space
rawCodes[i - 1] = results->rawbuf[i]*USECPERTICK + MARK_EXCESS;
Serial.print(" s");
}
Serial.print(rawCodes[i - 1], DEC);
}
Serial.println("");
}
else {
if (codeType == NEC) {
Serial.print("Received NEC: ");
if (results->value == REPEAT) {
// Don't record a NEC repeat value as that's useless.
Serial.println("repeat; ignoring.");
return;
}
}
else if (codeType == SONY) {
Serial.print("Received SONY: ");
}
else if (codeType == RC5) {
Serial.print("Received RC5: ");
}
else if (codeType == RC6) {
Serial.print("Received RC6: ");
}
else if (codeType == PANASONIC) {
Serial.print("Received Panasonic: ");
}
else {
Serial.print("Unexpected codeType ");
Serial.print(codeType, DEC);
Serial.println("");
}
Serial.println(results->value, HEX);
codeValue = results->value;
codeLen = results->bits;
}
}
void sendCode(int repeat) {
if (codeType == NEC) {
if (repeat) {
irsend.sendNEC(REPEAT, codeLen);
Serial.println("Sent NEC repeat");
}
else {
irsend.sendNEC(codeValue, codeLen);
Serial.print("Sent NEC ");
Serial.println(codeValue, HEX);
}
}
else if (codeType == SONY) {
irsend.sendSony(codeValue, codeLen);
Serial.print("Sent Sony ");
Serial.println(codeValue, HEX);
}
else if (codeType == RC5 || codeType == RC6) {
if (!repeat) {
// Flip the toggle bit for a new button press
toggle = 1 - toggle;
}
// Put the toggle bit into the code to send
codeValue = codeValue & ~(1 << (codeLen - 1));
codeValue = codeValue | (toggle << (codeLen - 1));
if (codeType == RC5) {
Serial.print("Sent RC5 ");
Serial.println(codeValue, HEX);
irsend.sendRC5(codeValue, codeLen);
}
else {
irsend.sendRC6(codeValue, codeLen);
Serial.print("Sent RC6 ");
Serial.println(codeValue, HEX);
}
}
else if (codeType == PANASONIC) {
irsend.sendPanasonic(0x4004, codeValue);
Serial.print("Sent Panasonic ");
Serial.println(codeValue, HEX);
}
else if (codeType == UNKNOWN /* i.e. raw */) {
// Assume 38 KHz
irsend.sendRaw(rawCodes, codeLen, 38);
Serial.println("Sent raw");
}
}
int lastButtonState;
void loop() {
// If button pressed, send the code.
int buttonState = digitalRead(BUTTON_PIN);
if (lastButtonState == HIGH && buttonState == LOW) {
Serial.println("Released");
irrecv.enableIRIn(); // Re-enable receiver
}
if (!buttonState) {
Serial.println("Pressed, sending");
digitalWrite(STATUS_PIN, HIGH);
sendCode(lastButtonState == buttonState);
digitalWrite(STATUS_PIN, LOW);
delay(50); // Wait a bit between retransmissions
}
else if (irrecv.decode(&results)) {
digitalWrite(STATUS_PIN, HIGH);
storeCode(&results);
irrecv.resume(); // resume receiver
digitalWrite(STATUS_PIN, LOW);
}
lastButtonState = buttonState;
}
@@ -0,0 +1,109 @@
volatile int rate[10]; // array to hold last ten IBI values
volatile unsigned long sampleCounter = 0; // used to determine pulse timing
volatile unsigned long lastBeatTime = 0; // used to find IBI
volatile int P =512; // used to find peak in pulse wave, seeded
volatile int T = 512; // used to find trough in pulse wave, seeded
volatile int thresh = 512; // used to find instant moment of heart beat, seeded
volatile int amp = 100; // used to hold amplitude of pulse waveform, seeded
volatile boolean firstBeat = true; // used to seed rate array so we startup with reasonable BPM
volatile boolean secondBeat = false; // used to seed rate array so we startup with reasonable BPM
void interruptSetup(){
// Initializes Timer2 to throw an interrupt every 2mS.
TCCR2A = 0x02; // DISABLE PWM ON DIGITAL PINS 3 AND 11, AND GO INTO CTC MODE
TCCR2B = 0x06; // DON'T FORCE COMPARE, 256 PRESCALER
OCR2A = 0X7C; // SET THE TOP OF THE COUNT TO 124 FOR 500Hz SAMPLE RATE
TIMSK2 = 0x02; // ENABLE INTERRUPT ON MATCH BETWEEN TIMER2 AND OCR2A
sei(); // MAKE SURE GLOBAL INTERRUPTS ARE ENABLED
}
// THIS IS THE TIMER 2 INTERRUPT SERVICE ROUTINE.
// Timer 2 makes sure that we take a reading every 2 miliseconds
ISR(TIMER2_COMPA_vect){ // triggered when Timer2 counts to 124
cli(); // disable interrupts while we do this
Signal = analogRead(pulsePin); // read the Pulse Sensor
sampleCounter += 2; // keep track of the time in mS with this variable
int N = sampleCounter - lastBeatTime; // monitor the time since the last beat to avoid noise
// find the peak and trough of the pulse wave
if(Signal < thresh && N > (IBI/5)*3){ // avoid dichrotic noise by waiting 3/5 of last IBI
if (Signal < T){ // T is the trough
T = Signal; // keep track of lowest point in pulse wave
}
}
if(Signal > thresh && Signal > P){ // thresh condition helps avoid noise
P = Signal; // P is the peak
} // keep track of highest point in pulse wave
// NOW IT'S TIME TO LOOK FOR THE HEART BEAT
// signal surges up in value every time there is a pulse
if (N > 250){ // avoid high frequency noise
if ( (Signal > thresh) && (Pulse == false) && (N > (IBI/5)*3) ){
Pulse = true; // set the Pulse flag when we think there is a pulse
digitalWrite(blinkPin,HIGH); // turn on pin 13 LED
IBI = sampleCounter - lastBeatTime; // measure time between beats in mS
lastBeatTime = sampleCounter; // keep track of time for next pulse
if(secondBeat){ // if this is the second beat, if secondBeat == TRUE
secondBeat = false; // clear secondBeat flag
for(int i=0; i<=9; i++){ // seed the running total to get a realisitic BPM at startup
rate[i] = IBI;
}
}
if(firstBeat){ // if it's the first time we found a beat, if firstBeat == TRUE
firstBeat = false; // clear firstBeat flag
secondBeat = true; // set the second beat flag
sei(); // enable interrupts again
return; // IBI value is unreliable so discard it
}
// keep a running total of the last 10 IBI values
word runningTotal = 0; // clear the runningTotal variable
for(int i=0; i<=8; i++){ // shift data in the rate array
rate[i] = rate[i+1]; // and drop the oldest IBI value
runningTotal += rate[i]; // add up the 9 oldest IBI values
}
rate[9] = IBI; // add the latest IBI to the rate array
runningTotal += rate[9]; // add the latest IBI to runningTotal
runningTotal /= 10; // average the last 10 IBI values
BPM = 60000/runningTotal; // how many beats can fit into a minute? that's BPM!
QS = true; // set Quantified Self flag
// QS FLAG IS NOT CLEARED INSIDE THIS ISR
}
}
if (Signal < thresh && Pulse == true){ // when the values are going down, the beat is over
digitalWrite(blinkPin,LOW); // turn off pin 13 LED
Pulse = false; // reset the Pulse flag so we can do it again
amp = P - T; // get amplitude of the pulse wave
thresh = amp/2 + T; // set thresh at 50% of the amplitude
P = thresh; // reset these for next time
T = thresh;
}
if (N > 2500){ // if 2.5 seconds go by without a beat
thresh = 512; // set thresh default
P = 512; // set P default
T = 512; // set T default
lastBeatTime = sampleCounter; // bring the lastBeatTime up to date
firstBeat = true; // set these to avoid noise
secondBeat = false; // when we get the heartbeat back
}
sei(); // enable interrupts when youre done!
}// end isr
@@ -0,0 +1,90 @@
/*
>> Pulse Sensor Amped 1.2 <<
This code is for Pulse Sensor Amped by Joel Murphy and Yury Gitman
www.pulsesensor.com
>>> Pulse Sensor purple wire goes to Analog Pin 0 <<<
Pulse Sensor sample aquisition and processing happens in the background via Timer 2 interrupt. 2mS sample rate.
PWM on pins 3 and 11 will not work when using this code, because we are using Timer 2!
The following variables are automatically updated:
Signal : int that holds the analog signal data straight from the sensor. updated every 2mS.
IBI : int that holds the time interval between beats. 2mS resolution.
BPM : int that holds the heart rate value, derived every beat, from averaging previous 10 IBI values.
QS : boolean that is made true whenever Pulse is found and BPM is updated. User must reset.
Pulse : boolean that is true when a heartbeat is sensed then false in time with pin13 LED going out.
This code is designed with output serial data to Processing sketch "PulseSensorAmped_Processing-xx"
The Processing sketch is a simple data visualizer.
All the work to find the heartbeat and determine the heartrate happens in the code below.
Pin 13 LED will blink with heartbeat.
If you want to use pin 13 for something else, adjust the interrupt handler
It will also fade an LED on pin fadePin with every beat. Put an LED and series resistor from fadePin to GND.
Check here for detailed code walkthrough:
http://pulsesensor.myshopify.com/pages/pulse-sensor-amped-arduino-v1dot1
Code Version 1.2 by Joel Murphy & Yury Gitman Spring 2013
This update fixes the firstBeat and secondBeat flag usage so that realistic BPM is reported.
*/
// VARIABLES
int pulsePin = 0; // Pulse Sensor purple wire connected to analog pin 0
int blinkPin = 13; // pin to blink led at each beat
int fadePin = 5; // pin to do fancy classy fading blink at each beat
int fadeRate = 0; // used to fade LED on with PWM on fadePin
// these variables are volatile because they are used during the interrupt service routine!
volatile int BPM; // used to hold the pulse rate
volatile int Signal; // holds the incoming raw data
volatile int IBI = 600; // holds the time between beats, must be seeded!
volatile boolean Pulse = false; // true when pulse wave is high, false when it's low
volatile boolean QS = false; // becomes true when Arduoino finds a beat.
void setup(){
pinMode(blinkPin,OUTPUT); // pin that will blink to your heartbeat!
pinMode(fadePin,OUTPUT); // pin that will fade to your heartbeat!
Serial.begin(115200); // we agree to talk fast!
interruptSetup(); // sets up to read Pulse Sensor signal every 2mS
// UN-COMMENT THE NEXT LINE IF YOU ARE POWERING The Pulse Sensor AT LOW VOLTAGE,
// AND APPLY THAT VOLTAGE TO THE A-REF PIN
analogReference(EXTERNAL);
}
void loop(){
sendDataToProcessing('S', Signal); // send Processing the raw Pulse Sensor data
if (QS == true){ // Quantified Self flag is true when arduino finds a heartbeat
fadeRate = 255; // Set 'fadeRate' Variable to 255 to fade LED with pulse
sendDataToProcessing('B',BPM); // send heart rate with a 'B' prefix
sendDataToProcessing('Q',IBI); // send time between beats with a 'Q' prefix
QS = false; // reset the Quantified Self flag for next time
}
ledFadeToBeat();
delay(20); // take a break
}
void ledFadeToBeat(){
fadeRate -= 15; // set LED fade value
fadeRate = constrain(fadeRate,0,255); // keep LED fade value from going into negative numbers!
analogWrite(fadePin,fadeRate); // fade LED
}
void sendDataToProcessing(char symbol, int data ){
Serial.print(symbol); // symbol prefix tells Processing what type of data is coming
Serial.println(data); // the data to send culminating in a carriage return
}
@@ -0,0 +1,58 @@
char comando[30];
char comandoOK[30];
int contador = 0;
void ethernet() {
EthernetClient client = server.available();
if (client) {
contador =0;
// an http request ends with a blank line
boolean currentLineIsBlank = true;
while (client.connected()) {
if (client.available()) {
char c = client.read();
//Serial.println("aaa");
comando[contador++]=c;
if(c=='\n') {
Serial.print("COMANDO: ");
Serial.println(comando);
contador=0;
for(int x=5;x<30;x++) {
if(comando[x]==' ') break;
comandoOK[contador++]=comando[x];
//Serial.println(x);
}
limpa();
Serial.print("COMANDO OK: ");
Serial.println(comandoOK);
client.println("HTTP/1.1 200 OK");
client.println("Content-Type: text/html");
client.println("Connection: close");
client.println();
client.println(homeDevice.execute(comandoOK));
client.flush();
break;
}
}
}
// give the web browser time to receive the data
delay(5);
// close the connection:
client.stop();
//Serial.println("client disonnected");
}
}
void limpa() {
for(int x=0;x<30;x++) {
comando[x]=='\0';
comandoOK[x]=='\0';
}
}
@@ -0,0 +1,37 @@
IRsend irsend;
char* irSender_write(char* args) {
int codigo = atoi(args);
if(codigo==0) {
irsend.sendNEC(0x81CEE01F,32); //on off
}
else if(codigo==1) {
irsend.sendNEC(0x81CE807F,32); //Phono
}
else if(codigo==2) {
irsend.sendNEC(0x81CEC03F,32); //FM
}
else if(codigo==3) {
irsend.sendNEC(0x81CE40BF,32); //CD
}
else if(codigo==4) {
irsend.sendNEC(0x81CE08F7,32); //AUX
}
else if(codigo==5) {
irsend.sendNEC(0x81CE20DF,32); //TAPE MONITOR
}
else if(codigo==6) {
irsend.sendNEC(0x81CE609F,32); //Volume Down
}
else if(codigo==7) {
irsend.sendNEC(0x81CEA05F,32); //Volume UP
}
else if(codigo==8) {
irsend.sendNEC(0x81CE10EF,32); //MUTE
}
}
//Nao tem leitura de emissor de IR...
char* irSender_read() {
char* r="\0";
}
@@ -0,0 +1,22 @@
char* rs232_write(char* args) {
Serial.begin(9600);
int codigo = atoi(args);
if(codigo==1) {
Serial.write(0x02);
Serial.write("PON");
Serial.write(0x03);
}
else if(codigo==2) {
Serial.write(0x02);
Serial.write("POF");
Serial.write(0x03);
}
}
char* rs232_read() {
char* r="\0";
while(Serial.available()) {
Serial.print((char) Serial.read());
}
}
@@ -0,0 +1,33 @@
#include "Device.h"
#include <SPI.h>
#include <Ethernet.h>
#include <IRremote.h>
Device homeDevice=Device("central-device");
byte mac[] = {0x90, 0xA2, 0xDA, 0x0D, 0xEC, 0x26 }; //Atentar ao MAC unico de cada placa!
IPAddress ip(192,168,0, 201);
EthernetServer server(80);
void setup() {
Serial.begin(115200);
homeDevice.add("LED", DIGITAL, 13);
//homeDevice.add("relay1", DIGITAL, 6);
//homeDevice.add("relay2", DIGITAL, 7);
//homeDevice.add("light", ANALOG, 3);
//homeDevice.add("temp", ANALOG, 2);
homeDevice.add("ir", CUSTOM, 3, irSender_read , irSender_write);
homeDevice.add("panasonic", CUSTOM, 0, rs232_read, rs232_write);
//homeDevice.add("rs2321", CUSTOM, 0, rs232_read, rs232_write);
Ethernet.begin(mac, ip);
server.begin();
}
void loop() {
//Para aceitar requisições por Serial
homeDevice.loop();
//Para aceitar requisições por TCP/IP
ethernet();
}
@@ -0,0 +1,25 @@
void setup() {
Serial.begin(115200);
Serial1.begin(19200);
Serial1.print("STXPONETX");
}
void flash13() {
digitalWrite(13, HIGH);
delay(100);
digitalWrite(13, LOW);
delay(100);
}
void loop() {
while(Serial.available()) {
Serial1.write(Serial.read());
}
Serial1.flush();
delay(20);
while(Serial1.available()) {
Serial.print((char) Serial1.read());
}
}
@@ -0,0 +1,23 @@
void setup() {
Serial.begin(115200);
Serial1.begin(19200);
}
void loop() {
if(!Serial.available()) return;
Serial.println("Comeco");
Serial1.write(0x02);
while(Serial.available()) {
char c = Serial.read();
Serial.print(c);
if(c!='\n') Serial1.write(c);
delay(2);
}
Serial1.write(0x03);
Serial1.flush();
while(Serial1.available()) {
Serial.print((char) Serial1.read());
}
Serial.println("Fim");
}
@@ -0,0 +1,46 @@
/*void atualizaDisplay() {
lcd.clear();
//atualiza temperatura
//lcd.setCursor(col,row);
lcd.setCursor(8,1);
lcd.print(analogRead(SensorTemperatura)/2);
lcd.print("oC");
Serial.print("Temperatura= ");
Serial.println(analogRead(SensorTemperatura)/2);
//atualiza luminosidade
//lcd.setCursor(col,row);
lcd.setCursor(0,1);
lcd.print(map((analogRead(LDR)), 0, 1023, 100,0));
lcd.print(" %");
Serial.print("Luminosidade= ");
Serial.println(map((analogRead(LDR)), 0, 1023, 100,0));
Serial.println(" ");
//lcd.setCursor(col,row);
lcd.setCursor(0,0);
lcd.print(DistanciaEsquerda);
lcd.print(" cms");
//atualiza distancia esquerda
Serial.print("Distancia Esquerda= ");
Serial.println(DistanciaEsquerda);
//atualiza distancia direita
//lcd.setCursor(col,row);
lcd.setCursor(8,0);
lcd.print(DistanciaDireita);
lcd.print(" cms");
Serial.print("Distancia Direita= ");
Serial.println(DistanciaDireita);
}
*/
@@ -0,0 +1,453 @@
#include <Servo.h>
#include <LiquidCrystal.h>
#include <MeetAndroid.h>
MeetAndroid meetAndroid;
#define MOTOR1_P 13
#define MOTOR1_N 12
#define MOTOR1_PWM 5
#define MOTOR2_P 8
#define MOTOR2_N 7
#define MOTOR2_PWM 3
#define PING_PIN 1
#define LED_RED 9
#define LED_BLUE 17
#define LED_GREEN 18
int SensorTemperatura = 1 ;
int LDR = 5;
int bussola=0;
int state=1;
float acelerometro[3];
int contador=0;
//LiquidCrystal lcd(14, 3, 16, 17, 18, 19);
long DistanciaEsquerda;
long DistanciaDireita;
long distancia;
Servo servoV;
Servo servoH;
int modo = 1;
int sentido;
void setup() {
Serial.begin(115200);
servoH.attach(10);
servoV.attach(11);
meetAndroid.setSerial(&Serial);
meetAndroid.registerFunction(dedoDuro, 'A');
meetAndroid.registerFunction(acelera, 'C');
meetAndroid.registerFunction(encontraNorte, 'B');
meetAndroid.registerFunction(andar, 'W');
meetAndroid.registerFunction(leds, 'L');
meetAndroid.registerFunction(mudarModo, 'M');
/* set up the LCD's number of rows and columns:
lcd.begin(16, 2);
lcd.setCursor(0, 0);
lcd.print("Aguardando");*/
pinMode(MOTOR1_P, OUTPUT);
pinMode(MOTOR1_N, OUTPUT);
pinMode(MOTOR2_P, OUTPUT);
pinMode(MOTOR2_N, OUTPUT);
pinMode(MOTOR1_PWM, OUTPUT);
pinMode(MOTOR2_PWM, OUTPUT);
pinMode(LED_RED, OUTPUT);
pinMode(LED_GREEN, OUTPUT);
pinMode(LED_BLUE, OUTPUT);
testeLeds();
}
void loop() {
meetAndroid.receive();
delay(50);
//meetAndroid.send(analogRead(1));
//testeLeds();
}
void leds(byte flag, byte numOfValues) {
int length = meetAndroid.stringLength();
char comando[length];
meetAndroid.getString(comando);
if(comando[0]=='R') {
pinMode(LED_RED,INPUT);
int ligado = digitalRead(LED_RED);
pinMode(LED_RED,OUTPUT);
digitalWrite(LED_RED,!ligado);
}
else if(comando[0]=='G') {
pinMode(LED_GREEN,INPUT);
int ligado = digitalRead(LED_GREEN);
pinMode(LED_GREEN,OUTPUT);
digitalWrite(LED_GREEN,!ligado);
}
else if(comando[0]=='B') {
pinMode(LED_BLUE,INPUT);
int ligado = digitalRead(LED_BLUE);
pinMode(LED_BLUE,OUTPUT);
digitalWrite(LED_BLUE,!ligado);
}
}
void testeLeds() {
digitalWrite(LED_RED, HIGH);
delay(200);
digitalWrite(LED_RED, LOW);
delay(200);
digitalWrite(LED_BLUE, HIGH);
delay(200);
digitalWrite(LED_BLUE, LOW);
delay(200);
digitalWrite(LED_GREEN, HIGH);
delay(200);
digitalWrite(LED_GREEN, LOW);
delay(200);
}
void mudarModo(byte flag, byte numOfValues) {
int length = meetAndroid.stringLength();
// define an array with the appropriate size which will store the string
char comando[length];
// tell MeetAndroid to put the string into your prepared array
meetAndroid.getString(comando);
char c[1];
c[0]=comando[0];
modo = atoi(c);
testeLeds();
}
void acelera(byte flag, byte numOfValues) {
meetAndroid.getFloatValues(acelerometro);
if(modo==4) {
servoV.write(map(acelerometro[0],-10,10,0,180));
servoH.write(map(acelerometro[1],-10,10,0,180));
if(acelerometro[0]>-3 && acelerometro[0]<3) {
if(acelerometro[1]<3) {
andarTraz(200,map(acelerometro[1],-3,-10,1,5));
}
else if(acelerometro[1]>3) {
andarFrente(200,map(acelerometro[1],3,10,1,5));
}
else if(acelerometro[1]>-3 && acelerometro[1]<3) {
parar();
}
}
else if(acelerometro[0]<-3) { //para esquerda
if(acelerometro[1]>-3 && acelerometro[1]<3) { //esquerda no eixo
girarNoEixo(200, map(acelerometro[0],-3,-10,1,5),1);
}
else {
virarEsquerda(200,2);
}
}
else if(acelerometro[0]>3) { //para direita
if(acelerometro[1]>-3 && acelerometro[1]<3) { //direita no eixo
girarNoEixo(200, map(acelerometro[0],-3,-10,1,5),0);
}
else {
virarDireita(200,2);
}
}
}
else if(modo==6){
servoV.write(map(acelerometro[0],-10,10,0,180));
servoH.write(map(acelerometro[1],-10,10,0,180));
delay(200);
}
}
void andar(byte flag, byte numOfValues) {
int length = meetAndroid.stringLength();
char comando[length];
meetAndroid.getString(comando);
if(modo!=3) return;
if(comando[0]=='F') {
dance();
parar();
}
else if(comando[0]=='R') {
andarTraz(1000,3);
parar();
}
else if(comando[0]=='G') {
girarNoEixo(1000,3,0);
parar();
}
else if(comando[0]=='D') {
dance();
}
}
void dedoDuro(byte flag, byte numOfValues) {
state = meetAndroid.getInt();
if(modo!=1) return;
if(state==0) {
for(int x=0;x<3;x++) {
girarNoEixo(200,2,0);
girarNoEixo(200,2,1);
girarNoEixo(200,2,0);
girarNoEixo(200,2,1);
parar();
testeLeds();
}
}
}
void encontraNorte(byte flag, byte numOfValues) {
bussola = meetAndroid.getInt();
if(modo!=2) return;
if(bussola>180) analogWrite(LED_RED, map(bussola, 180, 360, 0,255));
else analogWrite(LED_RED, map(bussola, 180, 0, 0,255));
if(bussola>350 && bussola<360) {
girarNoEixo(80,1,1);
parar();
}
else if(bussola>180 && bussola<350) {
girarNoEixo(200,1,1);
parar();
}
else if(bussola>15 && bussola<180) {
girarNoEixo(200,1,0);
parar();
}
else if(bussola>3 && bussola<15) {
girarNoEixo(80,1,0);
parar();
}
else if(bussola>0 && bussola<3) {
parar();
}
}
/*void limpaComando() {
for(int x=0;x<15;x++) {
comando[x]=' ';
}
}*/
/*
1.5' 3.2'
C E Am
Fao cdigo como co;Maldito bug, que no encontro no;
5.5' 8' com breque
Vem o prazo e o chefo, o redeploy no da certo no;
10' 13'
G F C
Ooooolha o prazo, ta demorando, ta demorando
15' 17' 18'
Oooolha o teste, to implantando, to implantando
19' 20.5 23' 26'
E Am E Am
Estou esperando release, vai ficar muito mais easy
27.8' 30'
28' 30' 31'
G F C
Se voc comea de novo, um bug novo, um bug novo
32' 34' 35'
Estou implorando socorro, pro bug novo, pro bug novo
36'
G F
J estou penando aqui
38' 41'
C E Am
Fao o download de um jar grando, mas tambm no 42'
funciona no
43' 45' 48'
Chamo o arquiteto bacano, mas no fundo um manzo
49.5'
G F C
Olha o budget, ce ta gastando, ce gastando
Olha o prazo, ce ta furando, ce ta furando
E Am
No me sinto up-to-date, eu estou deprecate
*/
int led_status=0;
void changeServo(int a) {
digitalWrite(LED_RED, led_status);
led_status = led_status==0 ? 1 : 0;
}
void dance() {
/*1.5' 3.2'
C E Am
Fao cdigo como co;Maldito bug, que no encontro no;
5.5' 8' com breque
Vem o prazo e o chefo, o redeploy no da certo no;
*/
delay(1500);
andarFrente(1700,4);
andarTraz(2300,4);
girarNoEixo(2000,3,1);
andarTraz(1500,4);
parar();
delay(1500);
/* 10' 13'
G F C
Ooooolha o prazo, ta demorando, ta demorando
*/
changeServo(180);
delay(1000);
changeServo(90);
delay(1000);
changeServo(0);
delay(1000);
changeServo(90);
andarFrente(2000,4);
parar();
/* 15' 17' 18'
Oooolha o teste, to implantando, to implantando
*/
changeServo(180);
delay(1000);
changeServo(0);
delay(1000);
changeServo(90);
delay(1000);
/* 19' 20.5 23' 27'
E Am E Am
Estou esperando release, vai ficar muito mais easy
*/
girarNoEixo(3000,3,1);
parar();
girarNoEixo(3000,3,0);
parar();
changeServo(180);
delay(1000);
changeServo(90);
delay(1000);
changeServo(0);
changeServo(90);
/*28' 30' 31'
G F C
Se voc comea de novo, um bug novo, um bug novo
32' 34' 35'
Estou implorando socorro, pro bug novo, pro bug novo
36'*/
girarNoEixo(3000,3,1);
parar();
girarNoEixo(3000,3,0);
parar();
changeServo(180);
delay(500);
changeServo(90);
delay(500);
changeServo(0);
delay(1000);
andarFrente(2000,3);
parar();
/* Ja estou penando aqui */
changeServo(180);
delay(500);
changeServo(90);
delay(500);
changeServo(0);
delay(1500);
/* Faco download de um jar grandao */
andarFrente(1700,4);
/* Mas tambm no funciona no */
andarTraz(2300,4);
/*Chamo o arquiteto bacanao */
girarNoEixo(2000,3,1);
/*Mas no fundo um manezao */
andarTraz(2000,4);
parar();
delay(2000);
/* Olha o budget */
girarNoEixo(2000,3,0);
changeServo(180);
delay(1000);
changeServo(90);
delay(1000);
changeServo(0);
delay(1000);
changeServo(90);
/* Olha o prazo */
girarNoEixo(2000,3,1);
changeServo(180);
delay(500);
changeServo(0);
delay(500);
changeServo(90);
delay(1000);
/* Nao me sinto uptodate, eu estou deprecated */
girarNoEixo(3000,3,1);
parar();
girarNoEixo(3000,3,0);
parar();
changeServo(180);
delay(1000);
changeServo(90);
delay(1000);
changeServo(0);
changeServo(90);
girarNoEixo(3000,3,1);
parar();
girarNoEixo(3000,3,0);
parar();
changeServo(180);
delay(500);
changeServo(90);
delay(500);
changeServo(0);
delay(1000);
andarFrente(2000,3);
parar();
andarTraz(2000,3);
parar();
changeServo(180);
delay(500);
changeServo(90);
delay(500);
changeServo(0);
delay(500);
changeServo(90);
delay(200000000);
}
@@ -0,0 +1,273 @@
#define DIRECAO_FRENTE 0
#define DIRECAO_FRENTE_ESQUERDA 1
#define DIRECAO_FRENTE_DIREITA 2
#define DIRECAO_TRAZ 3
#define DIRECAO_TRAZ_ESQUERDA 4
#define DIRECAO_TRAZ_DIREITA 5
#define DIRECAO_PARADO 6
#define PRESS_ESQUERDA 0
#define PRESS_DIREITA 2
long duration, inches, cm;
int move_history[128];
int moveCount = 0;
int contaFrente= 0;
boolean pressEsquerda = false;
boolean pressDireita = false;
int servoPos =0;
byte distanceArray[18];
byte pscan=0;
byte frontRead=17;
boolean initScan=false;
int longestPos=0;
int distanceLongestPos = 0;
int distanceLongestPosCorrect = 0;
void changeServoOK(int servoPos) {
//servoHorizontal.write(servoPos); // sets the servo position according to the scaled value
delay(15);
}
void fullScan() {
for(byte x=0;x<18;x++){
changeServo(x*10);
readPing();
distanceArray[x]=cm;
}
changeServo(90);
}
byte getLongestPosition() {
byte value = 0;
int bigValue=0;
for(byte x=0;x<18;x++) {
if(distanceArray[x]>bigValue) {
value=x;
bigValue=distanceArray[x];
}
}
return value;
}
void partialScan() {
changeServo(pscan*10);
readPing();
distanceArray[pscan]=cm;
if(++pscan==18) pscan=0;
}
void Walk() {
changeServo(80);
readPing();
if(cm<35) {
parar();
fullScan();
if(getLongestPosition()<9) virarDireitaRe(500,3);
else virarEsquerdaRe(500,3);
readPing();
while(cm<30) {
if(random(1,100)<=50) {
girarNoEixo(300,3,random(0,1));
}
else {
andarTraz(400,3);
}
readPing();
}
}
else if(cm>35 && cm<50) {
if(moveCount==0 || moveCount==10) {
fullScan();
moveCount=1;
}
moveCount++;
if(getLongestPosition()<9) virarDireita(200,3);
else virarEsquerda(200,3);
}
else {
andarFrente(300,3);
moveCount++;
}
}
void processPing() {
if(cm<20) {
contaFrente=0;
parar();
int contaGiro=0;
while(cm<20 && contaGiro++<10) {
girarNoEixo(random(200,500),3,random(0,1));
readPing();
}
if(cm<20) {
andarTraz(1,3);
if(random(0,1)) {
virarDireita(random(500,random(200,400)),random(2,4));
}
else {
virarEsquerda(random(500,random(200,400)),random(2,4));
}
}
}
else if(cm>20 && cm<45) {
int cmAnterior=cm;
//parar();
/*int tenta=0;
while(cmAnterior<cm && tenta++<20) {
girarNoEixo(50, 4, 1);
cmAnterior=cm;
readPing();
}*/
if(random(0,1)) {
virarDireita(random(50,120),random(2,4));
int cmAnterior=cm;
readPing();
if(cm>cmAnterior) {
while(cm>cmAnterior) {
virarDireita(50,2);
cmAnterior=cm;
readPing();
}
}
}
else {
virarEsquerda(random(50,120),random(2,4));
int cmAnterior=cm;
if(cm>cmAnterior) {
while(cm>cmAnterior) {
virarEsquerda(50,2);
cmAnterior=cm;
readPing();
}
}
}
}
else {
contaFrente++;
andarFrente(50,cm<100 ?2 : cm>100 && cm<150 ? 3 : 4);
}
if(contaFrente>30) {
contaFrente=0;
andarTraz(random(150,450),3);
if(random(0,1)) {
virarDireita(random(150,random(200,400)),random(2,4));
}
else {
virarEsquerda(random(150,random(200,400)),random(2,4));
}
}
}
void girarNoEixo(int tempo, int intensidade, int sentido1) {
analogWrite(MOTOR1_PWM,intensidade*50);
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,sentido1);
digitalWrite(MOTOR1_N,!sentido1);
digitalWrite(MOTOR2_P,!sentido1);
digitalWrite(MOTOR2_N,sentido1);
delay(tempo);
}
void readPress() {
pressEsquerda = !analogRead(PRESS_ESQUERDA)==0;
pressDireita = !analogRead(PRESS_DIREITA)==0;
}
void parar() {
analogWrite(MOTOR1_PWM,0 );
analogWrite(MOTOR2_PWM,0);
}
void andarFrente(int tempo, int intensidade) {
sentido = 0;
analogWrite(MOTOR1_PWM,intensidade*50);
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,sentido);
digitalWrite(MOTOR1_N,!sentido);
digitalWrite(MOTOR2_P,sentido);
digitalWrite(MOTOR2_N,!sentido);
delay(tempo);
}
void andarTraz(int tempo,int intensidade) {
sentido = 1;
analogWrite(MOTOR1_PWM,intensidade*50 );
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,sentido);
digitalWrite(MOTOR1_N,!sentido);
digitalWrite(MOTOR2_P,sentido);
digitalWrite(MOTOR2_N,!sentido);
delay(tempo);
}
void virarEsquerda(int tempo,int intensidade) {
analogWrite(MOTOR1_PWM,intensidade*50 );
analogWrite(MOTOR2_PWM,10*intensidade);
digitalWrite(MOTOR1_P,sentido);
digitalWrite(MOTOR1_N,!sentido);
digitalWrite(MOTOR2_P,sentido);
digitalWrite(MOTOR2_N,!sentido);
delay(tempo);
}
void virarDireita(int tempo,int intensidade) {
analogWrite(MOTOR1_PWM,10*intensidade );
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,sentido);
digitalWrite(MOTOR1_N,!sentido);
digitalWrite(MOTOR2_P,sentido);
digitalWrite(MOTOR2_N,!sentido);
delay(tempo);
}
void virarEsquerdaRe(int tempo,int intensidade) {
analogWrite(MOTOR1_PWM,intensidade*50 );
analogWrite(MOTOR2_PWM,10*intensidade);
digitalWrite(MOTOR1_P,!sentido);
digitalWrite(MOTOR1_N,sentido);
digitalWrite(MOTOR2_P,!sentido);
digitalWrite(MOTOR2_N,sentido);
delay(tempo);
}
void virarDireitaRe(int tempo,int intensidade) {
analogWrite(MOTOR1_PWM,10*intensidade );
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,!sentido);
digitalWrite(MOTOR1_N,sentido);
digitalWrite(MOTOR2_P,!sentido);
digitalWrite(MOTOR2_N,sentido);
delay(tempo);
}
void readPing()
{
pinMode(PING_PIN, OUTPUT);
digitalWrite(PING_PIN, LOW);
delayMicroseconds(2);
digitalWrite(PING_PIN, HIGH);
delayMicroseconds(5);
digitalWrite(PING_PIN, LOW);
pinMode(PING_PIN, INPUT);
duration = pulseIn(PING_PIN, HIGH);
inches = microsecondsToInches(duration);
cm = microsecondsToCentimeters(duration);
}
long microsecondsToInches(long microseconds)
{
return microseconds / 74 / 2;
}
long microsecondsToCentimeters(long microseconds)
{
return microseconds / 29 / 2;
}
@@ -0,0 +1,160 @@
#include <Servo.h>
#define MOTOR1_P 13
#define MOTOR1_N 12
#define MOTOR1_PWM 5
#define MOTOR2_P 8
#define MOTOR2_N 7
#define MOTOR2_PWM 3
#define DISTANCIA 1
int sentido;
Servo servoV;
Servo servoH;
int contador=0;
long distancia;
long distanciaEsquerda;
long distanciaDireita;
void setup() {
servoH.attach(11);
servoV.attach(10);
Serial.begin(9600);
}
int lerPingComMedia() {
int d1,d2,d3;
d1 = analogRead(1);
delay(5);
d2 = analogRead(1);
delay(5);
d3 = analogRead(1);
delay(5);
return (d1 + d2 + d3)/3;
}
void lerPing() {
distancia = lerPingComMedia();
}
void lerPingFull() {
servoH.write(30);
delay(200);
distanciaEsquerda = lerPingComMedia();
servoH.write(100);
delay(200);
distancia = lerPingComMedia();
servoH.write(150);
delay(200);
distanciaDireita = lerPingComMedia();
servoH.write(85);
}
void loop() {
lerPing();
while(distancia>25) {
andarFrente(200,3);
lerPing();
}
while(distancia>15 && distancia<25) {
parar();
delay(200);
lerPingFull();
if(distanciaEsquerda>distancia && distanciaEsquerda>distanciaDireita) {
girarNoEixo(300,2,1);
}
if(distanciaDireita>distancia && distanciaDireita>distanciaEsquerda) {
girarNoEixo(300,2,0);
}
lerPing();
}
while(distancia>5 && distancia<15) {
parar();
andarTraz(500,2);
girarNoEixo(500,2, random(10)%2==0);
lerPing();
}
}
void girarNoEixo(int tempo, int intensidade, int sentido1) {
analogWrite(MOTOR1_PWM,intensidade*50);
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,sentido1);
digitalWrite(MOTOR1_N,!sentido1);
digitalWrite(MOTOR2_P,!sentido1);
digitalWrite(MOTOR2_N,sentido1);
delay(tempo);
}
void parar() {
analogWrite(MOTOR1_PWM,0 );
analogWrite(MOTOR2_PWM,0);
}
void andarTraz(int tempo, int intensidade) {
sentido = 0;
analogWrite(MOTOR1_PWM,intensidade*50);
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,sentido);
digitalWrite(MOTOR1_N,!sentido);
digitalWrite(MOTOR2_P,sentido);
digitalWrite(MOTOR2_N,!sentido);
delay(tempo);
}
void andarFrente(int tempo,int intensidade) {
sentido = 1;
analogWrite(MOTOR1_PWM,intensidade*50 );
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,sentido);
digitalWrite(MOTOR1_N,!sentido);
digitalWrite(MOTOR2_P,sentido);
digitalWrite(MOTOR2_N,!sentido);
delay(tempo);
}
void virarEsquerda(int tempo,int intensidade) {
analogWrite(MOTOR1_PWM,intensidade*50 );
analogWrite(MOTOR2_PWM,10*intensidade);
digitalWrite(MOTOR1_P,sentido);
digitalWrite(MOTOR1_N,!sentido);
digitalWrite(MOTOR2_P,sentido);
digitalWrite(MOTOR2_N,!sentido);
delay(tempo);
}
void virarDireita(int tempo,int intensidade) {
analogWrite(MOTOR1_PWM,10*intensidade );
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,sentido);
digitalWrite(MOTOR1_N,!sentido);
digitalWrite(MOTOR2_P,sentido);
digitalWrite(MOTOR2_N,!sentido);
delay(tempo);
}
void virarEsquerdaRe(int tempo,int intensidade) {
analogWrite(MOTOR1_PWM,intensidade*50 );
analogWrite(MOTOR2_PWM,10*intensidade);
digitalWrite(MOTOR1_P,!sentido);
digitalWrite(MOTOR1_N,sentido);
digitalWrite(MOTOR2_P,!sentido);
digitalWrite(MOTOR2_N,sentido);
delay(tempo);
}
void virarDireitaRe(int tempo,int intensidade) {
analogWrite(MOTOR1_PWM,10*intensidade );
analogWrite(MOTOR2_PWM,intensidade*50);
digitalWrite(MOTOR1_P,!sentido);
digitalWrite(MOTOR1_N,sentido);
digitalWrite(MOTOR2_P,!sentido);
digitalWrite(MOTOR2_N,sentido);
delay(tempo);
}
@@ -0,0 +1,436 @@
#include <LiquidCrystal.h>
#include <MeetAndroid.h>
#define MODE_GPS_LATLONG 0
#define MODE_GPS_SPEED 1
#define MODE_GPS_HEADING 2
#define MODE_GPS_MANE 3
#define MODE_AUTOPILOT_COMPASS 4
#define MODE_AUTOPILOT_ACELEROMETER 5
#define MODE_DEBUG 6
#define MODE_MANUALPILOT 7
#define MOTOR_A 12
#define MOTOR_B 13
#define MOTOR_PWM 11
MeetAndroid meetAndroid;
String modes[] = {
"Google Earth", "Speedy", "Heading", "Piloto Mane'", "Auto Compass", "Auto Aceler.", "Debug", "Manual Pilot" };
LiquidCrystal lcd(4, 9, 57, 56, 55, 54);
char line_gps[300] = "";
int autopilot=0;
int contaplot=0;
int byteGPS=-1;
char comandoGPR[7] = "$GPRMC";
int indices[13];
int cont=0;
int bien=0;
int conta=0;
char latitude[17];
char longitude[17];
char velocidade[17];
char heading[17];
int cvelocidade=0, clatitude=0, clongitude=0, cheading=0;
volatile long targetHeading;
volatile int mode;
long lastDebounce=0;
long debounceDelay=50;
long lcdDelay=1500;
long lcdNextUpdate=0;
long lcdLastUpdate=0;
String lcdLine1;
String lcdLine2;
void setup()
{
//LoL
Serial.begin(9600);
Serial2.begin(115200);
Serial1.begin(4800);
meetAndroid.setSerial(&Serial2);
attachInterrupt(3, buttonPressed, LOW); //PORTA 20, quando estiver subindo
attachInterrupt(2, changeMode, LOW); //PORTA 21, quando estiver subindo
initLCD();
meetAndroid.registerFunction(autoCompass, 'B');
meetAndroid.registerFunction(ghostPilot, 'C');
}
void setupMotor() {
pinMode(MOTOR_A, OUTPUT);
pinMode(MOTOR_B, OUTPUT);
}
void loop()
{
if(mode>=0 && mode<=3) savelocation();
if(mode==MODE_GPS_MANE) pilotoMane();
if(mode==MODE_AUTOPILOT_ACELEROMETER) android();
if(mode==MODE_AUTOPILOT_COMPASS) android();
if(mode==MODE_DEBUG) debug();
if(mode==MODE_MANUALPILOT) manualPilot();
lcdRestore();
}
long headings[6];
int headCount=0; //ahahahah headCount eh bizarro
void pilotoMane() {
//headings[headCount++]=atoi(heading);
//if(headCount==5) headCount=0;
float h = atof(heading);
char c1[10];
itoa(targetHeading,c1,10);
char c2[10];
itoa(h,c2,10);
lcdPrint(c1, c2,0);
if(targetHeading<h) {
digitalWrite(MOTOR_A, 1);
digitalWrite(MOTOR_B, 0);
analogWrite(MOTOR_PWM, 250);
delay(700);
analogWrite(MOTOR_PWM, 0);
delay(2000);
}
else {
digitalWrite(MOTOR_A, 0);
digitalWrite(MOTOR_B, 1);
analogWrite(MOTOR_PWM, 250);
delay(700);
analogWrite(MOTOR_PWM, 0);
delay(2000);
}
}
long headingsAvg() {
long resultado = 0;
for(int x=0;x<6;x++) {
resultado+=headings[x];
}
return resultado/5;
}
void manualPilot() {
//waiting for confirmation
if(autopilot==1) return;
long time = millis() + 7000;
char c1[10];
while(time>millis() && mode==MODE_MANUALPILOT) {
itoa(time-millis(),c1,10);
lcdPrint("Manual Pilot in",c1 , 0);
delay(100);
}
if(mode!=MODE_MANUALPILOT) return;
lcdPrint("Manual Pilot On", "Take care!", 0);
autopilot=1;
detachInterrupt(3); //PORTA 18, quando estiver subindo
detachInterrupt(2); //PORTA 18, quando estiver subindo
attachInterrupt(3, motorForward, LOW); //PORTA 20, quando estiver subindo
attachInterrupt(2, motorBackward, LOW); //PORTA 21, quando estiver subindo
}
void motorForward() {
digitalWrite(MOTOR_A, 0);
digitalWrite(MOTOR_B, 1);
analogWrite(MOTOR_PWM, 250);
while(!digitalRead(20));
analogWrite(MOTOR_PWM,0);
}
void motorBackward() {
digitalWrite(MOTOR_A, 1);
digitalWrite(MOTOR_B, 0);
analogWrite(MOTOR_PWM, 250);
while(!digitalRead(21));
analogWrite(MOTOR_PWM,0);
}
void changeMode() {
if(millis()-lastDebounce>debounceDelay) {
mode = mode== 7 ? 0 : mode + 1;
lastDebounce=millis();
resetMode();
lcdPrint("Mode", modes[mode], 2000);
}
}
void buttonPressed() {
char c1[10];
if(millis()-lastDebounce>debounceDelay) {
targetHeading = targetHeading==360 ? 1 : targetHeading + 5;
lastDebounce=millis();
itoa(targetHeading,c1,10);
lcdPrint("Target Heading",c1, 500);
}
}
void android() {
meetAndroid.receive();
}
void savelocation ()
{
while(Serial1.available()>0) {
byteGPS=Serial1.read(); // Read a byte of the serial port
line_gps[conta]=byteGPS; // If there is serial port data, it is put in the buffer
conta++;
if (byteGPS==13)
{ // If the received byte is = to 13, end of transmission
//Serial.print(line_gps);
cont=0;
bien=0;
for (int i=1;i<7;i++)
{ // Verifies if the received command starts with $GPR
if (line_gps[i]==comandoGPR[i-1])
{
bien++;
}
}
if(bien==6)
{ // If yes, continue and process the data
for (int i=0;i<300;i++)
{
if (line_gps[i]==','){ // check for the position of the "," separator
indices[cont]=i;
cont++;
}
if (line_gps[i]=='*')
{ // ... and the "*"
indices[12]=i;
cont++;
}
}
Serial2.println(line_gps);
Serial.println(""); // ... and write to the serial port
Serial.println("");
Serial.println("---------------");
resetDados();
for (int i=0;i<12;i++)
{
switch(i){
case 0 :
Serial.print("Time in UTC (HhMmSs): ");
break;
case 1 :
Serial.print("Status (A=OK,V=KO): ");
break;
case 2 :
Serial.print("Latitude: ");
break;
case 3 :
Serial.print("Direction (N/S): ");
break;
case 4 :
Serial.print("Longitude: ");
break;
case 5 :
Serial.print("Direction (E/W): ");
break;
case 6 :
Serial.print("Velocity in knots: ");
break;
case 7 :
Serial.print("Heading in degrees: ");
break;
case 8 :
Serial.print("Date UTC (DdMmAa): ");
break;
case 9 :
Serial.print("Magnetic degrees: ");
break;
case 10 :
Serial.print("(E/W): ");
break;
case 11 :
Serial.print("Mode: ");
break;
case 12 :
Serial.print("Checksum: ");
break;
}
for (int j=indices[i];j<(indices[i+1]-1);j++)
{
Serial.print(line_gps[j+1]);
if(i==2) {
latitude[clatitude++]=line_gps[j+1];
}
else if(i==3) {
latitude[clatitude++]=line_gps[j+1];
}
else if(i==4) {
longitude[clongitude++]=line_gps[j+1];
}
else if(i==5) {
longitude[clongitude++]=line_gps[j+1];
}
else if(i==6) {
velocidade[cvelocidade++]=line_gps[j+1];
}
else if(i==7) {
heading[cheading++]=line_gps[j+1];
}
}
Serial.println("");
if(mode==MODE_GPS_LATLONG) lcdPrint(latitude, longitude,0);
else if(mode==MODE_GPS_SPEED) lcdPrint("Speed", velocidade, 0);
else if(mode==MODE_GPS_HEADING) lcdPrint("Heading", heading, 0);
}
}
cvelocidade=0;
clatitude=0;
clongitude=0;
cheading=0;
conta=0; // Reset the buffer
for (int i=0;i<300;i++)
{
line_gps[i]=' ';
}
}
}
}
void resetDados() {
for( int i=0;i<16;i++) {
latitude[i]=' ';
longitude[i]=' ';
velocidade[i]=' ';
heading[i]=' ';
}
}
void initLCD() {
lcd.begin(16, 2);
lcd.clear();
lcdPrint("Eletron Livre", "Tiziu", 0);
delay(2000);
}
void lcdPrint(String line1, String line2, long time) {
if(time==0 && lcdNextUpdate>millis()) return;
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(line1);
lcd.setCursor(0, 1);
lcd.print(line2);
if(time > 0) { //user want to keep last lines...
lcdNextUpdate = millis() + time;
}
else {
lcdLine1=line1;
lcdLine2=line2;
lcdNextUpdate = 0;
}
lcdLastUpdate=millis();
}
void lcdRestore() {
if(lcdNextUpdate!=0 && lcdNextUpdate<=millis()){
lcd.clear();
lcd.setCursor(0, 0);
lcd.print(lcdLine1);
lcd.setCursor(0, 1);
lcd.print(lcdLine2);
lcdNextUpdate=0;
}
}
void debug() {
lcdPrint("Debug", "Avanca", 0);
digitalWrite(MOTOR_A, 0);
digitalWrite(MOTOR_B, 1);
analogWrite(MOTOR_PWM, 250);
delay(1500);
if(mode!=MODE_DEBUG) return;
lcdPrint("Debug", "Para", 0);
analogWrite(MOTOR_PWM, 0);
delay(1500);
if(mode!=MODE_DEBUG) return;
lcdPrint("Debug", "Retro", 0);
digitalWrite(MOTOR_A, 1);
digitalWrite(MOTOR_B, 0);
analogWrite(MOTOR_PWM, 250);
delay(1500);
if(mode!=MODE_DEBUG) return;
lcdPrint("Debug", "Para", 0);
analogWrite(MOTOR_PWM, 0);
delay(1500);
}
void resetMode() {
analogWrite(MOTOR_PWM,0);
}
void autoCompass(byte flag, byte numOfValues) {
if(mode!=MODE_AUTOPILOT_COMPASS) return;
int bussola = meetAndroid.getInt();
char c1[10];
itoa(bussola,c1,10);
lcdPrint("Compass", c1, 0);
}
float acelerometro[3];
void ghostPilot(byte flag, byte numOfValues) {
if(mode!=MODE_AUTOPILOT_ACELEROMETER) return;
meetAndroid.getFloatValues(acelerometro);
if(acelerometro[0]<-3) { //para esquerda
lcdPrint("Debug", "Retro", 0);
digitalWrite(MOTOR_A, 1);
digitalWrite(MOTOR_B, 0);
analogWrite(MOTOR_PWM, 250);
}
else if(acelerometro[0]>3) { //para direita
lcdPrint("Debug", "Avanca", 0);
digitalWrite(MOTOR_A, 0);
digitalWrite(MOTOR_B, 1);
analogWrite(MOTOR_PWM, 250);
}
else {
analogWrite(MOTOR_PWM, 0);
}
//lcdPrint("" + acelerometro[0], "" + acelerometro[1], 0);
}
/*caso 1
heading target command
10 0 reward
0 10 forward
*/
@@ -0,0 +1,8 @@
class EletronLCD {
private:
public:
};
@@ -0,0 +1,7 @@
class EletronOS {
private:
public:
};
@@ -0,0 +1,9 @@
#define LED_P5 4
class ProgramME {
private:
public:
};
@@ -0,0 +1,74 @@
<?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.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="ClientConsole" default="default" basedir=".">
<description>Builds, tests, and runs the project ClientConsole.</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-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="ClientConsole-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
@@ -0,0 +1,6 @@
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: 1.6.0_18-b07 (Sun Microsystems Inc.)
X-COMMENT: Main-Class will be added automatically by build
Main-Class: clientconsole.Main
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<application-client version="6" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application-client_6.xsd">
<display-name>ClientConsole</display-name>
</application-client>
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="-deploy-ant" basedir=".">
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
<property file="${deploy.ant.properties.file}" />
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
</target>
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.sun.web}" validate="false">
</xmlproperty>
<delete file="${temp.sun.web}"/>
<property name="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}"/>
<property name="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}"/>
</target>
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
<property name="deploy.context.root.argument" value=""/>
</target>
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
<mkdir dir="${gfv3.resources.dir}"/>
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
<property name="gfv3.resources.file" value="${gfv3.resources.dir}/META-INF/sun-resources.xml"/>
<copy todir="${gfv3.resources.dir}/META-INF">
<fileset dir="${deploy.ant.resource.dir}"/>
</copy>
<jar destfile="${deploy.ant.archive}" update="true">
<fileset dir="${gfv3.resources.dir}"/>
</jar>
<delete dir="${gfv3.resources.dir}"/>
</target>
<target name="-deploy-ant" depends="-parse-sun-web,-no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
<antcall target="-deploy-without-pw"/>
<antcall target="-deploy-with-pw"/>
</target>
<target name="-deploy-without-pw" unless="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-deploy-with-pw" if="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
<antcall target="-undeploy-without-pw"/>
<antcall target="-undeploy-with-pw"/>
</target>
<target name="-undeploy-without-pw" unless="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-with-pw" if="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
</project>
@@ -0,0 +1,982 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- jar
- execution
- debugging
- javadoc
- junit compilation
- junit execution
- junit debugging
- applet
- cleanup
-->
<project xmlns:carproject="http://www.netbeans.org/ns/car-project/1" basedir=".." default="default" name="ClientConsole-impl">
<import file="ant-deploy.xml"/>
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
</fail>
<target depends="dist,javadoc" description="Build whole project." name="default"/>
<!--
======================
INITIALIZATION SECTION
======================
-->
<target name="-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-pre-init-am">
<!-- Access Manager pre-initialization -->
</target>
<target depends="-pre-init" name="-init-private">
<property file="nbproject/private/private.properties"/>
</target>
<target depends="-pre-init,-init-private" name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target depends="-pre-init,-init-private,-init-user" name="-init-project">
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
</or>
</condition>
<condition property="have.sources">
<or>
<available file="${src.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
<and>
<isset property="netbeans.home"/>
<isset property="have.tests"/>
</and>
</condition>
<property name="javadoc.preview" value="true"/>
<condition property="no.javadoc.preview">
<isfalse value="${javadoc.preview}"/>
</condition>
<property name="javac.compilerargs" value=""/>
<property name="work.dir" value="${basedir}"/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<property name="javac.debug" value="true"/>
<available file="${meta.inf}/MANIFEST.MF" property="has.custom.manifest"/>
<condition property="classes.dir" value="${build.ear.classes.dir}">
<isset property="dist.ear.dir"/>
</condition>
<property name="classes.dir" value="${build.classes.dir}"/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<condition property="no.dist.ear.dir">
<not>
<isset property="dist.ear.dir"/>
</not>
</condition>
<condition property="do.display.browser">
<istrue value="${display.browser}"/>
</condition>
<condition else="" property="application.args.param" value="${application.args}">
<and>
<isset property="application.args"/>
<not>
<equals arg1="${application.args}" arg2="" trim="true"/>
</not>
</and>
</condition>
<condition else="" property="run.jvmargs.param" value="${run.jvmargs}">
<and>
<isset property="run.jvmargs"/>
<not>
<equals arg1="${run.jvmargs}" arg2="" trim="true"/>
</not>
</and>
</condition>
<property name="source.encoding" value="${file.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
<not>
<equals arg1="${javadoc.encoding}" arg2=""/>
</not>
</and>
</condition>
<property name="javadoc.encoding.used" value="${source.encoding}"/>
<property name="includes" value="**"/>
<property name="excludes" value=""/>
<path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
<condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
<length length="0" string="${endorsed.classpath}" when="greater"/>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init,-init-private,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="test.src.dir">Must set test.src.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
<fail unless="build.generated.dir">Must set build.generated.dir</fail>
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
<fail unless="build.test.classes.dir">Must set build.test.classes.dir</fail>
<fail unless="build.test.results.dir">Must set build.test.results.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.jar">Must set dist.jar</fail>
<condition property="missing.j2ee.server.home">
<and>
<matches pattern="j2ee.server.home" string="${j2ee.platform.classpath}"/>
<not>
<isset property="j2ee.server.home"/>
</not>
</and>
</condition>
<fail if="missing.j2ee.server.home">
The Java EE server classpath is not correctly set up - server home directory is missing.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Dj2ee.server.home=&lt;app_server_installation_directory&gt;
</fail>
<fail unless="j2ee.platform.classpath">
The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Duser.properties.file=&lt;path_to_property_file&gt; (where you put the property "j2ee.platform.classpath" in a .properties file)
or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties file is used)
</fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/car-project/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
</target>
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
<macrodef name="javac" uri="http://www.netbeans.org/ns/car-project/1">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="${empty.dir}" name="gensrcdir"/>
<element name="customize" optional="true"/>
<sequential>
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<mkdir dir="@{apgeneratedsrcdir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
</dirset>
</src>
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
<compilerarg line="${javac.compilerargs}"/>
<compilerarg value="-processorpath"/>
<compilerarg path="@{processorpath}:${empty.dir}"/>
<compilerarg line="${ap.processors.internal}"/>
<compilerarg value="-s"/>
<compilerarg path="@{apgeneratedsrcdir}"/>
<compilerarg line="${ap.proc.none.internal}"/>
<customize/>
</javac>
</sequential>
</macrodef>
</target>
<target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
<macrodef name="javac" uri="http://www.netbeans.org/ns/car-project/1">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="${empty.dir}" name="gensrcdir"/>
<element name="customize" optional="true"/>
<sequential>
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
</dirset>
</src>
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
<compilerarg line="${javac.compilerargs}"/>
<customize/>
</javac>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
<macrodef name="depend" uri="http://www.netbeans.org/ns/car-project/1">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<sequential>
<depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</depend>
</sequential>
</macrodef>
<macrodef name="force-recompile" uri="http://www.netbeans.org/ns/car-project/1">
<attribute default="${build.classes.dir}" name="destdir"/>
<sequential>
<fail unless="javac.includes">Must set javac.includes</fail>
<pathconvert pathsep="," property="javac.includes.binary">
<path>
<filelist dir="@{destdir}" files="${javac.includes}"/>
</path>
<globmapper from="*.java" to="*.class"/>
</pathconvert>
<delete>
<files includes="${javac.includes.binary}"/>
</delete>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<macrodef name="junit" uri="http://www.netbeans.org/ns/car-project/1">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<sequential>
<junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${java.io.tmpdir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
<path path="${j2ee.platform.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${run.jvmargs.param}"/>
</junit>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-java">
<macrodef name="java" uri="http://www.netbeans.org/ns/car-project/1">
<attribute default="${main.class}" name="classname"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${j2ee.appclient.tool.jvmoptions}"/>
<jvmarg line="${run.jvmargs.param}"/>
<classpath>
<path path="${dist.jar}:${javac.classpath}:${j2ee.platform.classpath}:${j2ee.appclient.tool.runtime}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/car-project/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="" name="stopclassname"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" stopclassname="@{stopclassname}" transport="${debug-transport}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/car-project/1">
<attribute default="${build.classes.dir}" name="dir"/>
<sequential>
<nbjpdareload>
<fileset dir="@{dir}" includes="${fix.classes}">
<include name="${fix.includes}*.class"/>
</fileset>
</nbjpdareload>
</sequential>
</macrodef>
<macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/web-project/1">
<sequential>
<nbjpdaappreloaded/>
</sequential>
</macrodef>
</target>
<target name="-init-debug-args">
<property name="version-output" value="java version &quot;${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
<os family="windows"/>
</condition>
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
<isset property="debug.transport"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/car-project/1">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<attribute default="${application.args.param}" name="args"/>
<sequential>
<java classname="@{classname}" dir="${work.dir}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<jvmarg line="${run.jvmargs.param}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<arg line="@{args}"/>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug-appclient">
<macrodef name="debug-appclient" uri="http://www.netbeans.org/ns/car-project/1">
<attribute name="mainclass"/>
<attribute default="${debug.classpath}" name="classpath"/>
<element name="customize" optional="true"/>
<attribute default="${application.args.param}" name="args"/>
<sequential>
<parallel>
<java classname="@{mainclass}" dir="${work.dir}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${j2ee.appclient.tool.jvmoptions}"/>
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${jpda.transport},server=y,address=${jpda.address},suspend=y"/>
<jvmarg line="${run.jvmargs.param}"/>
<arg line="@{args}"/>
<classpath>
<path path="${javac.classpath}:${j2ee.platform.classpath}:${j2ee.appclient.tool.runtime}"/>
<path path="@{classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
<nbjpdaconnect address="${jpda.address}" host="${jpda.host}" name="${name}" transport="${jpda.transport}">
<classpath>
<path path="${javac.classpath}:${j2ee.platform.classpath}:${j2ee.appclient.tool.runtime}"/>
<path path="@{classpath}"/>
</classpath>
<sourcepath>
<path path="${src.dir}"/>
</sourcepath>
</nbjpdaconnect>
</parallel>
</sequential>
</macrodef>
</target>
<target name="-init-taskdefs">
<fail unless="libs.CopyLibs.classpath">
The libs.CopyLibs.classpath property is not set up.
This property must point to
org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
of NetBeans IDE installation and is usually located at
&lt;netbeans_installation&gt;/java&lt;version&gt;/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library
exists or setup the property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar
</fail>
<taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/>
</target>
<target name="-init-ap-cmdline-properties">
<property name="annotation.processing.enabled" value="true"/>
<property name="annotation.processing.processors.list" value=""/>
<property name="annotation.processing.run.all.processors" value="true"/>
<property name="javac.processorpath" value="${javac.classpath}"/>
<property name="javac.test.processorpath" value="${javac.test.classpath}"/>
<condition property="ap.supported.internal" value="true">
<not>
<matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
</not>
</condition>
</target>
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
<condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
<isfalse value="${annotation.processing.run.all.processors}"/>
</condition>
<condition else="" property="ap.proc.none.internal" value="-proc:none">
<isfalse value="${annotation.processing.enabled}"/>
</condition>
</target>
<target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
<property name="ap.cmd.line.internal" value=""/>
</target>
<target depends="-pre-init,-pre-init-am,-init-private,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-debug-appclient,-init-taskdefs,-init-ap-cmdline" name="init"/>
<!--
===================
COMPILATION SECTION
===================
-->
<target name="-check-main-class">
<fail>
Main class must be set. Go to ClientConsole project properties -&gt; Run and set the main class there.
<condition>
<not>
<or>
<isset property="dist.ear.dir"/>
<isset property="main.class"/>
</or>
</not>
</condition>
</fail>
</target>
<target depends="init" if="no.dist.ear.dir" name="-deps-module-jar" unless="no.deps">
<ant antfile="${project.Coffee-Timer-EJB}/build.xml" inheritall="false" target="dist"/>
</target>
<target depends="init" if="dist.ear.dir" name="-deps-ear-jar" unless="no.deps">
<ant antfile="${project.Coffee-Timer-EJB}/build.xml" inheritall="false" target="dist-ear">
<property location="${build.dir}" name="dist.ear.dir"/>
</ant>
</target>
<target depends="init, -check-main-class, -deps-module-jar, -deps-ear-jar" name="deps-jar"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${classes.dir}"/>
</target>
<target name="-pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="compile" name="library-inclusion-in-archive">
<mkdir dir="${build.classes.dir}/META-INF/lib"/>
<copyfiles files="${reference.Coffee-Timer-EJB.dist}" todir="${build.classes.dir}/META-INF/lib"/>
</target>
<target depends="compile" if="dist.ear.dir" name="library-inclusion-in-manifest">
<copyfiles files="${reference.Coffee-Timer-EJB.dist}" manifestproperty="manifest.reference.Coffee-Timer-EJB.dist" todir="${dist.ear.dir}"/>
<manifest file="${build.ear.classes.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Class-Path" value="${manifest.reference.Coffee-Timer-EJB.dist} "/>
</manifest>
</target>
<target name="-copy-meta-inf">
<copy todir="${classes.dir}">
<fileset dir="${meta.inf}" includes="**/*.dbschema"/>
</copy>
<copy todir="${classes.dir}/META-INF">
<fileset dir="${meta.inf}" excludes="**/*.dbschema **/xml-resources/** ${meta.inf.excludes}"/>
</copy>
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-copy-meta-inf" if="have.sources" name="-do-compile">
<carproject:javac destdir="${classes.dir}" gensrcdir="${build.generated.sources.dir}"/>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<carproject:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<!--
====================
DIST BUILDING SECTION
====================
-->
<target depends="init" name="-pre-pre-dist">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
</target>
<target name="-pre-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-dist,library-inclusion-in-archive" if="has.custom.manifest" name="-do-dist-with-manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<manifest file="${build.classes.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
<jar compress="${jar.compress}" jarfile="${dist.jar}" manifest="${build.classes.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build.classes.dir}"/>
</jar>
</target>
<target depends="init,compile,-pre-dist,library-inclusion-in-archive" name="-do-dist-without-manifest" unless="has.custom.manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<fileset dir="${build.classes.dir}"/>
</jar>
</target>
<target depends="init,compile,-pre-dist" if="has.custom.manifest" name="-do-ear-dist-with-manifest">
<dirname file="${dist.ear.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<manifest file="${build.ear.classes.dir}/META-INF/MANIFEST.MF" mode="update">
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
<jar compress="${jar.compress}" jarfile="${dist.ear.jar}" manifest="${build.ear.classes.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build.ear.classes.dir}"/>
</jar>
</target>
<target depends="init,compile,-pre-dist" name="-do-ear-dist-without-manifest" unless="has.custom.manifest">
<dirname file="${dist.ear.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.ear.jar}">
<fileset dir="${build.ear.classes.dir}"/>
</jar>
</target>
<target depends="init,compile,-pre-dist,library-inclusion-in-archive,-do-dist-without-manifest,-do-dist-with-manifest" name="-do-dist"/>
<target depends="init,compile,-pre-dist,library-inclusion-in-manifest,-do-ear-dist-without-manifest,-do-ear-dist-with-manifest" name="-do-ear-dist"/>
<target name="-post-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-dist,-do-dist,-post-dist" description="Build distribution (JAR)." name="dist"/>
<target depends="init,compile,-pre-dist,-do-ear-dist,-post-dist" description="Build distribution (JAR) to be packaged into an EAR." name="dist-ear"/>
<!--
=================
EXECUTION SECTION
=================
-->
<target depends="dist,run-deploy,run-tool2,old-run-jar,run-display-browser" description="Run a main class." name="run"/>
<target depends="dist,run-deploy" description="Run a main class." if="j2ee.appclient.tool.args" name="old-run-jar">
<antcall target="run-tool"/>
<antcall target="run-jar"/>
</target>
<target depends="init" description="Run a main class." if="j2ee.clientName" name="run-jar" unless="j2ee.appclient.mainclass.args">
<carproject:java classname="${main.class}">
<customize>
<arg line="${application.args.param}"/>
</customize>
</carproject:java>
</target>
<target depends="init,-as-retrieve-option-workaround" description="Run a main class." if="j2ee.appclient.mainclass.args" name="run-tool" unless="j2ee.clientName">
<java classname="${j2ee.appclient.tool.mainclass}" dir="${work.dir}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${j2ee.appclient.tool.jvmoptions}"/>
<jvmarg line="${run.jvmargs.param}"/>
<arg line="${j2ee.appclient.tool.args}"/>
<arg line="-client ${client.jar}"/>
<arg line="${application.args.param}"/>
<classpath>
<path path="${javac.classpath}:${j2ee.platform.classpath}:${j2ee.appclient.tool.runtime}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
</java>
</target>
<target depends="init,run-deploy,-as-retrieve-option-workaround" description="Run a main class." name="run-tool2" unless="j2ee.appclient.tool.args">
<mkdir dir="${dist.dir}/ClientConsoleClient"/>
<copy file="${dist.jar}" todir="${dist.dir}/ClientConsoleClient"/>
<java dir="${work.dir}" fork="true" jar="${client.jar}">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${j2ee.appclient.tool.jvmoptions}${client.jar}"/>
<jvmarg line="${run.jvmargs.param}"/>
<arg line="${application.args.param}"/>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
</java>
</target>
<target depends="init,compile-single" name="run-single">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<carproject:java classname="${run.class}"/>
</target>
<target if="j2ee.appclient.mainclass.args" name="-as-retrieve-option-workaround" unless="j2ee.clientName">
<property name="client.jar" value="${dist.dir}/ClientConsoleClient.jar"/>
<sleep seconds="3"/>
<copy file="${wa.copy.client.jar.from}/ClientConsole/ClientConsoleClient.jar" todir="${dist.dir}"/>
</target>
<target name="pre-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="post-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-pre-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -pre-run-deploy task instead. -->
</target>
<target name="-post-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -post-run-deploy task instead. -->
</target>
<target name="-run-deploy-am">
<!-- Task to deploy to the Access Manager runtime. -->
</target>
<target depends="init,compile,dist,pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,post-run-deploy" name="run-deploy">
<nbjpdaappreloaded/>
</target>
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
<target name="-init-deploy-ant" unless="netbeans.home">
<property name="deploy.ant.archive" value="${dist.jar}"/>
<property name="deploy.ant.resource.dir" value="${resource.dir}"/>
<property name="deploy.ant.enabled" value="true"/>
</target>
<target depends="init,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/>
<target if="netbeans.home" name="-run-undeploy-nb">
<fail message="Undeploy is not supported from within the IDE"/>
</target>
<target depends="run-deploy,-init-display-browser,-display-browser-nb,-display-browser-cl" name="run-display-browser"/>
<target if="do.display.browser" name="-init-display-browser">
<condition property="do.display.browser.nb">
<isset property="netbeans.home"/>
</condition>
<condition property="do.display.browser.cl">
<and>
<isset property="deploy.ant.enabled"/>
<isset property="deploy.ant.client.url"/>
</and>
</condition>
</target>
<target if="do.display.browser.nb" name="-display-browser-nb">
<nbbrowse url="${client.url}"/>
</target>
<target if="do.display.browser.cl" name="-get-browser" unless="browser">
<condition property="browser" value="rundll32">
<os family="windows"/>
</condition>
<condition else="" property="browser.args" value="url.dll,FileProtocolHandler">
<os family="windows"/>
</condition>
<condition property="browser" value="/usr/bin/open">
<os family="mac"/>
</condition>
<property environment="env"/>
<condition property="browser" value="${env.BROWSER}">
<isset property="env.BROWSER"/>
</condition>
<condition property="browser" value="/usr/bin/firefox">
<available file="/usr/bin/firefox"/>
</condition>
<condition property="browser" value="/usr/local/firefox/firefox">
<available file="/usr/local/firefox/firefox"/>
</condition>
<condition property="browser" value="/usr/bin/mozilla">
<available file="/usr/bin/mozilla"/>
</condition>
<condition property="browser" value="/usr/local/mozilla/mozilla">
<available file="/usr/local/mozilla/mozilla"/>
</condition>
<condition property="browser" value="/usr/sfw/lib/firefox/firefox">
<available file="/usr/sfw/lib/firefox/firefox"/>
</condition>
<condition property="browser" value="/opt/csw/bin/firefox">
<available file="/opt/csw/bin/firefox"/>
</condition>
<condition property="browser" value="/usr/sfw/lib/mozilla/mozilla">
<available file="/usr/sfw/lib/mozilla/mozilla"/>
</condition>
<condition property="browser" value="/opt/csw/bin/mozilla">
<available file="/opt/csw/bin/mozilla"/>
</condition>
</target>
<target depends="-get-browser" if="do.display.browser.cl" name="-display-browser-cl">
<fail unless="browser">
Browser not found, cannot launch the deployed application. Try to set the BROWSER environment variable.
</fail>
<property name="browse.url" value="${deploy.ant.client.url}${client.urlPart}"/>
<echo>Launching ${browse.url}</echo>
<exec executable="${browser}" spawn="true">
<arg line="${browser.args} ${browse.url}"/>
</exec>
</target>
<target depends="dist" name="verify">
<nbverify file="${dist.jar}"/>
</target>
<target depends="init,compile-single" name="run-main">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<carproject:java classname="${run.class}"/>
</target>
<!--
=================
DEBUGGING SECTION
=================
-->
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
<carproject:nbjpdastart name="${debug.class}"/>
</target>
<target depends="init,compile" name="-debug-start-debuggee">
<carproject:debug>
<customize>
<arg line="${application.args.param}"/>
</customize>
</carproject:debug>
</target>
<target if="j2ee.clientName" name="debug-jar" unless="j2ee.appclient.mainclass.args">
<carproject:debug-appclient args="${application.args.param}" mainclass="${main.class}"/>
</target>
<target depends="init,-as-retrieve-option-workaround" if="j2ee.appclient.mainclass.args" name="debug-tool" unless="j2ee.clientName">
<carproject:debug-appclient args="${j2ee.appclient.mainclass.args} ${application.args.param}" mainclass="${j2ee.appclient.tool.mainclass}"/>
</target>
<target depends="init,compile,run-deploy,debug-tool,debug-jar" description="Debug project in IDE." if="netbeans.home" name="debug"/>
<target depends="init" if="netbeans.home" name="-debug-start-debugger-stepinto">
<carproject:nbjpdastart stopclassname="${main.class}"/>
</target>
<target depends="init,compile,-debug-start-debugger-stepinto,-debug-start-debuggee" if="netbeans.home" name="debug-stepinto"/>
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
<fail unless="debug.class">Must select one file in the IDE or set debug.class</fail>
<carproject:debug classname="${debug.class}"/>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single"/>
<target depends="init" name="-pre-debug-fix">
<fail unless="fix.includes">Must set fix.includes</fail>
<property name="javac.includes" value="${fix.includes}.java"/>
</target>
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
<carproject:nbjpdareload/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
===============
JAVADOC SECTION
===============
-->
<target depends="init" if="have.sources" name="-javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}:${j2ee.platform.classpath}:${j2ee.appclient.tool.runtime}"/>
</classpath>
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/*.java"/>
</fileset>
</javadoc>
<copy todir="${dist.javadoc.dir}">
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/doc-files/**"/>
</fileset>
</copy>
</target>
<target depends="init,-javadoc-build" if="netbeans.home" name="-javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,-javadoc-build,-javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
=========================
JUNIT COMPILATION SECTION
=========================
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
</target>
<target name="-pre-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test" if="have.tests" name="-do-compile-test">
<carproject:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
<target name="-pre-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<carproject:javac classpath="${javac.test.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
=======================
JUNIT EXECUTION SECTION
=======================
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<carproject:junit testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init" if="have.tests" name="test-report"/>
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
<target depends="init" if="have.tests" name="-pre-test-run-single">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<carproject:junit excludes="" includes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<!--
=======================
JUNIT DEBUGGING SECTION
=======================
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<!-- the directory must exist, otherwise the XML formatter would fail -->
<mkdir dir="${build.test.results.dir}"/>
<carproject:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}">
<customize>
<arg value="${test.class}"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</carproject:debug>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<carproject:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<carproject:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
=========================
APPLET EXECUTION SECTION
=========================
-->
<target depends="init,compile-single" name="run-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<carproject:java classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</carproject:java>
</target>
<!--
=========================
APPLET DEBUGGING SECTION
=========================
-->
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-applet">
<fail unless="applet.url">Must select one file in the IDE or set applet.url</fail>
<carproject:debug classname="sun.applet.AppletViewer">
<customize>
<arg value="${applet.url}"/>
</customize>
</carproject:debug>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-applet" if="netbeans.home" name="debug-applet"/>
<!--
===============
CLEANUP SECTION
===============
-->
<target depends="init" if="no.dist.ear.dir" name="deps-clean" unless="no.deps">
<ant antfile="${project.Coffee-Timer-EJB}/build.xml" inheritall="false" target="clean"/>
</target>
<target depends="init" name="-do-clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
<target depends="clean" description="Clean build products." name="clean-ear"/>
</project>
@@ -0,0 +1,8 @@
build.xml.data.CRC32=da2f8713
build.xml.script.CRC32=15c62e87
build.xml.stylesheet.CRC32=2c379194@1.16.2.1
# 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.
nbproject/build-impl.xml.data.CRC32=da2f8713
nbproject/build-impl.xml.script.CRC32=b080f751
nbproject/build-impl.xml.stylesheet.CRC32=b21e29a6@1.16.2.1
@@ -0,0 +1,11 @@
deploy.ant.properties.file=/home/vsenger/.netbeans/6.9/gfv31837373329.properties
j2ee.appclient.tool.jvmoptions=-Djava.endorsed.dirs="/java/glassfish3.1-final/glassfish/lib/endorsed":"/java/glassfish3.1-final/glassfish/modules/endorsed" -javaagent:"/java/glassfish3.1-final/glassfish/modules/gf-client.jar"=mode=acscript,arg=-configxml,arg="/java/glassfish3.1-final/glassfish/domains/domain1/config/sun-acc.xml",client=jar=
j2ee.appclient.tool.jvmoptions.class=-Djava.endorsed.dirs="/java/glassfish-3.0.1/glassfish/lib/endorsed":"/java/glassfish-3.0.1/glassfish/modules/endorsed" -javaagent:"/java/glassfish-3.0.1/glassfish/modules/gf-client.jar"=mode=acscript,arg=-configxml,arg="/java/glassfish-3.0.1/glassfish/domains/domain1/config/sun-acc.xml",client=class=
j2ee.appclient.tool.mainclass=org.glassfish.appclient.client.AppClientFacade
j2ee.appclient.tool.runtime=
j2ee.platform.is.jsr109=true
j2ee.server.home=/java/glassfish3.1-final/glassfish
j2ee.server.instance=[/java/glassfish3.1-final/glassfish]deployer:gfv3ee6:localhost:4848
source.encoding=UTF-8
user.properties.file=/home/vsenger/.netbeans/6.9/build.properties
wa.copy.client.jar.from=/java/glassfish3.1-final/glassfish/domains/domain1/generated/xml
@@ -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>
@@ -0,0 +1,85 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=true
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/jar
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.ear.classes.dir=${build.dir}/jar
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.ear.jar=${dist.dir}/${jar.name}
dist.jar=${dist.dir}/${jar.name}
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=\
${libs.javaee-endorsed-api-6.0.classpath}
excludes=
includes=**
j2ee.appclient.mainclass.args=${j2ee.appclient.tool.args}
j2ee.platform=1.6
j2ee.platform.classpath=${j2ee.server.home}/modules/javax.security.jacc.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.security.auth.message.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxrpc-api-osgi.jar:${j2ee.server.home}/modules/jsf-impl.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.ejb.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/javax.enterprise.deploy.jar:${j2ee.server.home}/modules/javax.jms.jar:${j2ee.server.home}/modules/javax.transaction.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.servlet.jar:${j2ee.server.home}/modules/endorsed/javax.annotation.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee.jar:${j2ee.server.home}/modules/javax.resource.jar:${j2ee.server.home}/modules/jsf-api.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.home}/modules/jstl-impl.jar
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/javax.ejb.jar
j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/javax.ejb.jar
j2ee.platform.wsit.classpath=
j2ee.server.type=gfv3ee6
jar.compress=false
jar.name=ClientConsole.jar
javac.classpath=\
${reference.Coffee-Timer-EJB.dist}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javac.test.processorpath=${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=clientconsole.Main
manifest.file=${meta.inf}/MANIFEST.MF
meta.inf=${source.root}/conf
platform.active=default_platform
project.Coffee-Timer-EJB=../Coffee-Timer-EJB
reference.Coffee-Timer-EJB.dist=${project.Coffee-Timer-EJB}/dist/Coffee-Timer-EJB.jar
resource.dir=setup
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.root=src
src.dir=${source.root}/java
test.src.dir=test
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.j2ee.clientproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/car-project/1">
<name>ClientConsole</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<source-roots>
<root id="src.dir" name="Pacotes de código-fonte"/>
</source-roots>
<test-roots>
<root id="test.src.dir" name="Pacotes de testes"/>
</test-roots>
<included-library dirs="100">reference.Coffee-Timer-EJB.dist</included-library>
</data>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
<reference>
<foreign-project>Coffee-Timer-EJB</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>dist</target>
<clean-target>clean</clean-target>
<id>dist</id>
</reference>
</references>
</configuration>
</project>
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<application-client version="6" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application-client_6.xsd">
<display-name>ClientConsole</display-name>
</application-client>
@@ -0,0 +1,25 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package clientconsole;
import java.rmi.RemoteException;
import javax.ejb.EJB;
/**
*
* @author vsenger
*/
public class Main {
/**
* @param args the command line arguments
*/
public static void main(String[] args) throws RemoteException {
// TODO code application logic here
//wakeUpBean.agendarTarefa();
}
}
@@ -0,0 +1,68 @@
<?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.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="CoffeeTimerEJB" default="default" basedir="." xmlns:ejbjarproject="http://www.netbeans.org/ns/j2ee-ejbjarproject/3">
<description>Builds, tests, and runs the project CoffeeTimerEJB.</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-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying
(Targets beginning with '-' are not intended to be called on their own.)
Example of pluging an obfuscator after the compilation could look like
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</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:
init-macrodef-javac: defines macro for javac compilation
init-macrodef-debug: defines macro for class debugging
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.
-->
</project>
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="-deploy-ant" basedir=".">
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
<property file="${deploy.ant.properties.file}" />
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
</target>
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.sun.web}" validate="false">
</xmlproperty>
<delete file="${temp.sun.web}"/>
<property name="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}"/>
<property name="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}"/>
</target>
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
<property name="deploy.context.root.argument" value=""/>
</target>
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
<mkdir dir="${gfv3.resources.dir}"/>
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
<property name="gfv3.resources.file" value="${gfv3.resources.dir}/META-INF/sun-resources.xml"/>
<copy todir="${gfv3.resources.dir}/META-INF">
<fileset dir="${deploy.ant.resource.dir}"/>
</copy>
<jar destfile="${deploy.ant.archive}" update="true">
<fileset dir="${gfv3.resources.dir}"/>
</jar>
<delete dir="${gfv3.resources.dir}"/>
</target>
<target name="-deploy-ant" depends="-parse-sun-web,-no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
<antcall target="-deploy-without-pw"/>
<antcall target="-deploy-with-pw"/>
</target>
<target name="-deploy-without-pw" unless="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-deploy-with-pw" if="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
<antcall target="-undeploy-without-pw"/>
<antcall target="-undeploy-with-pw"/>
</target>
<target name="-undeploy-without-pw" unless="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-with-pw" if="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
</project>
@@ -0,0 +1,764 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM project.xml - DO NOT EDIT ***
*** EDIT ../build.xml INSTEAD ***
For the purpose of easier reading the script
is divided into following sections:
- initialization
- compilation
- dist
- execution
- debugging
- javadoc
- cleanup
-->
<project xmlns:ejbjarproject1="http://www.netbeans.org/ns/j2ee-ejbjarproject/1" xmlns:ejbjarproject2="http://www.netbeans.org/ns/j2ee-ejbjarproject/2" xmlns:ejbjarproject3="http://www.netbeans.org/ns/j2ee-ejbjarproject/3" basedir=".." default="default" name="CoffeeTimerEJB-impl">
<import file="jaxws-build.xml"/>
<import file="ant-deploy.xml"/>
<fail message="Please build using Ant 1.7.1 or higher.">
<condition>
<not>
<antversion atleast="1.7.1"/>
</not>
</condition>
</fail>
<target depends="dist,javadoc" description="Build whole project." name="default"/>
<!--
INITIALIZATION SECTION
-->
<target name="-pre-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init" name="-init-private">
<property file="nbproject/private/private.properties"/>
</target>
<target depends="-pre-init,-init-private" name="-init-userdir">
<property location="${netbeans.user}/build.properties" name="user.properties.file"/>
</target>
<target depends="-pre-init,-init-private,-init-userdir" name="-init-user">
<property file="${user.properties.file}"/>
<!-- The two properties below are usually overridden -->
<!-- by the active platform. Just a fallback. -->
<property name="default.javac.source" value="1.4"/>
<property name="default.javac.target" value="1.4"/>
</target>
<target depends="-pre-init,-init-private,-init-userdir,-init-user" name="-init-project">
<property file="nbproject/project.properties"/>
</target>
<target depends="-pre-init,-init-private,-init-userdir,-init-user,-init-project,-init-macrodef-property" name="-do-init">
<!-- Ensure configuration directory exists. -->
<mkdir dir="${meta.inf}"/>
<property name="runmain.jvmargs" value=""/>
<condition property="have.tests">
<or>
<available file="${test.src.dir}"/>
</or>
</condition>
<condition property="have.sources">
<or>
<available file="${src.dir}"/>
</or>
</condition>
<condition property="netbeans.home+have.tests">
<and>
<isset property="netbeans.home"/>
<isset property="have.tests"/>
</and>
</condition>
<condition property="no.javadoc.preview">
<isfalse value="${javadoc.preview}"/>
</condition>
<available file="${meta.inf}/MANIFEST.MF" property="has.custom.manifest"/>
<!--
Variables needed to support directory deployment.
-->
<condition property="do.package.with.custom.manifest.not.directory.deploy">
<and>
<isset property="has.custom.manifest"/>
<isfalse value="${directory.deployment.supported}"/>
</and>
</condition>
<condition property="do.package.without.custom.manifest.not.directory.deploy">
<and>
<not>
<isset property="has.custom.manifest"/>
</not>
<isfalse value="${directory.deployment.supported}"/>
</and>
</condition>
<!--End Variables needed to support directory deployment.-->
<condition property="classes.dir" value="${build.ear.classes.dir}">
<isset property="dist.ear.dir"/>
</condition>
<property name="classes.dir" value="${build.classes.dir}"/>
<condition property="no.deps">
<and>
<istrue value="${no.dependencies}"/>
</and>
</condition>
<condition property="no.dist.ear.dir">
<not>
<isset property="dist.ear.dir"/>
</not>
</condition>
<property name="source.encoding" value="${file.encoding}"/>
<condition property="javadoc.encoding.used" value="${javadoc.encoding}">
<and>
<isset property="javadoc.encoding"/>
<not>
<equals arg1="${javadoc.encoding}" arg2=""/>
</not>
</and>
</condition>
<property name="javadoc.encoding.used" value="${source.encoding}"/>
<property name="includes" value="**"/>
<property name="excludes" value=""/>
<path id="endorsed.classpath.path" path="${endorsed.classpath}"/>
<condition else="" property="endorsed.classpath.cmd.line.arg" value="-Xbootclasspath/p:'${toString:endorsed.classpath.path}'">
<length length="0" string="${endorsed.classpath}" when="greater"/>
</condition>
</target>
<target depends="init" name="-init-cos" unless="deploy.on.save">
<condition property="deploy.on.save" value="true">
<istrue value="${j2ee.deploy.on.save}"/>
</condition>
</target>
<target name="-post-init">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="-pre-init,-init-private,-init-userdir,-init-user,-init-project,-do-init" name="-init-check">
<fail unless="src.dir">Must set src.dir</fail>
<fail unless="test.src.dir">Must set test.src.dir</fail>
<fail unless="build.dir">Must set build.dir</fail>
<fail unless="build.generated.dir">Must set build.generated.dir</fail>
<fail unless="dist.dir">Must set dist.dir</fail>
<fail unless="build.classes.dir">Must set build.classes.dir</fail>
<fail unless="dist.javadoc.dir">Must set dist.javadoc.dir</fail>
<fail unless="build.classes.excludes">Must set build.classes.excludes</fail>
<fail unless="dist.jar">Must set dist.jar</fail>
<condition property="missing.j2ee.server.home">
<and>
<matches pattern="j2ee.server.home" string="${j2ee.platform.classpath}"/>
<not>
<isset property="j2ee.server.home"/>
</not>
</and>
</condition>
<fail if="missing.j2ee.server.home">
The Java EE server classpath is not correctly set up - server home directory is missing.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Dj2ee.server.home=&lt;app_server_installation_directory&gt;
</fail>
<fail unless="j2ee.platform.classpath">
The Java EE server classpath is not correctly set up. Your active server type is ${j2ee.server.type}.
Either open the project in the IDE and assign the server or setup the server classpath manually.
For example like this:
ant -Duser.properties.file=&lt;path_to_property_file&gt; (where you put the property "j2ee.platform.classpath" in a .properties file)
or ant -Dj2ee.platform.classpath=&lt;server_classpath&gt; (where no properties file is used)
</fail>
</target>
<target name="-init-macrodef-property">
<macrodef name="property" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/1">
<attribute name="name"/>
<attribute name="value"/>
<sequential>
<property name="@{name}" value="${@{value}}"/>
</sequential>
</macrodef>
</target>
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-macrodef-javac-with-processors">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="${empty.dir}" name="gensrcdir"/>
<element name="customize" optional="true"/>
<sequential>
<property name="javac.compilerargs" value=""/>
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<mkdir dir="@{apgeneratedsrcdir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
</dirset>
</src>
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
<compilerarg line="${javac.compilerargs}"/>
<compilerarg value="-processorpath"/>
<compilerarg path="@{processorpath}:${empty.dir}"/>
<compilerarg line="${ap.processors.internal}"/>
<compilerarg value="-s"/>
<compilerarg path="@{apgeneratedsrcdir}"/>
<compilerarg line="${ap.proc.none.internal}"/>
<customize/>
</javac>
</sequential>
</macrodef>
</target>
<target depends="-init-ap-cmdline-properties" name="-init-macrodef-javac-without-processors" unless="ap.supported.internal">
<macrodef name="javac" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<attribute default="${javac.processorpath}" name="processorpath"/>
<attribute default="${build.generated.sources.dir}/ap-source-output" name="apgeneratedsrcdir"/>
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="${javac.debug}" name="debug"/>
<attribute default="${empty.dir}" name="gensrcdir"/>
<element name="customize" optional="true"/>
<sequential>
<property name="javac.compilerargs" value=""/>
<property location="${build.dir}/empty" name="empty.dir"/>
<mkdir dir="${empty.dir}"/>
<javac debug="@{debug}" deprecation="${javac.deprecation}" destdir="@{destdir}" encoding="${source.encoding}" excludes="@{excludes}" includeantruntime="false" includes="@{includes}" source="${javac.source}" srcdir="@{srcdir}" target="${javac.target}">
<src>
<dirset dir="@{gensrcdir}" erroronmissingdir="false">
<include name="*"/>
</dirset>
</src>
<classpath>
<path path="@{classpath}"/>
</classpath>
<compilerarg line="${endorsed.classpath.cmd.line.arg}"/>
<compilerarg line="${javac.compilerargs}"/>
<customize/>
</javac>
</sequential>
</macrodef>
</target>
<target depends="-init-macrodef-javac-with-processors,-init-macrodef-javac-without-processors" name="-init-macrodef-javac">
<macrodef name="depend" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
<attribute default="${src.dir}" name="srcdir"/>
<attribute default="${build.classes.dir}" name="destdir"/>
<attribute default="${javac.classpath}:${j2ee.platform.classpath}" name="classpath"/>
<sequential>
<depend cache="${build.dir}/depcache" destdir="@{destdir}" excludes="${excludes}" includes="${includes}" srcdir="@{srcdir}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</depend>
</sequential>
</macrodef>
<macrodef name="force-recompile" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
<attribute default="${build.classes.dir}" name="destdir"/>
<sequential>
<fail unless="javac.includes">Must set javac.includes</fail>
<pathconvert pathsep="," property="javac.includes.binary">
<path>
<filelist dir="@{destdir}" files="${javac.includes}"/>
</path>
<globmapper from="*.java" to="*.class"/>
</pathconvert>
<delete>
<files includes="${javac.includes.binary}"/>
</delete>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-junit">
<macrodef name="junit" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/2">
<attribute default="${includes}" name="includes"/>
<attribute default="${excludes}" name="excludes"/>
<attribute default="**" name="testincludes"/>
<sequential>
<junit dir="${basedir}" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true" tempdir="${java.io.tmpdir}">
<batchtest todir="${build.test.results.dir}">
<fileset dir="${test.src.dir}" excludes="@{excludes},${excludes}" includes="@{includes}">
<filename name="@{testincludes}"/>
</fileset>
</batchtest>
<classpath>
<path path="${run.test.classpath}"/>
<path path="${j2ee.platform.classpath}"/>
<path path="${j2ee.platform.embeddableejb.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="test-sys-prop."/>
<mapper from="test-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<formatter type="brief" usefile="false"/>
<formatter type="xml"/>
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${runmain.jvmargs}"/>
</junit>
</sequential>
</macrodef>
</target>
<target name="-init-macrodef-java">
<macrodef name="java" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/3">
<attribute default="${main.class}" name="classname"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" fork="true">
<jvmarg line="${endorsed.classpath.cmd.line.arg}"/>
<jvmarg line="${runmain.jvmargs}"/>
<classpath>
<path path="${build.classes.dir}:${javac.classpath}:${j2ee.platform.classpath}"/>
</classpath>
<syspropertyset>
<propertyref prefix="run-sys-prop."/>
<mapper from="run-sys-prop.*" to="*" type="glob"/>
</syspropertyset>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target depends="-init-debug-args" name="-init-macrodef-nbjpda">
<macrodef name="nbjpdastart" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/1">
<attribute default="${main.class}" name="name"/>
<attribute default="${debug.classpath}" name="classpath"/>
<sequential>
<nbjpdastart addressproperty="jpda.address" name="@{name}" transport="${debug-transport}">
<classpath>
<path path="@{classpath}"/>
</classpath>
</nbjpdastart>
</sequential>
</macrodef>
<macrodef name="nbjpdareload" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/1">
<attribute default="${build.classes.dir}" name="dir"/>
<sequential>
<nbjpdareload>
<fileset dir="@{dir}" includes="${fix.classes}">
<include name="${fix.includes}*.class"/>
</fileset>
</nbjpdareload>
</sequential>
</macrodef>
<macrodef name="nbjpdaappreloaded" uri="http://www.netbeans.org/ns/web-project/1">
<sequential>
<nbjpdaappreloaded/>
</sequential>
</macrodef>
</target>
<target name="-init-debug-args">
<property name="version-output" value="java version &quot;${ant.java.version}"/>
<condition property="have-jdk-older-than-1.4">
<or>
<contains string="${version-output}" substring="java version &quot;1.0"/>
<contains string="${version-output}" substring="java version &quot;1.1"/>
<contains string="${version-output}" substring="java version &quot;1.2"/>
<contains string="${version-output}" substring="java version &quot;1.3"/>
</or>
</condition>
<condition else="-Xdebug" property="debug-args-line" value="-Xdebug -Xnoagent -Djava.compiler=none">
<istrue value="${have-jdk-older-than-1.4}"/>
</condition>
<condition else="dt_socket" property="debug-transport-by-os" value="dt_shmem">
<os family="windows"/>
</condition>
<condition else="${debug-transport-by-os}" property="debug-transport" value="${debug.transport}">
<isset property="debug.transport"/>
</condition>
</target>
<target depends="-init-debug-args" name="-init-macrodef-debug">
<macrodef name="debug" uri="http://www.netbeans.org/ns/j2ee-ejbjarproject/1">
<attribute default="${main.class}" name="classname"/>
<attribute default="${debug.classpath}" name="classpath"/>
<attribute default="${application.args}" name="args"/>
<element name="customize" optional="true"/>
<sequential>
<java classname="@{classname}" fork="true">
<jvmarg line="${debug-args-line}"/>
<jvmarg value="-Xrunjdwp:transport=${debug-transport},address=${jpda.address}"/>
<jvmarg line="${runmain.jvmargs}"/>
<classpath>
<path path="@{classpath}"/>
</classpath>
<arg line="@{args}"/>
<customize/>
</java>
</sequential>
</macrodef>
</target>
<target name="-init-taskdefs">
<fail unless="libs.CopyLibs.classpath">
The libs.CopyLibs.classpath property is not set up.
This property must point to
org-netbeans-modules-java-j2seproject-copylibstask.jar file which is part
of NetBeans IDE installation and is usually located at
&lt;netbeans_installation&gt;/java&lt;version&gt;/ant/extra folder.
Either open the project in the IDE and make sure CopyLibs library
exists or setup the property manually. For example like this:
ant -Dlibs.CopyLibs.classpath=a/path/to/org-netbeans-modules-java-j2seproject-copylibstask.jar
</fail>
<taskdef classpath="${libs.CopyLibs.classpath}" resource="org/netbeans/modules/java/j2seproject/copylibstask/antlib.xml"/>
</target>
<target name="-init-ap-cmdline-properties">
<property name="annotation.processing.enabled" value="true"/>
<property name="annotation.processing.processors.list" value=""/>
<property name="annotation.processing.run.all.processors" value="true"/>
<property name="javac.processorpath" value="${javac.classpath}"/>
<property name="javac.test.processorpath" value="${javac.test.classpath}"/>
<condition property="ap.supported.internal" value="true">
<not>
<matches pattern="1\.[0-5](\..*)?" string="${javac.source}"/>
</not>
</condition>
</target>
<target depends="-init-ap-cmdline-properties" if="ap.supported.internal" name="-init-ap-cmdline-supported">
<condition else="" property="ap.processors.internal" value="-processor ${annotation.processing.processors.list}">
<isfalse value="${annotation.processing.run.all.processors}"/>
</condition>
<condition else="" property="ap.proc.none.internal" value="-proc:none">
<isfalse value="${annotation.processing.enabled}"/>
</condition>
</target>
<target depends="-init-ap-cmdline-properties,-init-ap-cmdline-supported" name="-init-ap-cmdline">
<property name="ap.cmd.line.internal" value=""/>
</target>
<target depends="-pre-init,-init-private,-init-userdir,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-java,-init-macrodef-nbjpda,-init-macrodef-debug,-init-taskdefs,-init-ap-cmdline" name="init"/>
<!--
COMPILATION SECTION
-->
<target depends="init" if="no.dist.ear.dir" name="-deps-module-jar" unless="no.deps">
<ant antfile="${project.CoffeeTimerInterface}/build.xml" inheritall="false" target="jar">
<property name="deploy.on.save" value="false"/>
</ant>
</target>
<target depends="init" if="dist.ear.dir" name="-deps-ear-jar" unless="no.deps">
<ant antfile="${project.CoffeeTimerInterface}/build.xml" inheritall="false" target="jar">
<property name="deploy.on.save" value="false"/>
</ant>
</target>
<target depends="init, -deps-module-jar, -deps-ear-jar" name="deps-jar"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<mkdir dir="${build.classes.dir}"/>
<mkdir dir="${build.ear.classes.dir}"/>
</target>
<target name="-pre-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="compile" name="library-inclusion-in-archive">
<copyfiles files="${file.reference.RXTXcomm.jar}" todir="${build.classes.dir}"/>
<copyfiles files="${reference.CoffeeTimerInterface.jar}" todir="${build.classes.dir}"/>
</target>
<target depends="compile" name="library-inclusion-in-manifest">
<copyfiles files="${file.reference.RXTXcomm.jar}" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${reference.CoffeeTimerInterface.jar}" todir="${dist.ear.dir}/lib"/>
<manifest file="${build.ear.classes.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
<target name="-copy-meta-inf">
<copy todir="${classes.dir}">
<fileset dir="${meta.inf}" includes="**/*.dbschema"/>
</copy>
<copy todir="${classes.dir}/META-INF">
<fileset dir="${meta.inf}" excludes="**/*.dbschema **/xml-resources/** ${meta.inf.excludes}"/>
</copy>
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-copy-meta-inf" if="have.sources" name="-do-compile">
<ejbjarproject2:javac destdir="${classes.dir}" gensrcdir="${build.generated.sources.dir}"/>
<copy todir="${classes.dir}">
<fileset dir="${src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile,-do-compile,-post-compile" description="Compile project." name="compile"/>
<target name="-pre-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile" name="-do-compile-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<ejbjarproject2:javac excludes="" gensrcdir="${build.generated.sources.dir}" includes="${javac.includes}"/>
</target>
<target name="-post-compile-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,deps-jar,-pre-pre-compile,-pre-compile-single,-do-compile-single,-post-compile-single" name="compile-single"/>
<!--
DIST BUILDING SECTION
-->
<target name="-pre-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-dist,library-inclusion-in-archive" if="has.custom.manifest" name="-do-dist-with-manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.jar}" manifest="${build.classes.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build.classes.dir}"/>
</jar>
</target>
<target depends="init,compile,-pre-dist,library-inclusion-in-archive" name="-do-dist-without-manifest" unless="has.custom.manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<fileset dir="${build.classes.dir}"/>
</jar>
</target>
<!--
TARGETS NEEDED TO SUPPORT DIRECTORY DEPLOYMENT
-->
<target depends="init,compile,-pre-dist,library-inclusion-in-archive" if="do.package.with.custom.manifest.not.directory.deploy" name="-do-tmp-dist-with-manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.jar}" manifest="${build.classes.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build.classes.dir}"/>
</jar>
</target>
<target depends="init,compile,-pre-dist,library-inclusion-in-archive" if="do.package.without.custom.manifest.not.directory.deploy" name="-do-tmp-dist-without-manifest">
<dirname file="${dist.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.jar}">
<fileset dir="${build.classes.dir}"/>
</jar>
</target>
<target depends="init,compile,-pre-dist,library-inclusion-in-archive, -do-tmp-dist-without-manifest, -do-tmp-dist-with-manifest" name="-do-dist-directory-deploy"/>
<target depends="init,compile,-pre-dist,-do-dist-directory-deploy,-post-dist" description="Build distribution (JAR) - if directory deployment is not supported." name="dist-directory-deploy"/>
<!--
END TARGETS NEEDED TO SUPPORT DIRECTORY DEPLOYMENT
-->
<target depends="init,compile,-pre-dist,library-inclusion-in-archive, -do-dist-without-manifest, -do-dist-with-manifest" name="-do-dist"/>
<target depends="init,compile,-pre-dist,library-inclusion-in-manifest" name="-do-ear-dist">
<dirname file="${dist.ear.jar}" property="dist.jar.dir"/>
<mkdir dir="${dist.jar.dir}"/>
<jar compress="${jar.compress}" jarfile="${dist.ear.jar}" manifest="${build.ear.classes.dir}/META-INF/MANIFEST.MF">
<fileset dir="${build.ear.classes.dir}"/>
</jar>
</target>
<target name="-post-dist">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-dist,-do-dist,-post-dist" description="Build distribution (JAR)." name="dist"/>
<target depends="init,-init-cos,compile,-pre-dist,-do-ear-dist,-post-dist" description="Build distribution (JAR) to be packaged into an EAR." name="dist-ear"/>
<!--
EXECUTION SECTION
-->
<target depends="run-deploy" description="Deploy to server." name="run"/>
<target name="-init-deploy">
<property name="include.jar.manifest" value=""/>
</target>
<target name="pre-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="post-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target name="-pre-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -pre-run-deploy task instead. -->
</target>
<target name="-post-nbmodule-run-deploy">
<!-- Empty placeholder for easier customization. -->
<!-- This target can be overriden by NetBeans modules. Don't override it directly, use -post-run-deploy task instead. -->
</target>
<target name="-run-deploy-am">
<!-- Task to deploy to the Access Manager runtime. -->
</target>
<target depends="init,-init-cos,-init-deploy,compile,library-inclusion-in-archive,dist-directory-deploy,pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,post-run-deploy" name="run-deploy">
<nbjpdaappreloaded/>
</target>
<target if="netbeans.home" name="-run-deploy-nb">
<nbdeploy debugmode="false" forceRedeploy="${forceRedeploy}"/>
</target>
<target name="-init-deploy-ant" unless="netbeans.home">
<property name="deploy.ant.archive" value="${dist.jar}"/>
<property name="deploy.ant.resource.dir" value="${resource.dir}"/>
<property name="deploy.ant.enabled" value="true"/>
</target>
<target depends="dist,-run-undeploy-nb,-init-deploy-ant,-undeploy-ant" name="run-undeploy"/>
<target if="netbeans.home" name="-run-undeploy-nb">
<fail message="Undeploy is not supported from within the IDE"/>
</target>
<target depends="dist" name="verify">
<nbverify file="${dist.jar}"/>
</target>
<target depends="init,compile-single" name="run-main">
<fail unless="run.class">Must select one file in the IDE or set run.class</fail>
<ejbjarproject3:java classname="${run.class}"/>
</target>
<!--
DEBUGGING SECTION
-->
<target depends="init,compile,dist-directory-deploy" description="Debug project in IDE." if="netbeans.home" name="debug">
<nbdeploy debugmode="true"/>
<antcall target="connect-debugger"/>
</target>
<target name="connect-debugger" unless="is.debugged">
<nbjpdaconnect address="${jpda.address}" host="${jpda.host}" name="${name}" transport="${jpda.transport}">
<classpath>
<path path="${debug.classpath}"/>
</classpath>
<sourcepath>
<path path="${web.docbase.dir}"/>
</sourcepath>
</nbjpdaconnect>
</target>
<target depends="init" if="netbeans.home" name="-debug-start-debugger">
<ejbjarproject1:nbjpdastart/>
</target>
<target depends="init,compile-single" if="netbeans.home" name="-debug-start-debuggee-single">
<fail unless="main.class">Must select one file in the IDE or set main.class</fail>
<ejbjarproject1:debug/>
</target>
<target depends="init,compile-single,-debug-start-debugger,-debug-start-debuggee-single" if="netbeans.home" name="debug-single-main"/>
<target depends="init" name="-pre-debug-fix">
<fail unless="fix.includes">Must set fix.includes</fail>
<property name="javac.includes" value="${fix.includes}.java"/>
</target>
<target depends="init,-pre-debug-fix,compile-single" if="netbeans.home" name="-do-debug-fix">
<ejbjarproject1:nbjpdareload/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix" if="netbeans.home" name="debug-fix"/>
<!--
JAVADOC SECTION
-->
<target depends="init" if="have.sources" name="javadoc-build">
<mkdir dir="${dist.javadoc.dir}"/>
<javadoc additionalparam="${javadoc.additionalparam}" author="${javadoc.author}" charset="UTF-8" destdir="${dist.javadoc.dir}" docencoding="UTF-8" encoding="${javadoc.encoding.used}" failonerror="true" noindex="${javadoc.noindex}" nonavbar="${javadoc.nonavbar}" notree="${javadoc.notree}" private="${javadoc.private}" source="${javac.source}" splitindex="${javadoc.splitindex}" use="${javadoc.use}" useexternalfile="true" version="${javadoc.version}" windowtitle="${javadoc.windowtitle}">
<classpath>
<path path="${javac.classpath}:${j2ee.platform.classpath}"/>
</classpath>
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/*.java"/>
</fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/*.java"/>
</fileset>
</javadoc>
<copy todir="${dist.javadoc.dir}">
<fileset dir="${src.dir}" excludes="${excludes}" includes="${includes}">
<filename name="**/doc-files/**"/>
</fileset>
<fileset dir="${build.generated.sources.dir}" erroronmissingdir="false">
<include name="**/doc-files/**"/>
</fileset>
</copy>
</target>
<target depends="init,javadoc-build" if="netbeans.home" name="javadoc-browse" unless="no.javadoc.preview">
<nbbrowse file="${dist.javadoc.dir}/index.html"/>
</target>
<target depends="init,javadoc-build,javadoc-browse" description="Build Javadoc." name="javadoc"/>
<!--
JUNIT COMPILATION SECTION
-->
<target depends="init,compile" if="have.tests" name="-pre-pre-compile-test">
<mkdir dir="${build.test.classes.dir}"/>
<property name="j2ee.platform.embeddableejb.classpath" value=""/>
</target>
<target name="-pre-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test" if="have.tests" name="-do-compile-test">
<ejbjarproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" srcdir="${test.src.dir}"/>
<copy todir="${build.test.classes.dir}">
<fileset dir="${test.src.dir}" excludes="${build.classes.excludes},${excludes}" includes="${includes}"/>
</copy>
</target>
<target name="-post-compile-test">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test,-do-compile-test,-post-compile-test" name="compile-test"/>
<target name="-pre-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single" if="have.tests" name="-do-compile-test-single">
<fail unless="javac.includes">Must select some files in the IDE or set javac.includes</fail>
<ejbjarproject2:javac classpath="${javac.test.classpath}:${j2ee.platform.classpath}:${j2ee.platform.embeddableejb.classpath}" debug="true" destdir="${build.test.classes.dir}" excludes="" includes="${javac.includes}" srcdir="${test.src.dir}"/>
</target>
<target name="-post-compile-test-single">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init,compile,-pre-pre-compile-test,-pre-compile-test-single,-do-compile-test-single,-post-compile-test-single" name="compile-test-single"/>
<!--
JUNIT EXECUTION SECTION
-->
<target depends="init" if="have.tests" name="-pre-test-run">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test,-pre-test-run" if="have.tests" name="-do-test-run">
<ejbjarproject2:junit testincludes="**/*Test.java"/>
</target>
<target depends="init,compile-test,-pre-test-run,-do-test-run" if="have.tests" name="-post-test-run">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init" if="have.tests" name="test-report"/>
<target depends="init" if="netbeans.home+have.tests" name="-test-browse"/>
<target depends="init,compile-test,-pre-test-run,-do-test-run,test-report,-post-test-run,-test-browse" description="Run unit tests." name="test"/>
<target depends="init" if="have.tests" name="-pre-test-run-single">
<mkdir dir="${build.test.results.dir}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single" if="have.tests" name="-do-test-run-single">
<fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
<ejbjarproject2:junit excludes="" includes="${test.includes}"/>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single" if="have.tests" name="-post-test-run-single">
<fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
</target>
<target depends="init,compile-test-single,-pre-test-run-single,-do-test-run-single,-post-test-run-single" description="Run single unit test." name="test-single"/>
<!--
JUNIT DEBUGGING SECTION
-->
<target depends="init,compile-test" if="have.tests" name="-debug-start-debuggee-test">
<fail unless="test.class">Must select one file in the IDE or set test.class</fail>
<property location="${build.test.results.dir}/TEST-${test.class}.xml" name="test.report.file"/>
<delete file="${test.report.file}"/>
<!-- the directory must exist, otherwise the XML formatter would fail -->
<mkdir dir="${build.test.results.dir}"/>
<ejbjarproject1:debug args="${test.class}" classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${ant.home}/lib/ant.jar:${ant.home}/lib/ant-junit.jar:${debug.test.classpath}:${j2ee.platform.embeddableejb.classpath}">
<customize>
<arg value="showoutput=true"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
<arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.report.file}"/>
</customize>
</ejbjarproject1:debug>
</target>
<target depends="init,compile-test" if="netbeans.home+have.tests" name="-debug-start-debugger-test">
<ejbjarproject1:nbjpdastart classpath="${debug.test.classpath}" name="${test.class}"/>
</target>
<target depends="init,compile-test,-debug-start-debugger-test,-debug-start-debuggee-test" name="debug-test"/>
<target depends="init,-pre-debug-fix,compile-test-single" if="netbeans.home" name="-do-debug-fix-test">
<ejbjarproject1:nbjpdareload dir="${build.test.classes.dir}"/>
</target>
<target depends="init,-pre-debug-fix,-do-debug-fix-test" if="netbeans.home" name="debug-fix-test"/>
<!--
CLEANUP SECTION
-->
<target depends="init" if="no.dist.ear.dir" name="deps-clean" unless="no.deps">
<ant antfile="${project.CoffeeTimerInterface}/build.xml" inheritall="false" target="clean"/>
</target>
<target depends="init" name="-do-clean">
<delete dir="${build.dir}"/>
<delete dir="${dist.dir}"/>
</target>
<target name="-post-clean">
<!-- Empty placeholder for easier customization. -->
<!-- You can override this target in the ../build.xml file. -->
</target>
<target depends="init" if="netbeans.home" name="undeploy-clean">
<nbundeploy failOnError="false" startServer="false"/>
</target>
<target depends="init,undeploy-clean,deps-clean,-do-clean,-post-clean" description="Clean build products." name="clean"/>
<target depends="clean" name="clean-ear"/>
</project>
@@ -0,0 +1,9 @@
build.xml.data.CRC32=124b022d
build.xml.script.CRC32=ffa052f7
build.xml.stylesheet.CRC32=5910fda3@1.22.2
# 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.
nbproject/build-impl.xml.data.CRC32=124b022d
nbproject/build-impl.xml.script.CRC32=8d3f4e00
nbproject/build-impl.xml.stylesheet.CRC32=33606734@1.22.2
nbproject/jaxws-build.xml.stylesheet.CRC32=c57740bd
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<jax-ws xmlns="http://www.netbeans.org/ns/jax-ws/1">
<services>
<service name="CoffeeSchedullerWS">
<implementation-class>br.com.eletronlivre.cofffeetimer.ws.CoffeeSchedullerWS</implementation-class>
</service>
</services>
<clients/>
</jax-ws>
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
*** GENERATED FROM jax-ws.xml - DO NOT EDIT ! ***
*** TO MODIFY wsimport options USE Web Service node -> Edit WS Attributes ***
*** TO CHANGE TARGETS GENERATED TO jaxws-build.xml COPY THOSE ***
*** TARGETS TO ../build.xml AND MODIFY THAT FILE INSTEAD ***
-->
<project xmlns:xalan="http://xml.apache.org/xslt" xmlns:ejbjarproject2="http://www.netbeans.org/ns/j2ee-ejbjarproject/2" xmlns:jaxws="http://www.netbeans.org/ns/jax-ws/1">
<!--
===================
JAX-WS WSGEN SECTION
===================
-->
<target name="wsgen-init" depends="init">
<mkdir dir="${build.generated.sources.dir}/jax-ws/resources/"/>
<taskdef name="wsgen" classname="com.sun.tools.ws.ant.WsGen">
<classpath path="${j2ee.platform.wsgen.classpath}"/>
</taskdef>
</target>
<target name="wsgen-compile" depends="wsgen-CoffeeSchedullerWS">
<ejbjarproject2:javac srcdir="${build.generated.sources.dir}/jax-ws" classpath="${j2ee.platform.wsgen.classpath}:${javac.classpath}" destdir="${classes.dir}"/>
</target>
<target name="wsgen-CoffeeSchedullerWS" depends="wsgen-init, -do-compile">
<wsgen destdir="${build.generated.sources.dir}/jax-ws" sourcedestdir="${build.generated.sources.dir}/jax-ws" resourcedestdir="${build.generated.sources.dir}/jax-ws/resources/" verbose="true" xendorsed="true" keep="false" genwsdl="true" sei="br.com.eletronlivre.cofffeetimer.ws.CoffeeSchedullerWS">
<classpath path="${java.home}/../lib/tools.jar:${classes.dir}:${j2ee.platform.wsgen.classpath}:${javac.classpath}"/>
</wsgen>
</target>
<!--
===================
JAX-WS WSIMPORT SECTION
===================
-->
</project>
@@ -0,0 +1,7 @@
deploy.ant.properties.file=/home/vsenger/.netbeans/6.9/gfv3-1780747739.properties
j2ee.platform.is.jsr109=true
j2ee.server.home=/java/nb7-glassfish-3.1.1/glassfish
j2ee.server.instance=[/java/nb7-glassfish-3.1.1/glassfish]deployer:gfv3ee6:localhost:4848
javac.debug=true
javadoc.preview=true
netbeans.user=/home/vsenger/.netbeans/6.9
@@ -0,0 +1,9 @@
<?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"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/1">
<file>file:/media/Vinicius/EletronLivre/Program-ME/Arduino%20Sketches/CoffeTimer/Coffee-Timer-EJB/src/java/br/com/eletronlivre/cofffeetimer/arduino/ArduinoBoard.java</file>
<file>file:/media/Vinicius/EletronLivre/Program-ME/Arduino%20Sketches/CoffeTimer/Coffee-Timer-EJB/src/java/br/com/eletronlivre/cofffeetimer/WakeUpScheduler.java</file>
<file>file:/media/Vinicius/EletronLivre/Program-ME/Arduino%20Sketches/CoffeTimer/Coffee-Timer-EJB/src/java/br/com/eletronlivre/cofffeetimer/TurnOnBean.java</file>
</open-files>
</project-private>
@@ -0,0 +1,80 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=true
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form,**/.nbattrs
build.dir=build
build.ear.classes.dir=${build.dir}/classes
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
debug.classpath=${javac.classpath}:${build.classes.dir}
debug.test.classpath=\
${run.test.classpath}
dist.dir=dist
dist.ear.jar=${dist.dir}/${jar.name}
dist.jar=${dist.dir}/${jar.name}
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=\
${libs.javaee-endorsed-api-6.0.classpath}
excludes=
file.reference.RXTXcomm.jar=../../../../../../../usr/share/java/RXTXcomm.jar
includes=**
j2ee.compile.on.save=false
j2ee.deploy.on.save=false
j2ee.platform=1.6
j2ee.platform.classpath=${j2ee.server.home}/modules/javax.security.jacc.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.jms.jar:${j2ee.server.home}/modules/jstl-impl.jar:${j2ee.server.home}/modules/javax.management.j2ee.jar:${j2ee.server.home}/modules/javax.transaction.jar:${j2ee.server.home}/modules/endorsed/javax.annotation.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.ejb.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.home}/modules/jsf-impl.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/jsf-api.jar:${j2ee.server.home}/modules/javax.servlet.jar:${j2ee.server.home}/modules/javax.enterprise.deploy.jar:${j2ee.server.home}/modules/jaxrpc-api-osgi.jar:${j2ee.server.home}/modules/javax.resource.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/jaxr-api-osgi.jar:${j2ee.server.home}/modules/javax.security.auth.message.jar
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/javax.ejb.jar
j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/javax.ejb.jar
j2ee.platform.wsit.classpath=
j2ee.server.type=gfv3ee6
jar.compress=false
jar.name=CoffeeTimerEJB.jar
javac.classpath=\
${file.reference.RXTXcomm.jar}:\
${reference.CoffeeTimerInterface.jar}
javac.debug=true
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.6
javac.target=1.6
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javac.test.processorpath=${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.preview=true
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
meta.inf=${source.root}/conf
meta.inf.excludes=sun-cmp-mappings.xml
platform.active=default_platform
project.CoffeeTimerInterface=../CoffeeTimerInterface
reference.CoffeeTimerInterface.jar=${project.CoffeeTimerInterface}/dist/CoffeeTimerInterface.jar
resource.dir=setup
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
# Space-separated list of JVM arguments used when running a class with a main method or a unit test
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value):
runmain.jvmargs=-Dgnu.io.rxtx.SerialPorts=/dev/rfcomm1
source.encoding=UTF-8
source.root=src
src.dir=${source.root}/java
test.src.dir=test
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.j2ee.ejbjarproject</type>
<configuration>
<buildExtensions xmlns="http://www.netbeans.org/ns/ant-build-extender/1">
<extension file="jaxws-build.xml" id="jaxws"/>
</buildExtensions>
<data xmlns="http://www.netbeans.org/ns/j2ee-ejbjarproject/3">
<name>CoffeeTimerEJB</name>
<minimum-ant-version>1.6.5</minimum-ant-version>
<included-library dirs="200">file.reference.RXTXcomm.jar</included-library>
<included-library dirs="200">reference.CoffeeTimerInterface.jar</included-library>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
<references xmlns="http://www.netbeans.org/ns/ant-project-references/1">
<reference>
<foreign-project>CoffeeTimerInterface</foreign-project>
<artifact-type>jar</artifact-type>
<script>build.xml</script>
<target>jar</target>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
</references>
</configuration>
</project>
@@ -0,0 +1,48 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.eletronlivre.cofffeetimer;
import br.com.eletronlivre.cofffeetimer.arduino.ArduinoBoard;
import br.com.globalcode.eletronlivre.arduino.serial.Arduino;
import javax.ejb.Timer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Resource;
import javax.ejb.EJB;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.TimerService;
/**
*
* @author vsenger
*/
@Stateless
public class TurnOffBean {
@EJB
ArduinoBoard board;
@Resource
TimerService timerService;
@Resource
SessionContext ctx;
public void agendarTarefa(long tempo) {
TimerService agendador = ctx.getTimerService();
agendador.createTimer(tempo,null);
}
@Timeout
private void wakeUp(Timer timer) {
System.out.println("Vamos desligar!");
try {
//Arduino.enviar("A-B");
board.enviar("A-B");
} catch (Exception ex) {
Logger.getLogger(TurnOffBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
@@ -0,0 +1,62 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.eletronlivre.cofffeetimer;
import br.com.eletronlivre.cofffeetimer.arduino.ArduinoBoard;
import br.com.globalcode.eletronlivre.arduino.serial.Arduino;
import javax.ejb.EJB;
import javax.ejb.Timer;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.annotation.Resource;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.ejb.Timeout;
import javax.ejb.TimerService;
/**
*
* @author vsenger
*/
@Stateless
public class TurnOnBean implements WakeUpScheduler {
@EJB
private TurnOffBean turnOffBean;
@EJB
private ArduinoBoard board;
public TurnOnBean() {
}
@Resource
TimerService timerService;
@Resource
SessionContext ctx;
@Override
public void agendarTarefa(long emQuantoTempo, long porQuantoTempo) {
System.out.println("Serviço agendado!");
System.out.println("Ligando em " + emQuantoTempo + " por " + porQuantoTempo + " segundos");
TimerService agendador = ctx.getTimerService();
board.testando();
agendador.createTimer(emQuantoTempo, null);
turnOffBean.agendarTarefa(porQuantoTempo + emQuantoTempo);
}
@Timeout
public void wakeUp(Timer timer) {
System.out.println("Vamos ligarrr!");
try {
//Arduino.enviar("A+B");
board.enviar("A+B");
} catch (Exception ex) {
Logger.getLogger(TurnOnBean.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
@@ -0,0 +1,20 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.eletronlivre.cofffeetimer;
import java.rmi.RemoteException;
import javax.ejb.Remote;
/**
*
* @author vsenger
*/
@Remote
public interface WakeUpScheduler {
void agendarTarefa(long time, long tt) throws RemoteException;
}
@@ -0,0 +1,103 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.eletronlivre.cofffeetimer.arduino;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.UnsupportedCommOperationException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import javax.annotation.PostConstruct;
import javax.ejb.Singleton;
import javax.ejb.LocalBean;
/**
*
* @author vsenger
*/
@Singleton
@LocalBean
public class ArduinoBoard {
Enumeration portList;
CommPortIdentifier portId;
String messageString = "10";
SerialPort serialPort;
OutputStream outputStream;
InputStream inputStream;
boolean outputBufferEmptyFlag = false;
String defaultPort = "/dev/rfcomm1";
int x = 0;
public SerialPort getSerialPort() {
return serialPort;
}
public void setSerialPort(SerialPort serialPort) {
this.serialPort = serialPort;
}
public void testando() {
System.out.println("x++" + x++);
}
public void delay(long milis) {
try {
Thread.sleep(milis);
} catch (InterruptedException ex) {
}
}
@PostConstruct
public void init() {
portList = CommPortIdentifier.getPortIdentifiers();
System.out.println("Iniciando");
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
System.out.println(portId.getName());
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals(defaultPort)) {
System.out.println("Found port " + defaultPort);
try {
serialPort =
(SerialPort) portId.open("SimpleWriteCOM17", 115200);
} catch (Exception e) {
System.out.println("Port in use.");
continue;
}
try {
outputStream = serialPort.getOutputStream();
inputStream = serialPort.getInputStream();
serialPort.setSerialPortParams(115200,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
serialPort.notifyOnOutputEmpty(true);
} catch (UnsupportedCommOperationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
System.out.println("Error setting event notification");
System.out.println(e.toString());
}
}
}
}
}
public void enviar(String s) throws Exception {
outputStream.write(s.getBytes());
outputStream.flush();
}
}
@@ -0,0 +1,31 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.eletronlivre.cofffeetimer.ws;
import br.com.eletronlivre.cofffeetimer.WakeUpScheduler;
import java.rmi.RemoteException;
import javax.ejb.EJB;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import javax.ejb.Stateless;
/**
*
* @author vsenger
*/
@WebService()
@Stateless()
public class CoffeeSchedullerWS {
@EJB
private WakeUpScheduler ejbRef;// Add business logic below. (Right-click in editor and choose
// "Insert Code > Add Web Service Operation")
@WebMethod(operationName = "agendarTarefa")
public void agendarTarefa(@WebParam(name = "time") long time, @WebParam(name = "tt") long tt) throws RemoteException {
ejbRef.agendarTarefa(time, tt);
}
}
@@ -0,0 +1,144 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.globalcode.eletronlivre.arduino.serial;
import gnu.io.CommPortIdentifier;
import gnu.io.SerialPort;
import gnu.io.UnsupportedCommOperationException;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Enumeration;
import java.util.logging.Level;
import java.util.logging.Logger;
/**
*
* @author vsenger
*/
public class Arduino {
static boolean init = false;
static Enumeration portList;
static CommPortIdentifier portId;
static String messageString = "10";
static SerialPort serialPort;
static OutputStream outputStream;
static InputStream inputStream;
static boolean outputBufferEmptyFlag = false;
static String defaultPort = "/dev/rfcomm0";
//static String defaultPort = "/dev/tty.usbserial-A6007W3X";
//static String defaultPort = "/dev/ttyUSB0";
public static void begin(int bps) {
if (!init) {
init();
}
}
public static void delay(long milis) {
try {
Thread.sleep(milis);
} catch (InterruptedException ex) {
}
}
public static void init() {
init = true;
portList = CommPortIdentifier.getPortIdentifiers();
System.out.println("Iniciando");
while (portList.hasMoreElements()) {
portId = (CommPortIdentifier) portList.nextElement();
System.out.println(portId.getName());
if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL) {
if (portId.getName().equals(defaultPort)) {
System.out.println("Found port " + defaultPort);
try {
serialPort =
(SerialPort) portId.open("SimpleWriteCOM17", 115200);
} catch (Exception e) {
System.out.println("Port in use.");
continue;
}
try {
outputStream = serialPort.getOutputStream();
inputStream = serialPort.getInputStream();
serialPort.setSerialPortParams(115200,
SerialPort.DATABITS_8,
SerialPort.STOPBITS_1,
SerialPort.PARITY_NONE);
serialPort.notifyOnOutputEmpty(true);
} catch (UnsupportedCommOperationException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (Exception e) {
System.out.println("Error setting event notification");
System.out.println(e.toString());
}
}
}
}
}
public static void enviar(String s) throws Exception {
if (!init) {
init();
}
outputStream.write(s.getBytes());
outputStream.flush();
}
public static void enviar(float f) throws Exception {
enviar(new byte[]{(byte) f});
}
//100, 1, 1024, 1, 9
public static int map(int val, int minOriginal, int maxOriginal, int minTarget, int maxTarget) {
return val / ((maxOriginal - minOriginal) / (maxTarget - minTarget));
}
public static void main(String[] args) throws Exception{
enviar("L");
}
public static void enviar(byte bytes[]) throws Exception {
if (!init) {
init();
}
System.out.println("Escrevendo...");
outputStream.write((int)'B'); //my I2C ID
System.out.println(bytes[0]);
outputStream.write(bytes[0] ==0 ? 10 : bytes[0] );
outputStream.flush();
System.out.println("Esperando...");
}
class BluetoothListener extends Thread {
public void run() {
while(true) {
try {
if (inputStream.available() > 0) {
while(inputStream.available()>0) {
System.out.print(inputStream.read());
}
}
} catch (IOException ex) {
Logger.getLogger(Arduino.class.getName()).log(Level.SEVERE, null, ex);
}
Arduino.delay(50);
}
}
}
}
@@ -0,0 +1,74 @@
<?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.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="CoffeeTimerInterface" default="default" basedir=".">
<description>Builds, tests, and runs the project CoffeeTimerInterface.</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-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="CoffeeTimerInterface-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
@@ -0,0 +1,3 @@
#Wed, 28 Sep 2011 12:13:11 -0300
/media/Vinicius/EletronLivre/Program-ME/Arduino\ Sketches/CoffeTimer/CoffeeTimerInterface=
@@ -0,0 +1,33 @@
========================
BUILD OUTPUT DESCRIPTION
========================
When you build an Java application project that has a main class, the IDE
automatically copies all of the JAR
files on the projects classpath to your projects dist/lib folder. The IDE
also adds each of the JAR files to the Class-Path element in the application
JAR files manifest file (MANIFEST.MF).
To run the project from the command line, go to the dist folder and
type the following:
java -jar "CoffeeTimerInterface.jar"
To distribute this project, zip up the dist folder (including the lib folder)
and distribute the ZIP file.
Notes:
* If two JAR files on the project classpath have the same name, only the first
JAR file is copied to the lib folder.
* Only JAR files are copied to the lib folder.
If the classpath contains other types of files or folders, none of the
classpath elements are copied to the lib folder. In such a case,
you need to copy the classpath elements to the lib folder manually after the build.
* If a library on the projects classpath also has a Class-Path element
specified in the manifest,the content of the Class-Path element has to be on
the projects runtime path.
* To set a main class in a standard Java project, right-click the project node
in the Projects window and choose Properties. Then click Run and enter the
class name in the Main Class field. Alternatively, you can manually type the
class name in the manifest Main-Class element.
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
@@ -0,0 +1,8 @@
build.xml.data.CRC32=68706b55
build.xml.script.CRC32=edf4fd04
build.xml.stylesheet.CRC32=28e38971@1.38.2.45
# 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.
nbproject/build-impl.xml.data.CRC32=68706b55
nbproject/build-impl.xml.script.CRC32=20404a75
nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45
@@ -0,0 +1,6 @@
compile.on.save=true
do.depend=false
do.jar=true
javac.debug=true
javadoc.preview=true
user.properties.file=/home/vsenger/.netbeans/6.9/build.properties
@@ -0,0 +1,75 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
application.title=CoffeeTimerInterface
application.vendor=vsenger
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.test.classpath=\
${run.test.classpath}
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/CoffeeTimerInterface.jar
dist.javadoc.dir=${dist.dir}/javadoc
endorsed.classpath=
excludes=
includes=**
jar.compress=false
javac.classpath=\
${libs.javaee-api-6.0.classpath}
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.processorpath=\
${javac.classpath}
javac.source=1.5
javac.target=1.5
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}:\
${libs.junit.classpath}:\
${libs.junit_4.classpath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
main.class=coffeetimerinterface.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
run.jvmargs=
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.java.j2seproject</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/j2se-project/3">
<name>CoffeeTimerInterface</name>
<source-roots>
<root id="src.dir"/>
</source-roots>
<test-roots>
<root id="test.src.dir"/>
</test-roots>
</data>
</configuration>
</project>
@@ -0,0 +1,21 @@
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package br.com.eletronlivre.cofffeetimer;
import java.rmi.RemoteException;
import javax.ejb.Remote;
/**
*
* @author vsenger
*/
@Remote
public interface WakeUpScheduler {
void agendarTarefa() throws RemoteException;
void agendarTarefa(long time, long tt) throws RemoteException;
}
@@ -0,0 +1,71 @@
<?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.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="CoffeeWebScheduler" default="default" basedir=".">
<description>Builds, tests, and runs the project CoffeeWebScheduler.</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-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-dist: called before archive building
-post-dist: called after archive building
-post-clean: called after cleaning build products
-pre-run-deploy: called before deploying
-post-run-deploy: called after deploying
Example of pluging an obfuscator after the compilation could look like
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</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:
init-macrodef-javac: defines macro for javac compilation
init-macrodef-junit: defines macro for junit execution
init-macrodef-debug: defines macro for class debugging
do-dist: archive building
run: execution of project
javadoc-build: javadoc generation
Example of overriding the target for project execution could look like
<target name="run" depends="<PROJNAME>-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that overridden target depends on jar target and not only on
compile target as regular run target does. Again, for list of available
properties which you can use check the target you are overriding in
nbproject/build-impl.xml file.
-->
</project>
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Servlet 3.0//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_3_0-0.dtd">
<sun-web-app error-url="">
<context-root>/CoffeeWebScheduler</context-root>
<class-loader delegate="true"/>
<jsp-config>
<property name="keepgenerated" value="true">
<description>Keep a copy of the generated servlet class' java code.</description>
</property>
</jsp-config>
</sun-web-app>
Arquivo binário não exibido.

Depois

Largura:  |  Altura:  |  Tamanho: 5.1 KiB

@@ -0,0 +1,34 @@
<%@page import="java.util.Date"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Cafeteira na Web</title>
</head>
<body>
<h1>Vida além do Java...</h1>
<hr/>
<img src="duke.gif" align="left"/>
<h2>Agendar por tempo</h2>
<form action="Agendador" method="GET">
<input type="radio" name="tipoValor" value="1" checked/> Segundos
<input type="radio" name="tipoValor" value="2"/> Minutos
<br/>
Em quanto tempo que ligar a cafeteira ? <input type="text" name="txtEmQuantoTempo"/><br/>
Por quanto tempo quer ligar a cafeteira ? <input type="text" name="txtPorQuantoTempo"/><br/>
<input type="submit" />
</form>
<%
if (request.getAttribute("horarioAgendado") != null) {
Date horario = (Date) request.getAttribute("horarioAgendado");
out.println("<p>Café agendado para ");
out.println(horario);
out.println("</p>");
}
%>
</body>
</html>
@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="-deploy-ant" basedir=".">
<target name="-init-cl-deployment-env" if="deploy.ant.enabled">
<property file="${deploy.ant.properties.file}" />
<available file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" property="sun.web.present"/>
<available file="${deploy.ant.resource.dir}" property="has.setup"/>
<tempfile prefix="gfv3" property="gfv3.password.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<echo message="AS_ADMIN_PASSWORD=${gfv3.password}" file="${gfv3.password.file}"/>
</target>
<target name="-parse-sun-web" depends="-init-cl-deployment-env" if="sun.web.present">
<tempfile prefix="gfv3" property="temp.sun.web" destdir="${java.io.tmpdir}"/>
<copy file="${deploy.ant.docbase.dir}/WEB-INF/sun-web.xml" tofile="${temp.sun.web}"/>
<!-- The doctype triggers resolution which can fail -->
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<!DOCTYPE]]></replacetoken>
<replacevalue><![CDATA[<!-- <!DOCTYPE]]></replacevalue>
</replace>
<replace file="${temp.sun.web}">
<replacetoken><![CDATA[<sun-web-app]]></replacetoken>
<replacevalue><![CDATA[--> <sun-web-app]]></replacevalue>
</replace>
<xmlproperty file="${temp.sun.web}" validate="false">
</xmlproperty>
<delete file="${temp.sun.web}"/>
<property name="deploy.ant.client.url" value="${gfv3.url}${sun-web-app.context-root}"/>
<property name="deploy.context.root.argument" value="&amp;contextroot=${sun-web-app.context-root}"/>
</target>
<target name="-no-parse-sun-web" depends="-init-cl-deployment-env" unless="sun.web.present">
<property name="deploy.context.root.argument" value=""/>
</target>
<target name="-add-resources" depends="-init-cl-deployment-env" if="has.setup">
<tempfile prefix="gfv3" property="gfv3.resources.dir" destdir="${java.io.tmpdir}"/>
<mkdir dir="${gfv3.resources.dir}"/>
<mkdir dir="${gfv3.resources.dir}/META-INF"/>
<property name="gfv3.resources.file" value="${gfv3.resources.dir}/META-INF/sun-resources.xml"/>
<copy todir="${gfv3.resources.dir}/META-INF">
<fileset dir="${deploy.ant.resource.dir}"/>
</copy>
<jar destfile="${deploy.ant.archive}" update="true">
<fileset dir="${gfv3.resources.dir}"/>
</jar>
<delete dir="${gfv3.resources.dir}"/>
</target>
<target name="-deploy-ant" depends="-parse-sun-web,-no-parse-sun-web,-add-resources" if="deploy.ant.enabled">
<antcall target="-deploy-without-pw"/>
<antcall target="-deploy-with-pw"/>
</target>
<target name="-deploy-without-pw" unless="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-deploy-with-pw" if="gfv3.password">
<echo message="Deploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<property name="full.deploy.ant.archive" location="${deploy.ant.archive}"/>
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/deploy?path=${full.deploy.ant.archive}${deploy.context.root.argument}&amp;force=true&amp;name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-ant" depends="-init-cl-deployment-env" if="deploy.ant.enabled">
<antcall target="-undeploy-without-pw"/>
<antcall target="-undeploy-with-pw"/>
</target>
<target name="-undeploy-without-pw" unless="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
<target name="-undeploy-with-pw" if="gfv3.password">
<echo message="Undeploying ${deploy.ant.archive}"/>
<tempfile prefix="gfv3" property="gfv3.results.file" destdir="${java.io.tmpdir}"/> <!-- do not forget to delete this! -->
<get username="${gfv3.username}" password="${gfv3.password}" src="${gfv3.admin.url}/__asadmin/undeploy?name=${ant.project.name}"
dest="${gfv3.results.file}"/>
<delete file="${gfv3.results.file}"/>
</target>
</project>
@@ -0,0 +1,8 @@
build.xml.data.CRC32=8dde883d
build.xml.script.CRC32=1f0e6d58
build.xml.stylesheet.CRC32=651128d4@1.33.1.1
# 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.
nbproject/build-impl.xml.data.CRC32=8dde883d
nbproject/build-impl.xml.script.CRC32=66c6dde0
nbproject/build-impl.xml.stylesheet.CRC32=0cbf5bb7@1.33.1.1
@@ -0,0 +1,7 @@
deploy.ant.properties.file=/home/vsenger/.netbeans/6.9/gfv3-1780747739.properties
j2ee.platform.is.jsr109=true
j2ee.server.home=/java/nb7-glassfish-3.1.1/glassfish
j2ee.server.instance=[/java/nb7-glassfish-3.1.1/glassfish]deployer:gfv3ee6:localhost:4848
javac.debug=true
javadoc.preview=true
user.properties.file=/home/vsenger/.netbeans/6.9/build.properties

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais