Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

41
LINES

< > BotCompany Repo | #1019073 // Sensory Status [Dyn Module - Internet, Visual, Audio]

JavaX source code (Dynamic Module) [tags: use-pretranspiled] - run with: Stefan's OS

Libraryless. Click here for Pure Java version (14693L/102K).

1  
!7
2  
3  
module SensoryStatus > DynModule {
4  
  transient L<SingleComponentPanel> panels;
5  
  transient volatile bool online, cam, mic;
6  
  transient ReliableSingleThread rst = dm_rst(this, r actualUpdate);
7  
  
8  
  visualize {
9  
    ret hgrid(panels = repF singleComponentPanel(3));
10  
  }
11  
  
12  
  start {
13  
    doEvery(10000, rst);
14  
    dm_afterVisualize(rst);
15  
  }
16  
  
17  
  void actualUpdate {
18  
    temp enter();
19  
    online = main.areWeOnline();
20  
    cam = dm_isWebCamLive();
21  
    mic = dm_anyIncomingAudio();
22  
    if (nempty(panels)) {
23  
      setComponent(0, jimage(online ? #1101406 : #1101405), online ?  "I have Internet" : "I am offline");
24  
      setComponent(1, jimage(cam ? #1101410 : null), cam ? "I can see!" : "I am blind");
25  
      setComponent(2, jimage(mic ? #1019081 : null), mic ? "I can hear something!" : "I can't hear anything");
26  
    }
27  
    setModuleName("Sensory Status +" + count());
28  
  }
29  
  
30  
  void setComponent(int i, JComponent c, S tooltip) {
31  
    SingleComponentPanel panel = get(panels, i);
32  
    if (panel != null) {
33  
      setToolTip(c, tooltip);
34  
      panel.setComponent(c);
35  
    }
36  
  }
37  
  
38  
  int count() {
39  
    ret addBools(online, cam, mic);
40  
  }
41  
}

download  show line numbers  debug dex  old transpilations   

Travelled to 12 computer(s): bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, irmadwmeruwu, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1019073
Snippet name: Sensory Status [Dyn Module - Internet, Visual, Audio]
Eternal ID of this version: #1019073/14
Text MD5: 6188a3b84fd275140457cd6d4b305175
Transpilation MD5: 824be8a62415086d42830b3736b144fa
Author: stefan
Category: javax / stefan's os / a.i.
Type: JavaX source code (Dynamic Module)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2018-11-07 02:39:55
Source code size: 1171 bytes / 41 lines
Pitched / IR pitched: No / No
Views / Downloads: 407 / 1120
Version history: 13 change(s)
Referenced in: [show references]