Skip to content

hikouki/qitalk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

qitalk

qimessaging.js framework on Pepper

Dependencies

  • qimessaging.js v2.0+
  • jQuery

Features

  • cache services
  • view html templete
  • switch html templete on single page

Usage

Example

  • index.html
<script src="/lib/jquery/jquery.min.js"></script>
<script src="/libs/qimessaging/2/qimessaging.js"></script>
<script src="js/qitalk.js"></script>
<script>
$(function() {
   Qitalk.init({
     host    : '', // pepper host. default => localhost
     root    : '#qitalk',
     tplDir  : './tpl',
     preload : {
       tpl     : ['home', 'profile'],
       service : ['ALMemory', 'ALTextToSpeech']
     },
     handle : {
       start : function() {
         Qitalk.presentView('home'); // switch html templete.
       }
     }
   });
});
</script>
<body>
   <div id="qitalk">
   </div>
</body>
  • ./tpl/home.tpl
<script>
$(function() {
  $("#nextpage").on('click', function() {
    var username = $("input['name=username']").val();
    Qitalk.presentView('profile', username); // send value for next page.
  });
});
</script>
<input type="text" name="username" />
<input id="nextpage" type="button" value="go to profile page.">
  • ./tpl/profile.tpl
<script>
var params = Qitalk.params; // get value for prev page.
$(function() {
  $("#username").text(params);
});
</script>
<p id="username"></p>

How to call services

It must cache service.

///
preload : {
       tpl     : ['home', 'profile'],
       service : ['ALMemory', 'ALTextToSpeech']
},
///

Service is called from Qitalk.proxy property.

Qitalk.proxy.ALTextToSpeech.say('I am pepper');

Wrap qimessaging APIs

  • Qitalk.on(name, function, id) // Recive signal to tablet from pepper.
  • Qitalk.send(name, value) // Send signal to pepper from tablet.

License

MIT