Logbooks for SmartHome project 1.1 David`s logbook
Transcription
Logbooks for SmartHome project 1.1 David`s logbook
SmartHome project Appendix A2: Logbooks Diploma work Logbooks for SmartHome project This document contains the logbooks for SmartHome project and is separated in 3 sections: • • • David's logbook Daniel's logbook Mailing and researches about Bluetooth connection problems 1.1 David's logbook Goal of the logbook: This page has to goal to show to the professors the evolution of the work done during the project. I will write all the work done, the encountered problems and what I want to do to resolve the problems. Monday 26 September: • This is the first day of the project. • Have a short tour of the College of Computer Sciences. (1h) • Administration (create pass, create an account for the CCS network) (3h) • Take my place installation of my PC (install Windows and the software I need) (2h) • Have a look on the already realized smarthome architecture (2h) Tuesday 27 September: • Meeting with the ISSI scholar agent to complete the administrative documents (for immigration and university administration) (2h). • Pr. Noubir's demonstration about the smarthome architecture. (0.5h) • Discussion with Pr. Noubir about the objectives of project (1h) • See in detail the code already realized at Northeastern (4.5h) Wednesday 28 September: • Write the website of the project (3h) • Write the logbook and differents documents (0.5h) • Install and Configure J2ME and plug-in for Eclipse (2h) • Read information about Polish (a graphical tool for J2ME) (1h) • Install Cygwin/X to can work with emacs (0.5h) • Running all the architecture and made different test to understand how works the system. Thursday 29 September: • Try to connect to the HCS with Bluetooth (4h) o I had problem to compile the BTServer because I tried first to compile it on my own computer. But I learnt need to compile it on a Linux machine with the Rococo library installed on it and I had to be logged as root. This problem has been resolved Daniel GALLEY, David GABRIEL page 1 of 38 SmartHome project Appendix A2: Logbooks Diploma work Another problem is that I cannot arrive to connect to BTServer with the J2ME emulator. I'have to try if it works with a real Cell phone. Discussion with Daniel to prepare the meeting with Mr. Wagen and Mr. Noubir and discuss about the objectives of the project and how to arrive to do them. We also discuss about how to plan the project (1.5h) Read J2ME Bluetooth tutorials (3h) o • • Friday 30 September: • Meeting With Mr. Wagen, we discuss about : (0.5h) o Damien Vionnet can help us for the Bluetooth part of the project o I have a problem to use the Bluetooth part of the architecture. I can find the Bluetooth server with the cell device. o Security: not very strong, but we have to implement a password system to prevent hacking with for example a shared password system. o We have to write the objectives of the project and not plan exactly but find the different steps • Study the Bluetooth part of the smarthome project (BTServer.java and Client Bluetooth part) (4h) • Begin to write the objectives of the project (1.5h) • Try to connect to the existing smarthome architecture with Bluetooth with a real mobile phone. (3h) o I cannot connect to the BTServer. Nothing appends. o I think that there is a conflict with another application using the same number of service (url) I will try to change this number on Monday o I sent an email to Mr Amit Gupta (He has developed the Bluetooth part of smarthome) to ask him what can be the source of the problem. I also ask him documentation about the complete architecture. Here's the answer of Amit: Hi David, Somehow I lost your message after trying to reply to it. But from what I remember, the error you see on the screen should not affect the service provided by BTServer. The only reason you see that message is because you are not running the service as root. Prof. Noubir saw the same message and thought that to access bluetooth hardware, one needs to be root on the machine. Althoguh I had run the service successfully with that error message, I would su first before running the service. There is no conflict of services on roma if you are running just the BTServer and not Freevo service too. -Amit Daniel GALLEY, David GABRIEL page 2 of 38 SmartHome project Appendix A2: Logbooks Diploma work Monday 3 October: • • Resolve the problems with Bluetooth. There was different problems why I did not arrive to connect to BTServer application on Roma with the Cell phone application: o There was a conflict between the Freevo application (another project at Northeastern that use Bluetooth with the same UUID) and the BTServer application. UUID is an identification that permits to the client device to find the service it is searching. (0.5h) o The destination port for the HCS application was wrong. It is 22 and should be 4002. Guevara told me that was why they have made tests and they forgot to change the number of the port in the code. (1h) o There was also a conflict between the connection manager (PC Suite) I use to download my application from my notebook to the phone and the BTServer application. I think that comes because that PCSuite connects automatically to my phone and I can't use Bluetooth for another application. (6h!) Now I arrive to make working the complete SmartHome system as well with Bluetooth as GPRS. The only problem I have is when I change the UUID on my BTServer application I cannot find the application on my cell phone. I will send an email to Damien Vionnet. Mail of Damien Vionnet: Salut David, J'espère que vous vous amusez bien à Boston. >>Salut Damien ! >> >>Comment ca va ? >> >>Tu le sais sûrement déjà, je suis à Boston en train de réaliser mon >>projet de diplôme (la suite du projet de semestre Wish). >> >>J'ai un petit problème et peut-être que tu pourras m'aider : >> >>J'essaye de comprendre un bout de code qui permet de se connecter à >>Server via Bluetooth. Le programme fonctionne très bien, mais le >>problème est qu'une autre application d'un autre projet utilise le même >>UUID, ce qui crée des conflits entre les applications. J'ai essayé de >>changer l'UUID de mon application côté client et serveur. Mais là le >>client ne détecte pas le service offert pas le server. Daniel GALLEY, David GABRIEL page 3 of 38 SmartHome project Appendix A2: Logbooks Diploma work >>Je crois que je n'ai pas bien compris comment on attribue les UUID et le >>fonctionnement de la méthode : >>searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, >>DiscoveryListener discListiner) >> >>A quoi correspondent les tableaux attrSet et uuidSet ? Quelles sont leur >>rapport avec l'UUID recherché ? >> >>As-tu de la doc à ce sujet ? En annexe je t'ai mis un powerpoint expliquant les principes de la recherche de services. attrSet --> chaque services a différents attributs, par défaut, une recherche de service donne seulement les 3 trois principaux attributs du service (je sais plus lesquel). AttrSet est un tableau qui contient les id des autres attributs que l'on désire pour un service. http://www.avetana-gmbh.de/avetana-gmbh/produkte/doc/javax/bluetooth/Service Record.html uuidSet --> chaque services bluetooth est identifié par un uuid. De plus la pile de protocole qu'utilise un service (Cnnexion RFCOMM : L2CAP-->RFCOMM) est aussi définit à l'aide d'uuid. Ce tableau définit les uuid pour lesquels nous devons recherche des services. Prenons un exemple: Deux services : servcie A RFCOMM et service B L2CAP 1) Recherche avec uuidSet contenant 0x0100(L2CAP) --> retourne A et B 2) Recherche avec uuidSet contenant 0x0008(RFCOMM) --> retourne A http://www.avetana-gmbh.de/avetana-gmbh/produkte/doc/javax/bluetooth/UUID.ht ml >>Une autre question : >> >>Lorsque que tu programmes des applications Bluetooth sur PC. Quelles >>librairies utilises-tu ? Ici ils utilisent Rococo, mais ça ne fonctionne >>que sur Linux. As-tu déjà utilisé Rococo ? Où existe-t-il une autre >>librairie qui fonctionne avec Windows? J'utilise la librairie d'avetana, mais voici un site où se trouvent plusieurs implémentations de JSR-82 www.javabluetooth.org. Attention pour Windows il y a principalement 2 types de stack (Windcom et Microsoft) à voir si les implémentations sont compatibles avec votre stack. Si je n'ai pas été clair, vous pouvez me recontacter, A+ Damien • We had a meeting with Guevara Noubir to ask him about the next steps of the project. (3/4h) You can see the content of the meeting in the minutes of the 3. October Tuesday 4 October: • With the explanation of Damien, I arrive to change the UUID. I changed the UUID on the client and the server side, and I remove all the attribute I do not need (2h) : Daniel GALLEY, David GABRIEL page 4 of 38 SmartHome project o Appendix A2: Logbooks Diploma work Client side (Discovery Impl.java) : Change from 1 to 2 int[] attr = new int[]{0x0000, 0x0001}; … if (uuidname.equals("102030405060708090A2B1C1D1D1E100")) { // Wow!! the service is found midlet.displayFullTransfer(); } o Server side (BTServer.java) : String url = "btspp://localhost:112030405060708090A2B1C1D1D1E100"; Here are the tests I do to be sure that there are no confict between freevoBTServer application and BTServer. Note: FreevoBTServer is the other application that is in conflict with the SmartHome Bluetooth application. 1. Run BTServer and try to find the service with SmartHomeCell application. OK 2. Run FreevoBTServer. The SmartHomeCell application should not find this Server OK Daniel GALLEY, David GABRIEL page 5 of 38 SmartHome project Appendix A2: Logbooks Diploma work 3. Run FreevoCellApplication. It should not detect the BTServer application. OK, FreevoCell application don't find the BTServer ! • Documentate the conflict between BTServer connection and PC Suite Bluetooth connection with the Cell phone (1h) : You have to disconnect Bluetooth in the PCSuite if you want to use The SmartHome application using Bluetooth. Because the connexion manager and The Cell application are in conflict and you cannot connect to the server with Bluetooth. Demonstration: The PCSuite is connected to the Nokia 6230 with Bluetooth: If I try to connect to the BTServer, the Cell application does not find the service nothing appends: If I deactivate Bluetooth in PCSuite and I reboot the Cell Phone. The SmartHomeCell application finds the BTServer service: Daniel GALLEY, David GABRIEL page 6 of 38 SmartHome project Appendix A2: Logbooks Diploma work Conclusion: Be sure that PCSuite Bluetooth connection is deactivate if you want use the BTServer service! • • Reading a tutorial about J2MEPolish. J2ME Polish is a tool to create graphical application for J2ME mobile phone. It uses a CSS style sheet to define the graphical aspect of the application. The application is then separate from the GUI. (4h) Install J2ME polish and run the demonstration application. I tried to modify parameters to better understand how polish works (3h) Wednesday 5 October 2005 Daniel GALLEY, David GABRIEL page 7 of 38 SmartHome project • • • Appendix A2: Logbooks Diploma work Reflection about the architecture of the Client-Server application. Find different architectures possible to implement. (3h) Write the design of three architectures possible (2h) Read documentation about J2ME graphical interface programming using Canvas. I tried to write a small application to have a better overview about the possibility to use Canvas to implement my Cell application (5h) Thursday 6 October 2005 • • • Read documentation about XML parsers (DOM and SAX) (2h) Program with Java an application that can parse a smarthome xml file and store information into objects. (4h) Program methods to fetch my database (3h) Friday 7 October 2005 • • • Finish to program the methods to fetch the database (2h) Program a method to write the xml file backup (3h) Re-install Cygwin because I need the rsync command to do my Backups. I had a big problem. I deleted the old Cygwin version and re-installed with the update. But after I cannot re-install Telos Motes toolkit. I spent a lot of time to re-install correctly Cygwin but I didn't arrive to install the Toolkit for Motes. o Conclusion: It is very important to install the Toolkit for Motes before Cygwin because you will not arrive to install Telos Motes toolkit. (3h) Saturday 8 Octobre • I have problem to run the code I wrote for the HCS database (HCServer) since I have re-installed Cygwin. I spent a lot time to find the problem (5h): o Explanation of the problem : SmartHomeDB use the xerces.jar library to parse a XML file. So I added in the CLASSPATH variable the URI of xerces.jar. But I had this error: Org.SaxParserError : File "SHFile.xml" couldn't be find The reason of this error is that I used not the good version of xerces. To run correctly my application. You have to find on the web the version 1.4.4 of Xerces. (http://archive.apache.org/dist/xml/xerces-j/ ). After unzipped the file, you just have to set the library in the CLASSPATH (if you use a shell) or add the external library in Eclipse. How to add an external library with Eclipse: • Go to the project properties menu • In the library tab click on Add External JARs Daniel GALLEY, David GABRIEL page 8 of 38 SmartHome project Appendix A2: Logbooks • How to add • • • Diploma work Browse to the PATH of your jar file (for us C:\xerces1_4_4\xerces.jar) the library in the CLASSPATH: Right click on my computer. Choose properties and tab Advanced Click on Envirronement Variables Daniel GALLEY, David GABRIEL page 9 of 38 SmartHome project Appendix A2: Logbooks Diploma work • In user variables fro t02dgabr Edit CLASSPATH and add at the end of the line …;c:\xerces-1_4_4\xerces.jar How to run and compile the application with your shell: Daniel GALLEY, David GABRIEL page 10 of 38 SmartHome project Appendix A2: Logbooks Diploma work Monday 10 October Define and program the HCS, GPRS Server, Client basic applications. These applications can be used to test if it is possible to acces to two different machines to access on the same application situated behind a NAT. (7h) See natTest document for more information. Thursday 11 October Debug the programs written yesterday. The test runs well on localhost, but I have problems to deploy it on different machines. The messages do not pass through the network. The GPRS Server I installed on firenze server is not reachable. (7h) The problem seems to come from the firewall of the school but I have no proof yet. I try to program very simple applications that send/write UDP datagram and display the address of the emitter. I sent only one UDP datagram on firenze server but I did not receive it. I tried also on Roma server, but it did not work too. Wednesday 12 October Show the test I did yesterday to Pr. Noubir. We make together some tests measure with Ethereal to be sure that the problem comes from the school's firewall. Pr. Noubir will send an email to the school network administration to change the firewall configuration. I have to wait until they change the configuration. We had a meeting with Daniel and Pr. Noubir to discuss about the objectives and the planning. • • • • • The planning seems to be OK, we just have to change some little details The objectives are OK too. Just add captions on schema. For the development we have to write possible extension that caught be do during a next project. It should be good to integrate the floor plan in the client Interface. I have to send an email to Pr. Noubir to remember him for the following things : • Bring a drilling machine to put a webcam on the servo motor • Bring a NAT modem to can realize the architecture for our demo • Write a security design for our application. The details about routing decision are mentioned in Daniel's logbook. Write the documentation about Client-Serveur architecture analysis. Tuesday and Friday 13-14 October • Design NAT test • Realize and write NAT test (Look result on the NAT test in the annexe of report) Daniel GALLEY, David GABRIEL page 11 of 38 SmartHome project Appendix A2: Logbooks Diploma work Monday 15 October • • • Write the security design Collect and read Information about encryption and authentication. Begin to implement security method to protect, authenticate and encrypt messages in SmartHome system. Tuesday 16 October • • • • • Read documentation about encryption and signature Discussion with Pr. Noubir about the the security design Program a class that adds a signature to the messages. Add time stamps to the messages. Program a class for HCS that control signature and add the time stamps to messages Wednesday 17 October • Add encryption to the system. • Debug security class. I have some bugs to fix: o Some times, I have a padding Exception. The problem comes that messages decrypted have not a good size. I have to better understand how the AES works and why exactly this exception append and how fix the bug. o Some times, signature received is not the same as signature computed. The problem should come from a conversion from String to byte array but I do not know where exactly. The problem do not occurs when I encrypt the signature. I do not know why. o I have to find an easy solution to store the message received and how to verify if they can be deleted. I can use List, Vector or ring buffer. Thursday 18 October • Write the application to secure message on the client part. • I found a security library for J2ME on www.bouncycastle.org. • Read examples of applications in the book: Beginning J2ME, From Novice to Professional (Apress edition by Sing Li and Jonathan Knudsen). • I already have problem with encryption, because tools to encrypt data are not the same that In J2SE I have to manage by myself the padding. • A message encrypted with the J2ME class is not the same with the J2SE class because I do not how the padding is add in J2SE class. • I decide to forget for the moment the encryption part and only sign and add time stamps in the messages. • Make test to be sure that the J2ME and J2SE work correctly together. (see test on annexe of report) Friday 19 October • Rewrite planning • Add modification in client-server analysis document. • Make a precise design of the HCS • Develop HCS Daniel GALLEY, David GABRIEL page 12 of 38 SmartHome project Appendix A2: Logbooks Diploma work Monday 24 October • • • Write the treatment of request of the HCS. Write and test the code to communicate with bridge Mote on Serial Port Write the treatment of request for Motes. Tuesday 25 October • Write commentary on Java code for HCS and GPRS Server • Generate Javadoc of HCS and GPRS Server • Write the documentation about HCS and GPRS Server. Wednesday 26 October • Write documentation about HCS and GPRSServer Thursday 27 October • Study the differencies between Avetana and Roccoco. • Try to run the BTServer with Avetana. It works now • Code an a first version of BTGateway Friday 28 October • Write an example of MIDlet to test the Bluetooth server. • Impossible to receive with the read method of the inputStream method for bluetooth. I have a problem to know the size of the message received. Finally I find a solution with the method "isAvailable". Monday 31 October • Realize a test to know exactly the maximum size of messages that can be sent on smarthome architecture. • Implementation of BTGateway. I have problem of concurrency with Threads. The problem seems to be resolved. Tuesday 1 november • • • • Implement fragmentation system for HCS answers Implement character stuffing for bridge Mote messages from HCS Test the fragmentation of HCS answer Test the character stuffing message Wednesday 2 november • Working with Daniel to develop a character stuffing algorithm on the Mote side. We have problem to synchronize reception and compute character stuffing. We decide to do not use character stuffing for the moment. • Update documentation on fragmentation and message format. Thursday 3 november • Update documentation on character stuffing. • Update general documentation • Fix some HCS bugs • Visit of the SHARE house Boston and Pascal Marmier. We can do our final video conference at the SHARE house. It is great opportunity to do that there, because they have very good equipment! Daniel GALLEY, David GABRIEL page 13 of 38 SmartHome project Appendix A2: Logbooks Diploma work Friday 4 November • Update documentation and website • Begin the client development. Monday 7 November • Implement all the menus and the searching of smarthome in the client • Write the connection class for client application • Tests with the connection from client to HCS with Bluetooth or GPRS Tuesday 8 November • Implement all the connection classes with the client and HCS I developed and interface to use the same connection method with GPRS and Bluetooth. Wednesday 9 November • Implement the temperature measurment for the client application • Implement the switch function for client application Resolutions of a problem: The application that I programmed works very well with the emulator. When I wanted to deploy my application on the cell phone, it was impossible to run the application. To know why, I put all my code in commentary and add portion by portion of code to know where the problem was. The source of problem was that I used variable of double type and the CLDC 1.0 do not support floating variables. The emulator was configured with CLDC 1.1 who supports floating variables. Thursday 10 November • Implement the Dimmer Switch function for the Midlet. • Add pictures in the menu • Tests with Bluetooth and GPRS Friday 11 November • Re-write the BT client application to fix some bugs • Add pictures in the client Midlet menu • Realize tests on Bluetooth Monday 14 November • Writing client documentation • I helped Pr. Noubir to install a cooler on Firenze • I fixed some bugs on Firenze Tuesday 15 November • Read documentation on MIDlet coding and Item customization. • Meet with Dr. Julian F. Randall, a postdoc a student from polytechnic school. We present him the objective of our project. And he presented us his work. He wrote a book about acquiring energy and collecting data with indoor solar devices. We discuss together about what can be subject of interest for our respective project. The work of Dr. Julian F. Randall was more helpful for the protoSN2 project. • Coding the servo motor control on the cell phone device. • Read Polish tutorial and try to use it. Daniel GALLEY, David GABRIEL page 14 of 38 SmartHome project Appendix A2: Logbooks Diploma work Wednesday 16 November • • • I Explain to Pr. Wagen my problems with Bluetooth. We try together to find a solution at the problem. I try to connect to HCS with Bluetooth. The MIDlet arrives to find the service but cannot use the OutputStream to send the request. We try with Pr. Wagen to send only a byte to be sure that the problem does not from de BTGateway side. But the BTGateway do not receive a byte. We discuss with Pr. Noubir and Pr. Wagen about the end of the project: The tasks to realize until the end of the project are 1) Place the treatments of the HCS request in a thread and use a time out for answer of bridge mote. 2) Implement the IR command on the MIDlet 3) Realize test to debug Bluetooth part and eventually re-use Damien Bluetooth code. 4) Writing report. For the EIF open days we have to prepare a PowerPoint presentation who describes the demonstration realized. We also have to do the presentation poster. For the final presentation, we have to realize a short demonstration movie and make a real demonstration in live. (for example light up a led) • I implemented the motor function on the MIDlet. Thursday 17 November • • • • • • Add tickers on the MIDlet to debug the Bluetooth part of the application. Add println on the BTGateway side to debug Bluetooth part Take pictures of Bluetooth error for documentation of Bluetooth part Bluetooth Tests with Sony Ericsson phone. Writing documentation about Bluetooth problems. Preparation of presentation to Pr. Wagen Friday 18 November • • • Writing Bluetooth documentation Implementation of command of the Infra-Red sensor of the Mote on the MIDlet. Demonstration to Pr. Wagen. Monday 21 November • • • Coding on the MIDlet the possibility to access directly to the HCS without using the GPRS Server Coding on the MIDlet the infrared control menu Read Bluetooth book Tuesday 22 November • Last tests with Bluetooth, it do not work very well • Writing report Daniel GALLEY, David GABRIEL page 15 of 38 SmartHome project Appendix A2: Logbooks Diploma work Thursday 24 November • • I resolved the problem with the research of service with Bluetooth I made some tests to verify if the connection with Bluetooth works properly. Wednesday 23 November to Wednesday 30 November • • • • Writing report Preparation for the open days Visit to the SHARE HOUSE to prepare the final presentation Preparation of the final demonstration Daniel GALLEY, David GABRIEL page 16 of 38 SmartHome project Appendix A2: Logbooks Diploma work 1.2 Daniel's logbook Monday 09/26 • • • First meeting with Prof.Guevara Noubir. Installation of my workspace (PC…) Administration stuff Tuesday 09/27 • • • Administration stuff (con't ) Demonstration of the architecture in place at Northeastern University First contact with the architecture and the java code already done Wednesday 09/28 • • • • • • • Study of the architecture and java code (con't) Study of the C code embedded on the TX_mote and RX_mote Try to upload the C code from NEU on the Tmote from EIF it works!! (be careful : NEU use TelosB and EIF use TmoteSky change for the bsl) The TX_mote and RX_mote have been both replace by the EIF motes Try to basically modify the C code from NEU (position of the servo-motor) Establishment of a partial planning Tuesday 09/29 • • • • Beginning of the report Continuation of study C code Create the structure of our planning Brainstorming about the objectives, application to realize, demonstration to realize Friday 09/30 • • • • • • Meeting with Prof. Wagen (EIF) and Prof. Noubir (NEU) Write clearly on the paper the objectives discuss during the meeting and try to find where problems can appears. Write report Try to understand deeply the C code on the mote (makefile, interruption, …) Discuss with Prof. Noubir about understanding difficulties on this C code Discuss with Prof. Noubir about routing protocol and algorithm available for the SmartHome sensor network Daniel GALLEY, David GABRIEL page 17 of 38 SmartHome project • • Appendix A2: Logbooks Diploma work Acquire and read documentation about RIP/Bellman-Ford, OSPF routing protocol. Acquire and read papers and study about wireless ad-hoc sensor network. Monday 10/3 • • • • Meeting with Prof. Noubir Learn to use LEDs for debugging (CLR_RLED(); TOGGLE_RLED(); …) Take in place a small demonstration using a single hop Documentation of the demonstration "1 HOP" Tuesday 10/4 • • • • • • • Brainstorming to determine what kind of frame format we need for the SmartHome Sensor Network. Deep understanding of what we need to change to use the current application on the mote with the frame format define (not easy to implement need to look strongly on the library offer by the provider (chipcon)). Short meeting with Prof. Noubir to discuss about the choice we take. Implementation of the structure. (SHSN_msg.h) Documentation of the frame format Modification of the RF_TX and RF_RX_Servo to use the new structure (it will take a long time because I don't have a lot of experience about makefile, pointer, structure and so one… ;-) The structure is in place, the code with modification can be loaded on the mote but it doesn't work!! (but I know why now. It's the fact that the value read from the usb port use 1 byte and my application use 2 byte!!! The solution are: modify my structure to have a value of 1 byte (too bad) modify an assembler code (need understanding….:-() Wednesday 10/5 • • • • I fund a solution without assembler code modification (ouf…) and without modify my structure of frame (cool!). In fact, I need to define a method that read the serial port byte per byte and reconstruct the frame on the mote. For instance, I don't need to read more than value because I enter a value between 1 to 9 from my keyboard (hyperterminal) I realize the demo n°2. It consists of a radio communication between 2 motes (RF_TX_2 and RF_RX_Servo) using the frame structure defines for the SmartHome Sensor Network. It works!!! Warning: I spend too much time (3 hours) to debug my application before it works! The problem was that my payload length was defined at 18 bytes. In fact I need a payload length at 20 bytes because 2 bytes are used for the pFooter (like crc I think)… Documentation of the demo n°2 I realize the demo n°3. It consist of a little sensor network with really basic routing functions (just detect predefined destination address, time to live, ..) It works!!! Daniel GALLEY, David GABRIEL page 18 of 38 SmartHome project • Appendix A2: Logbooks Diploma work Documentation of the demo n°3 (not finished yet) Thursday 10/6 • • • • • Documentation of the three demonstration already done Update of the description of the frame format Research about documentation concerning routing in general and routing for wireless sensor network Found two books. One in relation of routing in data networks and the other concerning algorithms used for graph (mathematical, but can be an help) Quick parse of the documents (3 hours) and summarize the main subject (1 hour) Friday 10/7 • • • • Reading papers about wireless sensor networks and routing Synthesis of the document read Thinking about what solution can be implement for the SmartHome sensor network Summarize these ideas on the paper Monday 10/10 • • • • • Reading of new documents found during the weekend Adding new ideas for SmartHome sensor network Description of a little network (4 motes) using routing tables. Implementation of this network. The shortest path has been determined manually. The network cannot react if modification occurs. The next step is to implement a shortest path algorithm (Bellmann-Ford) and thinking about the routing information exchange between motes. The demonstration 4 (static routing with predefined tables) was created Tuesday 10/11 • • • Implementation of the Bellmann-Ford algorithm to determine the shortest path. The minimum cost for each node can be computed but I've still problems to give for each destination, the correspondent next hop. Write the planning Wednesday 10/12 • Finish implementing the centralized Bellmann-Ford algorithm. Each mote are capable to determine the shortest path in the network if they have each the entire graph of the network (links and initial routing table). Daniel GALLEY, David GABRIEL page 19 of 38 SmartHome project • • • • • • Appendix A2: Logbooks Diploma work Realize the demonstration 5 (centralized Bellmann-Ford) for a four-mote network. Write the documentation for the demonstration 5 Write the documentation for the demonstration 4 Meeting with prof. Noubir Now I need to implement a distributed Bellmann-Ford. That means each mote know his neighbors and the cost to reach them. This information is sent to the neighbors and with all the information transmitted through the network; each mote can recreate his local routing table without to know the entire network at the initialization. I need to define the frame format for the routing messages. Thursday 10/13 • • • • • Begin to implement the distributed Bellmann-Ford routing… The structure of the frame is defined. The structure of the SHSN message is the same. Only the payload change. The differentiation between a data message and a routing message is done according with the "protocol" field in the SHSN message. Implementation of some common function for the routing processing The RF_TX cannot be compile…. Some data are not recognized in other c files. Today was a "C" day for me. I've learn a lot of new things. I've passed a lot of time in C documentation to understand important skills for the future of my project Friday 10/14 • • • • Continue the distributed Bellmann-Ford routing… I've also acquire some new skills in C. (for example, the command malloc can not be used for embedded application… better to use extern variables) The following features of my algorithm are implemented and work: o Using 3 motes, the neighbor information is transmitted o With the information received, the routing table is modified o Data can circulate through these 3 motes. Meeting with Prof. Wagen I need to ask Prof. Noubir if some ready-to-use source code are available anywhere? Monday 10/17 • • • • Continue the implementation of my distributed routing algorithm. 5 motes composed my network now. I need to find a solution to send routing information not only one time but repeatedly to allow my network to react when modification occurs. For this I can use timers… Documentation of the demonstration already in place… Study how to use the timers with C and especially the MSP430 microprocessor. I use the method main to send routing information each 10 seconds. The routing tables are right!!! The problem is that I can do anything else when I wait 10 sec… I really need to use the Timer for this!!! Daniel GALLEY, David GABRIEL page 20 of 38 SmartHome project Appendix A2: Logbooks Diploma work Tuesday 10/18 • • • • • • • Learn more how to use the timers with the MSP430 Implementation of a timer used to send the routing information repeatedly (each 5 sec for example) This is just a first step. After a solution where the time between the routing information can change in function of the modification of the network need to be done to save energy… For some reason not determined yet, I can only use the Timer B1 (7 timers interruption can be used…). I spend 3 hours on this problem. For the moment, it is not important but Nicolas Pasquier also needs to use the timers… We need to talk about that later… Now I use the timer to send routing information to the neighbors I spend time on the following problem : o When a packet is sent by a mote, acknowledge is coming back. In my code, I treated the acknowledge the same as a real packet wrong o I need to use the basicRfReceiveOn() and Off() method ? I don't think so, I used them before because I treated acknowledge. Now it is not necessary. For the moment, my routing algorithm running (the routing table converge in the right way and the data are received at destination). But sometimes, a mote bug (the mote E especially….) I need to focus my future work on this problem. Wednesday 10/19 • • • • • • • • • Cleaning my basic distributed Bellmann-Ford demonstration…(eliminate all the code not necessary and define a file with common functions.) Try to eliminate some bugs of my demonstration. One was that the interruptions can break the mechanism of my main loop… Create flowcharts of the main function, fifo_rx interrupt and sendRoutingPacket interrupt to better understand the mechanism and to explain easily this mechanism to other people… Try to find a solution to evaluate the cost a wireless link. I fund one solution, the CC2420 send in each packet an RSSI value which contains the Link Quality. I try to capture this value for future applications. I arrive to catch this value but it was only value between 0 and 30 or E0 and FF. I fund the graph of the RSSI value in function of signal strength (dB) in the chipcon datasheet. In fact the value is signed… I change the singed value into an unsigned value and I define some sector in the curve…(for example value between 0 and 10 cost 10, and between 40 and 50 cost 6…) In wireless sensor networks, quick change are not good (need a lot of energy to stabilize…) so I think about a sliding average about the cost value… (before it will change the routing table.) Daniel GALLEY, David GABRIEL page 21 of 38 SmartHome project Appendix A2: Logbooks Diploma work Tuesday 10/20 • • • • • • Try to find a solution for the mote to know the neighbor by itself. I think about a broadcast message with an implicit ack request, and then each mote who receive the broadcast message will send an ack with their source address and the link quality… Actually, this solution is not possible because in the ack message (send by the chipcon hardware function) there is the link quality but no source address… !!!! I need to define a specific broadcast message to acquire information about reachable neighbor and the appropriate link quality. Create flowcharts about the send and receive radio packets with the CC2420. This code was already implemented (by the constructor Chipcon), but I realize that it will be necessary to have a deep understanding of this mechanism for future applications. Define a system "how to know my direct neighbors" and begin to implement the system. Friday 10/21 • • • • Continuation of the implementation of the system to find direct neighbor Gathering all information about the basic Bellmann-Ford routing already implemented and create documentations about that. Create documentation about the computation of the link cost with link quality provide by the CC2420 Create documentation about systems to learn about the neighbors… Monday 10/24 • • • • • • • Actually, define a special NEIGHBOR_PROTOCOL to find the direct neighbor is maybe not the better solution. That will take a lot of energy…. Try to use the ROUTING_PROTOCOL to learn about the direct neighbor. At the beginning, each mote sends an empty routing message to the entire neighbors (broadcast) because nobody knows anybody… But when a mote receives a routing packet, it knows that come from a direct neighbor, so it can register this mote in the routing table. This solution will use less energy than the others (describe Friday…) Implementation of this solution Test of this solution (difficult because this is a real test and the mote needs to be distant each other to obtain real costs…) One bug detected is the routing protocol is not efficient for the moment because some loops appear… error in the cost computation Found some problems (routing table filled with strange mote address maybe length packet problem, …), data sent with broadcast address (maybe need to deactivate interruption somewhere…) Need to find a solution if a mote suddenly disappears or become unreachable… (Count to infinity, split horizon …) or if the topology suddenly change and the better route also change… Daniel GALLEY, David GABRIEL page 22 of 38 SmartHome project • Appendix A2: Logbooks Diploma work Read documentation about DSDV protocol Tuesday 10/25 • • • I really need to debug strongly my routing program before to continue with other things… today I fund some major problems… o I use to much debug tool (printf()) in my program and that take a lot of time (access to the serial port each time). During this time, nothing can be received by the radio module because I disable radio_rx interruption… That was one of the major source of problems o The other one is the serial port reading… (from hyperterminal). When I enter a wrong data (address or value) the packet was send nevertheless. This wrong packet makes the network unstable. The demonstration with a real network (I mean real distance between mote, so real costs too) can be done… For the moment, if suddenly a mote disappears or is not reachable, the routing table is not updated… I need to read more about DSDV protocol for this… I try to use data received from the HCS (the real one and not the hyperterminal) and fill the data packets with received values… Wednesday 10/26 • • • • • I think my routing algorithm work (more or less) but the major problem is the reliability… I think the problem is the cost attribution. When a direct link (signal strength) between two motes becomes weak, the packets received are not reliable. I will do some test about this problem today and try to attribute the cost with a better strategy. I need to think to reduce the emitted radio power. That will be easy to make some tests… ☺ Measurement of the power received in function of distance… Control the CRC before using a packet for the routing table or for data… SOMEBODY STOLE ONE OF MY TMOTE SKY DURING ONE MY TEST!!! IT WAS ON THE CORRIDOR BECAUSE IT NEEDS TO BE FAR FROM MY SOURCE MOTE TO PERFORM A REAL HOP!!!! . I'M VERY DISAPPOINTED ABOUT THAT!!!! Thursday 10/27 • • • • Reducing output power is not sufficient to perform test only in the laboratory (because outside the laboratory, it is not safe!!! ☺). I found another solution to perform test closer cost threshold! Cost threshold can eliminate or reduce the error rate when a packet is sent. Documentation about cost threshold Maybe thinking about an implementation of a system with sequence number (like DSDV) to update routing table if the topology change. Daniel GALLEY, David GABRIEL page 23 of 38 SmartHome project • • Appendix A2: Logbooks Diploma work Why use sequence number…??? Maybe it will be easier to increment each round (a round is 8 seconds for the moment and it is the time waited between routing information exchange) the cost of the direct neighbors (but it is clear that this solution take more time to react…. ) Implement the solution which increment the direct neighbor cost. This solution works! The network react if the topology change..(but slowly). The speed of the reaction can be modify. Friday 10/28 • • • • Implement the fact that the final destination mote provide and answer or acknowledge to the source of the message (HCS mote). The answer message will use the routing table to forward the packet through the network Read the data from the HCS. Use these data to fill data packet. Provide a response for the HCS (HCS wait for a response, in fact the value transmit). I spend time on the fact that the mote read byte per byte the values from the serial port connected to the HCS and the packet need values like address define as WORD (2-bytes). A conversion need to be done… Use the driver from Nicolas to have information about the current voltage on the mote. Monday 10/31 • • • Need to change the structure of SHSN message (Nicolas needs minimum 6 bytes to command a TV via IR). To have a security margin, we choose to define 10 bytes for the value transmitted! The value will be an array of bytes. Documentation of the new functionalities added to the network (react topology changes, provide an answer, read serial port of HCS, …) Documentation of the bidirectional problem within wireless environment Tuesday 11/1 • Try to use the driver to acquire temperature, humidity and dew point. The compilation can not be done. There is problem with the library. Nicolas had developed this driver during the semester project and he didn't use the mspgcc toolchain to compile and test the divers. We try together to determine the problem. We add the files io430x16x.h, in430.h and intrinsics.h in the following directory (where libraries are store for the mspgcc with msp430). C:\Program Files\UCB\cygwin\usr\local\mspgcc\msp430\include The problem is still there, so we think that the driver needs to be modified. The driver needs to use the libraries of the mspgcc used for the compilation • Implement the functionality of the switch using the driver developed by Nicolas. The driver of the switch uses to timers of the timer B. the application use also the timer B. some problems appear because before, I wasn't worry Daniel GALLEY, David GABRIEL page 24 of 38 SmartHome project Appendix A2: Logbooks Diploma work about the problem of using 3 timers of the timer B simultaneously. This problem required a deeper understanding of the timer B mechanisms. But now the problem is resolved (I hope that will be resolve also if a 4th timer need to be used.) • The command of a switch (not the dimmer switch yet) is possible from the client (only client simulation for the moment). A demonstration with print screen of what happened in the entire system when a client will switch on a lamp for example was done. Wednesday 11/2 • • • • Integration of the mechanism of character stuffing (pseudo-code algorithm, implementation) Test of the character stuffing mechanism (it does not work!) Debug character stuffing mechanism. For the debugging, I need to know what happened on the serial communication and on the radio communication too. To know if a packet is received at the destination, I can use printf() to obtain informations at the destination (receiver). But from the sender, I can not use this system because the serial port is used for the application (connect to the HCS). Need to use a serial sniffer. The program used is "Advanced serial port monitor" (available on http://www.telecharger.com). Warning, this program is not a freeware. The trial version is used. Finally found why the solution does not work. The problem comes from the system to read serial data. An explanation of this problem has been documented. "Simple character stuffing for serial transmission". Thursday 11/3 • • • • Continuation of the documentation about character stuffing Visit of SHARE (consulate of Switzerland in Boston). Meeting with Pascal Marmier. Talking about the possibility to perform our final presentation via videoconference at SHARE the 12th December 2005 at 8am Integration and tests of the temperature/humidity driver Now a mote can handle the functionality of a switch and temp/hum sensor at the same time. The entire chain from client to sensor can be used Friday 11/4 • Update documentation for final report!!! Monday 11/7 • • Documentation of the final report (especially about save energy in SHSN) Read papers and books about ad hoc network routing protocol and especially about DSDV Daniel GALLEY, David GABRIEL page 25 of 38 SmartHome project • Appendix A2: Logbooks Diploma work Create a powerpoint to present the actual routing protocol in place (SHSN_basic) and the DSDV protocol Tuesday 11/8 • • • Continuation of the report documentation (describe the different application provided by the SHSN Modification on the SHSN_basic code (because for the moment, the network can be only composed of 5 motes…) Try to adapt the motor application with the current SHSN_basic routing protocol…. Can have problem because the motor application use the same timer and in a different way than the SHSN_basic protocol. Wednesday 11/9 • • Try to found solutions to save energy in the smarthome sensor network. A study about the traffic expected, the topologies expected and the consumption of a mote in different states have been done. Write documentation about these study and the first ideas about energy efficient routing algorithm in different circumstance Thursday 11/10 • • • • Add the functionality to provide an error message (all values = 0xFF) to the HCS if the destination of the message can not be found through the network or if the command on the destination mote can not be perform correctly (measure of the temperature wrong of switch on lamp failed for example) A problem remains. If a mote appear in the network and then disappear, this mote will be found in the routing table. So the mechanism of error message will not work properly because the mote connected think that this mote is reachable with a cost of infinity. I need to add functionality. This new functionality must clean the routing table that means when the cost of a mote reach infinity (100), this mote need to be deleted from the routing table. The functionality to delete a mote which reaches the infinity cost has been implemented but not tested yet. Implementation of the flooding routing algorithm but not tested yet Friday 11/11 • • • Test of the flooding routing algorithm Some problems appears (each packet is not received on each mote) The problem is that when a mote receive a packet and need to forward this packet, it is possible that the mote next to it want to forward the same packet at the same time. So a mote in the neighborhood can receive 2 packets at the same time. The radio reception is not implemented to have a queue, so some Daniel GALLEY, David GABRIEL page 26 of 38 SmartHome project • • Appendix A2: Logbooks Diploma work packets are lost in this way. It is also possible that a packet is received on a mote when the mote send a packet. At this way, a collision occurs. The problem is avoided for the moment by defining a different wait-time before re-broadcasting a packet on each mote. The better way is to implement a queue but the receive buffer is on 128 bytes. A problem occurs on the serial transmission between the mote and the HCS. Only 7 bytes are received on the HCS side Monday 11/14 • • • • The problem with the serial transmission between the mote and the HCS is resolved. In fact the problem was on the HCS side. David has installed a new version of the HCS for the tests. An involuntary error was in this new version. Documentation of the flooding routing mechanism for SHSN. Learning and understand deeply the mechanism of the transmission and reception RF After a brief discussion with Prof. Noubir and Prof. Wagen, I ask myself why collisions occur when data are sent with the flooding routing because the CSMA-CA define a control if the medium is clear. I remark that in the source code from Chipcon for the RF transmission and reception that the controls if the channel is clear has been deactivate because the code for this functionality was wrong (not compliant with the CSMA-CA). I add my own code to take care about the control of the channel before sending a packet. Now with this add, the different wait-time before re-broadcasting a packet in the flooding routing are not necessary. ;-) Tuesday 11/15 • • • • Implementation of the servo motor application for the SHSN_Flooding and for the SHSN_basic Test of this implementation. On the SHSN_Flooding, the motor react but not exactly as expected. The sequence or the pulse width is maybe wrong but the values used are the same as the values used for the previous demonstration (when we arrive at NEU). On the SHSN_basic, It does not work for the moment. The problem comes from the timer B (timer B is used for the routing protocol, for the switch and now for the motor. Interferences is certainly the cause of this problem. Documentation about the servo motor application Meeting with Prof. Wagen and Julian Randall from ETHZ. Presentation of our work and presentation of the skills of Julian Randall. Julian present us his book about "Designing Indoor Solar Products". Wednesday 11/16 • • • • Documentation of the tests of the flooding routing Debugging of the motor application Documentation of the development of the motor application (driver) Documentation of the test of the motor application Daniel GALLEY, David GABRIEL page 27 of 38 SmartHome project Appendix A2: Logbooks Diploma work Thursday 11/17 • • • • Documentation of different part of the report (tools used, temperature/humidity application, …) Meeting and discussion with Prof. Wagen about the work already done The work done is good, some remarks on the report are important (about references of images and graphs, about the measure of the RF attenuation in the corridor, about the OSI layer (routing = OSI 3), about the development of the SHSN_basic, … The work to do until the end of the project ordered by priority is: Monitoring of the SHSN Good documentation for future work Synchronization between two motes (not required) Security aspects (not required) • Debugging of the RF communication of the EIF-motes and test of the Dimmer switch! The results are available below. Test1 of the RF communication of EIF-motes thin wire for antenna motes separate with 50cm problem with CRC!!!!!! (sometime ok, sometime not ok) Figure 1: reception Daniel GALLEY, David GABRIEL page 28 of 38 SmartHome project Appendix A2: Logbooks Diploma work Figure 2: emission Test2 RF communication EIF-mote thick wire (not really better results than thin wire) motes separate with 10 cm (really better results than 50cm) better results, often transmission ok !!! Figure 3: reception Daniel GALLEY, David GABRIEL page 29 of 38 SmartHome project Appendix A2: Logbooks Diploma work Friday 11/18 • • • • During the night, I've thinking about the fact I've turn the output power to the minimum to reduce the radio scale of the tmotes. If I turn the output power back to the maximum, more than 10cm can be expected for the RF communication between two EIF-Motes!!!!! Beginning of the implementation the monitoring on the SHSN_flooding first. Preparation of the demonstration for Prof.Wagen and Pascal Marmier from the SHARE. Test of the packet monitoring on the SHSN_flooding Monday 11/21 • • • • Implementation of the "battery level" monitoring functionality for the SHSN_Flooding Beginning of the implementation of the monitoring in the SHSN_basic to have a comparison with the SHSN_Flooding Documentation and tests of the monitoring with SHSN_Flooding Very good documentation of the code… (comments, …) Tuesday 11/22 • • • • Finish implementation of the monitoring on SHSN_basic (SPY_mote) Test of the monitoring on SHSN_basic Add direct Neighbors functionality on the monitoring (if time enough) Documentation o Interference WiFi vs. Zigbee o Sniffer ZigBee on the market o Tests monitoring on SHSN_basic and conclusion between SHSN_basic and SHSN_Flooding Wednesday 11/23 • • • Test RF with Nicolas Debug update or routing table in SHSN_basic when topology changes occurs Documentation Thursday 11/24 • Documentation Daniel GALLEY, David GABRIEL page 30 of 38 SmartHome project Appendix A2: Logbooks Diploma work Friday 11/25 • • Documentation Debug flooding The problem was the step from 255 to 0 for the packet numbering… When the condition "if (ttl != (msgCount-1))" is done, the problem appear. If msgCount = 0 and ttl = 255 (0xFF), the computation of msgCount-1 was wrong. Instead of 0xFF, the value 0xFFFF is compute. This error comes from the compilation of the code. 16-bit register is used but the value is only 8-bit!!!! Until the end of the project (11/30/2005) • • • • • • • Documentation Creation of the "Poster" for the "journées portes ouvertes" at the EIF Creation of slides for the "journées portes ouvertes" at the EIF Put in place the demonstration for the "journées portes ouvertes" at the EIF Trial for the video conference at SHARE Creation of the final documentation to provide to the EIF Help for the communication debugging between EIF-mote and Telos/Tmote motes Daniel GALLEY, David GABRIEL page 31 of 38 SmartHome project 1.3 Summary problems Appendix A2: Logbooks of logbook concerning Diploma work Bluetooth This logbook contains the email sent and the approaches made to resolve the connection problem with Bluetooth. Mailing Friday 30 September: I sent an email to Mr Amit Gupta (He has developed the Bluetooth part of the first smarthome project) to ask him what can be the source of the problem. I also ask him documentation about the complete architecture, but I never received documentation. The problems with Bluetooth are: • I cannot connect to the BTServer. Nothing appends. • I think that there is a conflict with another application using the same number of service (url) I will try to change this number on Monday • I sent an email to Mr Amit Gupta (He has developed the Bluetooth part of smarthome) to ask him what can be the source of the problem. I also ask him documentation about the complete architecture. • BTServer write errors messages when I'm not logged as root. Answer of Amit Gupta: Hi David, Somehow I lost your message after trying to reply to it. But from what I remember, the error you see on the screen should not affect the service provided by BTServer. The only reason you see that message is because you are not running the service as root. Prof. Noubir saw the same message and thought that to access bluetooth hardware, one needs to be root on the machine. Althoguh I had run the service successfully with that error message, I would su first before running the service. There is no conflict of services on roma if you are running just the BTServer and not Freevo service too. -Amit Daniel GALLEY, David GABRIEL page 32 of 38 SmartHome project Appendix A2: Logbooks Diploma work Monday 3 October: Salut David, J'espère que vous vous amusez bien à Boston. >>Salut Damien ! >>Comment ca va ? >> >>Tu le sais sûrement déjà, je suis à Boston en train de réaliser mon >>projet de diplôme (la suite du projet de semestre Wish). >>J'ai un petit problème et peut-être que tu pourras m'aider: >> >>J'essaye de comprendre un bout de code qui permet de se connecter à >>Server via Bluetooth. Le programme fonctionne très bien, mais le >>problème est qu'une autre application d'un autre projet utilise le même >>UUID, ce qui crée des conflits entre les applications. J'ai essayé de >>changer l'UUID de mon application côté client et serveur. Mais là le >>client ne détecte pas le service offert pas le server. >>Je crois que je n'ai pas bien compris comment on attribue les UUID et le >>fonctionnement de la méthode : >>searchServices(int[] attrSet, UUID[] uuidSet, RemoteDevice btDev, >>DiscoveryListener discListiner) >> >>A quoi correspondent les tableaux attrSet et uuidSet ? Quelles sont leur >>rapport avec l'UUID recherché ? >> >>As-tu de la doc à ce sujet ? En annexe je t'ai mis un powerpoint expliquant les principes de la recherche de services. attrSet --> chaque services a différents attributs, par défaut, une recherche de service donne seulement les 3 trois principaux attributs du service (je sais plus lesquel). AttrSet est un tableau qui contient les id des autres attributs que l'on désire pour un service. http://www.avetana-gmbh.de/avetana-gmbh/produkte/doc/javax/bluetooth/Service Record.html uuidSet --> chaque services bluetooth est identifié par un uuid. De plus la pile de protocole qu'utilise un service (Cnnexion RFCOMM : L2CAP-->RFCOMM) est aussi définit à l'aide d'uuid. Ce tableau définit les uuid pour lesquels nous devons recherche des services. Prenons un exemple: Deux services : servcie A RFCOMM et service B L2CAP 1) Recherche avec uuidSet contenant 0x0100(L2CAP) --> retourne A et B 2) Recherche avec uuidSet contenant 0x0008(RFCOMM) --> retourne A http://www.avetana-gmbh.de/avetana-gmbh/produkte/doc/javax/bluetooth/UUID.ht ml >>Une autre question : >> >>Lorsque que tu programmes des applications Bluetooth sur PC. Quelles >>librairies utilises-tu ? Ici ils utilisent Rococo, mais ça ne fonctionne >>que sur Linux. As-tu déjà utilisé Rococo ? Où existe-t-il une autre >>librairie qui fonctionne avec Windows? J'utilise la librairie d'avetana, mais voici un site où se trouvent plusieurs implémentations de JSR-82 www.javabluetooth.org. Attention pour Windows il y a principalement 2 types de stack (Windcom et Microsoft) à voir si les implémentations sont compatibles avec votre stack. Si je n'ai pas été clair, vous pouvez me recontacter, A+ Daniel GALLEY, David GABRIEL page 33 of 38 SmartHome project Appendix A2: Logbooks Diploma work Damien Friday 28 October 2005 I already have connection problems with Bluetooth, I cannot find the origin of the problem, I phoned to Damien Vionnet to ask him an example of code to compare. Hello, Voici un exemple d'un serveur et d'un client Bluetooth. Si vous avez des question n'hésitez pas à m'appeler Bonne journée Damien Damien sent me only the class files. Friday 18 October 2005 Bonjour Damien, Comment ça va ? Je n'arrive toujours pas à résoudre mes problèmes de connexion avec Bluetooth.... J'ai mis des ticker et j'ai ajouté des commentaires afin d'essayer de comprendre les problèmes que j'avais plus précisément. Mon problème doit certainement venir du code, étant donné que j'ai fait les tests avec différents stack (BlueZ et WIDCOMM), différents dongles (AnyCom et TrendNet) et aussi 2 différents natel (Nokia 6620 et Sony Ericsson P910 de l'école). Voici les problèmes que j'ai : 1) Parfois ma MIDlet ne trouve pas l'UUID que je recherche, mais des autres (parfois aucuns). --> des fois la MIDlet trouve tous les UUID aux alentours, sauf celui que je recherche --> des fois il ne trouve aucun service. --> des fois il me retourne SERVICE_SEARCH_TERMINATED. A presque chaque recherche de service que je fais j'ai une erreur "BluetoothStateException : Busy" qui apparait dans ma méthode de recherche de Service. 2) Certaines fois, quand ma MIDlet trouve le service, fonctionne un moment et tout à coup me pose problème avec ma connection. --> Une IOExeption est générée et je n'arrive pas à ouvrir la connection. Je ne trouve pas d'explication précise à ces problèmes. Et je n'arrive pas à supprimer ce BluetoothStateException qui est peut-être la (ou une des) source de mes problèmes... Peux-tu si tu as un peu de temps regarder mon code et me dire si tu vois quelque chose de bizarre? Ca serait vraiment très sympa de ta part ! Est-ce que tu peux me renvoyer un exemple de code Bluetooth que tu utilises? (la dernière fois je n'ai eu que les class.) Jean-Frédéric m'a montré un exemple de code très simple que tu avais fait avec l2cap. As-tu la même chose en RFCOMM ? Merci beaucoup pour ton aide Daniel GALLEY, David GABRIEL page 34 of 38 SmartHome project Appendix A2: Logbooks Diploma work Bon week-end David Damien answers me by phone that there may be 2 problems in my code: 1. I have to block the Thread after starting serviceSearch and unblock the Thread after serviceSearchCompleted. 2. I do not need to open and close the output and input Stream each time I send or received data. It is better to open the streams once and to close the streams when the connection is finished. 22 November 2005 Salut Damien, Encore moi....et mes problème avec Bluetooth ! J'ai essayé de bloquer bloquer la boucle juste après la méthode serviceSearch et de la débloquer dans la méthode serviceSearchCompleted. Mais ça bloque complètement ma MIDlet et je suis obligé d'éteindre mon natel et de la redémarrer... Ai-je fait quelque chose de faux ? (J'ai mis le code en annexe) Autre question... J'ai essayé de repartir à zéro avec les exemples de codes que tu m'as envoyé. Et là, j'ai encore des autres problèmes. Je n'arrive pas à compiler car j'ai une erreur dans le BTClientRFCOMM et BTClientL2CAP à la méthode : RemoteDevice server=new RemoteDevice(serverAddress); Eclipse m'indique l'erreur "The constructor RemoteDevice(String) is not visible". Est-ce que le code compile chez toi ? Du coté du BTServerRFCOMM et BTServerL2CAP j'ai également des erreur lorsque je lance mon application (aussi bien avec Avetana qu'avec Rococo...) Voici l'erreur : de.avetana.bluetooth.stack.BlueZException: Failed to register service at de.avetana.bluetooth.stack.BlueZ.updateService(Native Method) at de.avetana.bluetooth.stack.AvetanaBTStack.updateService(AvetanaBTStack.java:165) at javax.bluetooth.LocalDevice.updateRecord(LocalDevice.java:409) at BtServerRFCOMM.startServer(BtServerRFCOMM.java:59) at Server.main(Server.java:20) javax.bluetooth.ServiceRegistrationException: Registration of the new Service was not successful! at javax.bluetooth.LocalDevice.updateRecord(LocalDevice.java:411) at BtServerRFCOMM.startServer(BtServerRFCOMM.java:59)Registration of the new Service was not successful! at Server.main(Server.java:20) Cela semble venir d'une de ces de code : //Ajout de l'attribute browseGroupe au service créé LocalDevice.getLocalDevice().getRecord(notifier).setAttributeValue(0x0005,groupAttribue); //Mise à jour du service LocalDevice.getLocalDevice().updateRecord(LocalDevice.getLocalDevice().getRecord(notifier)); Est-ce que ce code fonctionne chez toi ? Ou sait tu pourquoi ça ne fonctionne pas chez moi ? Daniel GALLEY, David GABRIEL page 35 of 38 SmartHome project Appendix A2: Logbooks Diploma work Ca serait vraiment génial, parce que tu es un peu ma dernière chance...... Merci beaucoup et bonne semaine David Damien answered me by phone: He has no explanation why the MIDlet is completely blocked when I block the Thread after starting serviceSearch. Normally only the Thread should be blocked and the Thread should be unblock when the service search is completed…. Concerning the example of code he sent to me: Concerning the instantiation of the RemoteDevice, the problem comes that this code has been written to run with library Avetana and not JSR82, JSR82 has declared this method as Private. Concerning the error when running the BTServer, I can put in commentary the example update service line: LocalDevice.getLocalDevice().updateRecord(LocalDevice.getLocalDevice().getRecord(notifier)); 23 November Salut Damien, Le temps avance et je n'ai malheureusement toujours pas réussi à résoudre mes problèmes de connexion Bluetooth. Je n'arrive pas à tous les coups à me connecter au service. Il me reste encore un grand travail de documentation a faire jusqu'à l'échéance du 30 novembre. Je vais donc surement en rester là et documenter mes problèmes dans le rapport. (A moins que je ne trouve une solution miracle de dernière minute). Est-ce que je peux quand te demander un tout dernier service ? Guevara, le professeur qui supervise notre projet ici à Boston, m'a demandé si je pouvais trouver un exemple de code java qui permet de se connecter entre un PC (avec la librairie d'Avetana par exemple) et un téléphone mobile qui utilise JSR82(par exemple le P910 ou le Nokia) sur lequel les étudiants qui continuerons le projet pourront se baser. Si j'ai bien compris l'exemple de code que tu m'as envoyer fonctionne entre un PC et un PDA qui utilisent tout deux la librairie d'Avetana. As-tu un autre exemple de code que tu as fais fonctionner sur le Sony Ericsoon ou le Nokia ? Je te remercie encore beaucoup pour ton aide ! A bientôt David Answer of Damien: > Salut, > > Voilà les différents exemples ils sont sensés marcher sur toutes > les plate-formes implémentant le JSR-82. > Daniel GALLEY, David GABRIEL page 36 of 38 SmartHome project Appendix A2: Logbooks Diploma work > Bonne journée > Damien Unfortunately the example of code do not compile, I answered to Damien Vionnet: > > > > > > > > > > > > > > > > > Salut, Désolé de t'embêter encore, As-tu réellement essayé ce code sur le Sony Ericsson ? Car la méthode "RemoteDevice server=new RemoteDevice(serverAddress);" me retourne une erreur. La constructeur RemoteDevice est déclarée protected dans le package javax.bluetooth de MIDP... Je n'arrive pas à compiler. Merci, David 24 November I finally found a solution to resole the connection problem with Bluetooth Bonjour à tous ! Nous avons trouvé avec Guevara une solution qui semble bien fonctionner pour Bluetooth. Les tests que j'ai jusqu'à maintenant n'ont relevé plus aucun problèmes pour trouver le service désiré. Je recherche d'abords tous les devices et ensuite je fait une recherche uniquement sur le device qui a le friendly name que je désire : (j'ai donc en fait que rajouté un "if" : try{ if(remotedevice.getFriendlyName(false).equals(Constants.BluetoothDeviceName)){ doDiscoverService(remotedevice); } } catch(Exception e){ midlet.tic.setString("Cannot catch friendly name!"); } J'ai rajouté à ma MIDlet un menu option qui permet de modifier le friendly name du dongle sur lequel on désire se connecter. Si je ne modifie rien, le dongle recherche les service sur le device qui a le friendly name "smarthome" (mon laptop). Je peux ainsi choisir sur quel dongle je veux me connecter. Daniel GALLEY, David GABRIEL page 37 of 38 SmartHome project Appendix A2: Logbooks Diploma work Je n'ai plus l'erreur BluetoothStateException : Busy. Merci beaucoup Damien tes conseils m'ont beaucoup aidé ! Bonne journée ! David Personal research on the web and in books: Books: "Beginning J2ME from novice to professional", Third Edition, Apress Edition by Sing Li and Jonathan Knudsen, ISBN 1-59059-479-7 "Bluetooth for Java", Apress Edition by Bruce Hopkins and Ranjith Antony, ISBN 1-59059_078-3 Internet: API JSR82: http://www.jcp.org/aboutJava/communityprocess/final/jsr082/ (October 2005) Introduction about java programming: http://www.javabluetooth.com/jsr82devices.html (October 2005) Bluetooth tool to search the list of Services offered by all the devices found: http://www.benhui.net/modules.php?name=Bluetooth&page=btbrowser_v20.html Daniel GALLEY, David GABRIEL page 38 of 38