Self defined Event processing problem

Hi every1�Cthe situation is like the following:
2 PCs communicate through Bluetooth serial port profile by 3 classes that i wrote.
First, BluetoothManger, it implements SerialportEventListener of Javax.comm package,its job is to read the incoming data from the other end and store them into an array,and it works.
Second,DataReceiver,it implements EventObject, so whenever it copies the array from BluetoothManger, it will pass them into the next stage Algorithm.
Third,Algorithm., it implements EventListener, it has function @public void dataChanged(DataReceiver dr)@, this function is causing a loop to run forever
The other end is sending 20 numbers each frame,and there are only 10 frames,but once the sender side start sending stuff, the receiver end kept running forever...
The following is the code,thanks very much in advance for anybody's voice!!!
import java.io.*;
import java.util.*;
import javax.comm.*;
public class BluetoothManager implements SerialPortEventListener{
     static CommPortIdentifier portId;
    static Enumeration portList;     
     InputStream inputStream;
    SerialPort serialPort;
       DataReceiver dr;
       Convert c;
       byte[] tempBuffer;
       byte[] smallArray;
       int[] intArray;
       int[] ints;
       int k;
    int h;
    public BluetoothManager()
         tempBuffer=new byte[100];
         smallArray=new byte[100];
         ints=new int[20];
         intArray=new int[230];
         dr=new DataReceiver(ints);
         c=new Convert();
         k=0;
         h=0;
    public void listenToPort()
          portList=CommPortIdentifier.getPortIdentifiers();
          while(portList.hasMoreElements()){
               portId = (CommPortIdentifier) portList.nextElement();
               if (portId.getPortType() == CommPortIdentifier.PORT_SERIAL){
                    System.out.println("found..." + portId.getName());
                    if (portId.getName().equals("COM6")){// 4
                         try {
                           System.out.println("about to try.." + portId.getName());
                           serialPort = (SerialPort) portId.open("SerialPort", 2000);
                       } catch (PortInUseException e) { System.out.println("Exception: Port in use!"); }
                       try {
                           inputStream = serialPort.getInputStream();
                       } catch (IOException e) {}
                         try {
                           serialPort.addEventListener(this);
                         } catch (TooManyListenersException e) {}
                       serialPort.notifyOnDataAvailable(true);
                       try {
                           serialPort.setSerialPortParams(9600,
                               SerialPort.DATABITS_8,
                               SerialPort.STOPBITS_1,
                               SerialPort.PARITY_NONE);
                       } catch (UnsupportedCommOperationException e) {}
    public int[] storeFrameArray(byte[] temp)
          smallArray=temp;          
          for(int i=0;i<20;i++){
               byte[] temp2=new byte[4];
               System.arraycopy(smallArray,k,temp2,0,4);
               ints=c.toInt(temp2);
               k=k+4;
               if (k>=80) k=0;               
          return ints;
     public DataReceiver getDataRX(){
          return dr;
     public void serialEvent(SerialPortEvent event)
switch(event.getEventType()) {
     case SerialPortEvent.DATA_AVAILABLE:
          try{
               while(inputStream.available()>0){
                    inputStream.read(tempBuffer);
                              dr.setArray(this.storeFrameArray(tempBuffer));
          }catch(IOException e){           }
     break;
import java.util.*;
public class DataReceiver extends EventObject{
     int[] rxArray;
     int h;
    boolean dataChangedFlag;
     public DataReceiver(int[] ints)
          super(ints);
          rxArray=new int[20];
          dataChangedFlag=false;
         h=0;
     public void setArray(int[] array)
          System.arraycopy(array,0,rxArray,0,20);
         dataChangedFlag=true;
     public int[] getIntArray()
          return rxArray;
     public boolean getFlag()
          dataChangedFlag=false;
          return dataChangedFlag;
     public void addDataReceiverListener(Algorithm algo)
          while(dataChangedFlag=true){
               algo.dataChanged(this);
import java.util.*;
public class Algorithm implements EventListener {
     boolean finishFlag;
     int[] alArray;
     int[] partInts;
     int[] events;
     int eventIndex;
     int[] dd;
     int i;
     int result;
     DataReceiver drr;
     public Algorithm(BluetoothManager bMAL)
          drr=bMAL.getDataRX();
          finishFlag=false;
          alArray=new int[230];
          partInts=new int[20];
          events=new int[500];
          dd=new int[20];
          result=0;
          eventIndex=0;
          drr.addDataReceiverListener(this);     
     public void calculate(int[] intss)
          for(int i=0;i<20;i++)dd=intss[i]*5;     
          for(int j=0;j<20;j++){
               if(dd[j]<100&&dd[j]>50){
               events[eventIndex]=dd[j];
               System.out.println("Index"+eventIndex+":"+dd[j]);
               eventIndex++;
     public void dataChanged(DataReceiver data)
          data.getFlag();
          partInts=data.getIntArray();
          calculate(partInts);
Thanks again

> Hi every1�Cthe situation is like the following:
What?
~

Similar Messages

  • How to raise a self-defined event with parameters in program

    Hi,all,
    I want to raise a self-defined event with parameters in one of my method ,how to do that?Thanks

    Hi Ray,
    If your event name is MYEVENT and the parameter name is MYPARA and the value you want to pass to this parameter is L_PARAVALUE, use the following -
    wd_this->fire_myevent_evt( mypara = l_paravalue ).
    If the event is to be raised in an a view, then you need to get the component controller instance first and use it instead of wd_this.
    Also, this can be obtained directly by clicking on the WD Code Wizard ->Radio button for raise event->selecting your event.
    Regards,
    Neha
    <i><b>PS:Reward if helpful</b></i>

  • InDesign CC2014 CEP Engine event processing problems

    Hi,
    I working a hybrid plug-in, where CEP events are sent from InDesign CC 2014 to an HTML5 panel (and back). Somewhat to my surprise these events are handled asynchronously in the CEP Engine.
    To observe this, you can break in your event handler in the debugger in Chrome and then watch the console log and you will observe that subsequent calls to your event handler gets processes. Or more curiously, watch the UI of the panel get updated while it is greyed-out and displaying "Paused in Debugger", if your event processing is reflected in the UI  - not exactly what you would expect.
    So:
    1) Is there a way to get the CEP events processed synchronously ?
    2) Does the CEP Engine provide some kind of semaphore functionality, so that access to global variables and the likes can be controlled ? 
    Regards,
    Thomas

    There is no way to make the CEP events synchronous. Please design your plug-in and extension to adapt to this asynchronous model. Thanks

  • Problem with Self defined info structure.

    Hi All,
    We have Create some Self define Info structure Like ;--
    S061 Location  and Planning               --->S501
    S062 object class and manufacturer --->S502
    S063 Danage analysis                        --->S503
    S065 Object Statistics                         --->S504
    But probleme is when we excute S501 self defined info structure heading comes as
    Standard Analysis for Info Sstructure S501: Selection where as in Standard it is coming as Location Analysis: Selection
    Any one can tell how can i solve this probleme.
    Thanks
    Vinit

    steps to create own infostructure by copying standard infostructure.
    steps.... 1) First Create your own info structure using menu path SPRO> Logistics general > LIS > Logistics data warehouse > Data basis > information structure > maintain self defined ino structure Here create a New stucture called S901 (Follow Custom defined structure naming conventions) for application 07, by copying S115 .
    Once inside this Choose the Charateristic button below and CHOOSE SELECTION LIST.
    This will popup a list of fields that can be added to the structure for analysis per field catalogue.
    Navigate to the notification Object field catalog to select the Order number.
    Select other field as appropriate from other field catalog and copy them.Then select or de-select the "Key figures" thats relevant for your needs Check ,generate and activate the same structure and save.
    2) Create Update rules for updating this info structure by copying the rules of S115.
    SPRO> Logistics general > LIS > Logistics data warehouse > Data basis >Updating > Specific definition using update Rules > Maintain update rules.
    Enter the newly created Structure name and choose teh Update group 26 (use drop down) and enter the S115 and 26 as teh group and rules to copy from.
    Delete the rules thats not relevant for your needs and then check, and Choose "generate: and then activate the "UPDATING" and save.
    3) Activate the Update type for the new structure. SPRO> Logistics general > LIS > Logistics data warehouse > Data basis >Updating > Update Control > Activate Update.
    Choose PM and double click on the new structure that you had just created and chosoe Period and Type of updating (2: Similar to other standard info structures). and save.
    This should start updating New orders that you are creating from Now on.
    However if you would like to pre-populate existing data in this structure for analysis, then you would have to run through the generation program in background for this specific structure.
    SPRO> Logistics general > LIS > Logistics data warehouse > Data basis >tools > setup of statistical data >Application specific setup of statistical data > perform setup - PM.
    Here make sure to do the PMIS statistical setup (This might be redundant, if you havent changed any value category that updates PMCO table) and Set Up: Plant Maintenance IS(Make sure to choose your specific structure).
    You should be able to check the table entries to confirm that the program has updated the table (Name of the info structure).
    The defaulted version could be different from the standard version (000).You could copy the data from one verion to another version using the first step in this block.
    Once the genration is complete you should be ready to use this structure using MCIS transaction (PMIS > Standard analysis > User defined analysis).
    This will list out all the user defined structures and you can pick and execute the one that you had just created.
    Regards
    Dhiren
    Edited by: Dhiren Kumar Sahoo on Feb 2, 2010 3:55 PM

  • Problems with user-defined update-process

    Hi.
    I have a small problem in the right syntax in an user-defined updated process.
    The process is called by a button on the page and should update a record in a table.
    BEGIN
    UPDATE wam_mod_allocation SET
    alloc_assessment = V('P2120_ASSESSMENT'),
    last_update_date = LOCALTIMESTAMP,
    last_update_staff = V('APP_USER')
    WHERE username = V('P2120_USERNAME')
    AND module_id = V('P2120_MODULE_ID')
    END;
    This is the code of the process. The line with the problem is marked bold. P2120_USERNAME is a text field in the page and contains the username to be updated.
    The problem is, that the comparison doesn't work. the value "smith" is available in the table and is the same as in the text field. (both in lower case).
    If I replace the part V('P2120_USERNAME') with 'smith' (with single quotes), the update statement works properly.
    How do I have to compare the username with the item value that it works properly?

    1. Stephan
    2 + 3 Well. I enclosed both tags in the TRIM-Operator and it works. First, I thought, a whitespace caused the problems. To determine which value contains the whitespaces I removed the trim-tags on both sides. It works.
    It is quite funny, because,if I remove both tags, it works too? Well. Yesterday it didnt.
    To be on the safe side, I will include the trim-tags.
    Thanks very much.
    Stephan

  • Probleme with Self defined info struc

    Hi All,
    We have Create some Self define Info structure Like ;--
    S061 Location and Planning --->S501
    if we campare standard info structure with self defined info structure ..screen layoutis  are not same ..
    1.Means *Characteristics Restriction * Functional Location hierarchy  it is not appearing in Self defined info structure
    2. S064 Object Statistics---> S505 in this case we don't have F4 option in Obejct Class field
    Any one can tell how can i solve this probleme.
    Thanks
    Vinit

    Hi All,
    We have Create some Self define Info structure Like ;--
    S061 Location and Planning --->S501
    if we campare standard info structure with self defined info structure ..screen layoutis  are not same ..
    1.Means *Characteristics Restriction * Functional Location hierarchy  it is not appearing in Self defined info structure
    2. S064 Object Statistics---> S505 in this case we don't have F4 option in Obejct Class field
    Any one can tell how can i solve this probleme.
    Thanks
    Vinit

  • Define event types in Customizing and restart the transaction.

    how to define event to restart the transaction in BADI
    I have given error message in badi. it is giving
    No SAP Event Management communication for events; no event types def
        Message no. /SAPTRX/ASC084
    Diagnosis
        You have not defined event types for the business process types.
        therefore not possible to communicate event data to SAP Event
        Management.
    System response
        The communication of event data is aborted.
    Procedure
        Define event types in Customizing and restart the transaction.

    Hi Kevin,
    What DataSource does your testalias refer to?
    - If it is a custom DataSource, you must have created this custom DataSource also.
    - If it is the default DataSource, you shouldn't have this problem in general...
    In either case, you can try deploying your DataSource and/or DataSource alias together with your application:
    http://help.sap.com/saphelp_nwce10/helpdata/en/45/07d2eeea3e0485e10000000a155369/frameset.htm
    http://help.sap.com/saphelp_nwce10/helpdata/en/45/c82cd460a42e96e10000000a155369/frameset.htm
    I hope that helps!
    Regards,
    Yordan

  • Self defined standard analysis with intercompany

    Hello all,
    we are going to begin the intercompany flows. At this moment, SD dpt, has a Self defined standard analysis (MCSI s-tcode) with sales stadistic data.
    My problem is that with intercompany invoice we won't have a sales document. Flow is:
    Purchase order - delivery - MIGO - invoice - MIRO.
    Because of that in my MCSI i lose intercompany orders. We have another standard analysis with invoices, but intercompany invoices doesn't appears at all.
    Some ideas? User guides? Someone who use intercompany with MCSI?
    Thanks.

    Dear Friend,
    What I can understand from you is intercompany transactions are nto taking place its solely done through MM
    If you want some standard process of Intercompany Transaction Visit this link of the BEST PRACTICES>
    http://help.sap.com/bp_blv1600/V5600/BL_DE/html/index.htm
    regards,
    SAP SD

  • DSC - can't acknowledge or clear a user defined event

    I wrote this code for alarms but now I have modified it to handle events.  So, first create the event (create alarm button), then try to acknowledge it or clear it.  There should be a time inserted for acknowledging and clearing.  It does't work.  I have used the exact event URL to acknowledge it.  Please help.
    Thanks
    Matt
    Attachments:
    User Defined Alarms.vi ‏52 KB

    Hi Matt,
    Thank you for attaching the new code, I didn't realize there was a path in that constant since the original box was so small. Part of the problem you are seeing actually lies within that path, you should be locating to \\*\Process Name\UserDefinedAlarm now that you switched from working with events to alarms. Also, you are still using the Set User Defined Event.vi and Read Events.vi, which need to move over to their Alarm counterparts.
    Once you have those changes made, you need to alter the way you are trying to acknowledge the alarms. The problem isn't within logging the time but that the alarms are not being acknowledged at all. If you use the Read Alarms.vi and then wire the "alarms" output into the acknowledge function then it will acknowledge all of the active events (you may have to change the acknowledge type to Alarms). If you only want to acknowledge a single alarm at a time then you will need to trim down that cluster to focus on your selected alarm.
    Finally, the way you are logging to the multicolumn listbox is not functioning correctly. I would suggest you look at the DSC Alarms Demo example (Help » Find Examples... » Toolkits and Modules » Datalogging and Supervisory Control » Alarms and Events » DSC Alarms Demo.lvproj). In that example there is a subVI, which is not part of the Alarms & Events palette but probably should be, named Format Alarm Data.vi. It is used in the first three examples under that project and should work better for logging all of your alarm interaction than searching through the database.
    Regards,
    Peter W.

  • No monitors pulled for self defined logical component

    Hi,
    I have defined a system landscape in smsy and created solution landscapes in the sm. For some systems I had to create a new logical component.
    My problem: Although RFC destinations work fine, for all systems within the new logical component no monitors are pulled out of rz20.
    If I use a SAP-defined logical component it works.
    I use Solution Manager 3.2.
    Is there any documentation for this problem or does anybody know a solution for this?
    Thank you and best regards,
    Tim

    Hi again,
    I thought about the problem and tried several things. The problem is not the self defined logical component. The problem is the product definition. I can`t monitor systems, which I created as product SAP ERP in smsy. The check "SAP System ..." doesn`t appear when I want to setup System Monitoring.
    Does anybody have an idea what I do wrong?
    Regards,
    Tim

  • How to delete self defined "Swatches"?

    I work with Adobe Design Std CS5 Illustrator (German version), newly installed - not migrated from an older model! - on iMac27, i7, SSD and OS X 10.8:
    German:  Ich habe viele eigene Farbpaletten (Farbfelder) unter "Benutzerdefiniert" gespeichert. Ich kann diese von dort auch laden, kann aber die überzähligen "Paletten" nicht löschen, da ich den Order "Benutzerdefiniert" oder die entsprechenden Dateien unter "Adobe Illustrator/Vorgaben/de_DE/Farbfelder (oder Swatches)/..." (Angaben gemäss Hilfe) nicht finden kann. Ich sehe nur die von Illustrator vorgegebenen Paletten. Liegt nun Illustrator Hilfe falsch oder liegt das Problem bei Apple OS X 10.8?
    English: I have created my own "Swatches" (Farbfelder) and saved (too) many of them.
    Now I want to delete the majority, but I cannot find the directory "Benutzerdefiniert" or "User created?" on the path as hinted by the Illustrator Help (German version: Adobe Illustrator/Vorgaben/de_DE/Farbfelder). I only find the various Color Collections stored during Illustrator installation.
    Are Illustrator procedures to blame - or again Apple OS X 10.8 (Mountain Lion) intricacies?
    Apple started to confuse even long term users with Snow Leopard (OS X 10.6). Every new version offered many surprises or caveats and endless calls to Apple...
    Shall I reinstall Illustrator and create the user defined "Swatches" again from the relevant Illustrator files? A sledge hammer method...

    Thank you 1.craighead, but you misunderstood. I should be more specific: as I have the German Version it is hard to find correct terms for the English Version. In the German Version the terms "Farbfelder"(Swatches) und Farbfeldbibliotheken"(Swatch Libraries) are not consistently distinguished in Illustrator Help
    What did I do? In my CS5 German Standard Version I saved self-defined Swatch libraries (Farbfeldbibliotheken) the usual way and they are obviously stored under "Benutzerdefiniert (User specified?) as suggested in Illustrator Help.
    What can I do? I can activate such self-defined Swatch Libraries.
    What is my problem? I cannot delete obsolete "Swatch Libraries" neither using the dialogs within the Swatch Window (Fenster Farbfelder) nor delete them from the subdirectory "Benutzerdefiniert" (User defined?) using Mac OS X 10.8 Finder. (Self defined Swatch Libraries are saved under "Adobe Illustrator CS5/Vorgaben/de-DE/Farbfelder/...").
    I ask again:  Did I ignore obvious possibilities? Are Illustrator procedures to blame - or again Apple OS X 10.8 (Mountain Lion) intricacies?
    I have not yet reinstalled Illustator CS again ....

  • An error occurred during Apple event processing. -43

    Every time I reboot my MacBook Pro I now get the following message.
    "An error occurred during Apple event processing. -43"
    I'm using OSX 10.6.7.
    Can anyonw help me resolve this problem?
    Dan

    Dan, are you using Adobe Photoshop Elements 9 for the Mac?
    If so, take a look at this thread:
    http://forums.adobe.com/thread/782138?decorator=print&displayFullThread=true
    Otherwise, what happens if you boot into Safe Boot? If the message doesn't occur, it might be a 3rd party startup item causing the issue, check the Login Items under your user Account under system preferences.
    Usually, the only thing that is there is the iTunes Helper, along with various printer alerters...

  • No concurrent manager is defined to process this request,so it can't be pro

    Hello Friends
    I am facing a serious problem in my production server. After Stop/Start my application I have to run cmclean.sql to active "Output Post Processing" concurrent manager.
    I have find out that when I down my application FNDLIBR does not down properly. I have put sleep time 10 minutes and I also wait 5 hours to check is it down or not but After 5 hours the process still running. To down the process I have to execute kill -9 <process id>.
    Please see the below Diagnostic message or Shutdown concurrent manger.
    No concurrent manager is defined to process this request, so it cannot be processed.
    Contact your system administrator to define a concurrent manager to process this request or to verify that existing concurrent managers have the correct specialization rules.
    This request may have to wait on one or more of the following requests to complete before it can begin execution:
    Application Version - 12.0.6
    OS - Redhat Linux (x86)
    Thanks
    Makshud

    Hi,
    No concurrent manager is defined to process this request, so it cannot be processed. See if (Note: 342932.1 - No Concurrent Manager is Defined to Process This Request on Shutdown of Managers) helps.
    Regards,
    Hussein

  • Question about self defined Application monitoring object

    Hi
    I m trying to define my own monitoring objects, but what defined in the monitored system can not appear in solution manager(4.0). I have newest version of sap-a/pi , the ST-PI is 2005_1_700, any one can drop me some lines where coulde be the problem.
    best regards

    no one use self defined application monitoring?

  • Make self defined function on ALV toolbar invisible

    Hello Experts,
    I have defined a self defined function dropdown on standard ALV toolbar on the Lead select event  and defined the function too.
    But I want at some condition the dropdown should disappear. How can I set the drop down on the ALV toolbar to invisible.
    Please suggest.
    Thanks and Best Regards,
    Sahil

    While defining the drop down, just bind the visible property to a context node attribute of type WDUI_VISIBILITY and set it based on your requirement.
    Manas Dua

Maybe you are looking for

  • EJB not published in the JNDI tree

    I am trying to deploy a simple ear file containing one ejb on to WL 9.2. The app is deploying without any problems, but the EJB is not published in the JNDI tree. When I look at the EJB's configuration through the admin console, it does indicated tha

  • Advantages of Final Cut HD over FCE?

    Can anyone tell me the advantages of FCHD over FCE? Is it worth the investment? Thanks!

  • How can I get access to Encore 2.0

    Jeff, I have tried to contact support several times about this problem, and every time they send me back to the forum, even after I link them to this post, and send them this excerpt from above: "If the software title you have purchased is affected b

  • How to call a webservice on a local network

    Dear all, I'm trying to import a webservice that is running on a computer on our local network, and i always get the "validation failed" msg  whether i pass the IP adress or the computer name as url. I did some tries: - The webservice works perfectly

  • E4200v2 - Guest Network Name: STRANGE behavior!

    on a E4200v2, the Guest Network Name is not behaving rationally! I have 2 E4200v2's, running 2.0.37, bought at same time and configured identically, including both in BRIDGE mode (access points only) and both with the 2.4ghz network name is "acme". O