Recipes Javascript - Thomas-S-B/Telemee GitHub Wiki
Some recipes to use telemee in Java - more to come.
Assuming telemee is running under http://localhost:8080.
1 - Include TelemeeJS and jquery in your page.
<script src="http://localhost:8080/telemee/TelemeeJS.js"></script>
<script src="http://localhost:8080/telemee/telemeeui/lib/jquery/jquery.js"></script>
2 - Put some telemee-calls into your script.
<script>
function rand(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var testApp01 = "Testapp 01";
var testChannel01 = "Testchannel 01";
var testChannelAttributeX = "X";
var testChannelAttributeY = "Y";
var testChannelAttributeZ = "Z";
var testChannelAttributeGroup = "Group";
function createTestDataForClient() {
TelemeeJS.logLevel = TelemeeJS.INFO;
TelemeeJS.forTelemeeApp(testApp01)
.forChannel(testChannel01)
.send();
TelemeeJS.startLogEntry("Testlogentry Group 01", TelemeeJS.INFO)
.forChannelAttribute(testChannelAttributeX)
.log(Date.now())
.forChannelAttribute(testChannelAttributeY)
.log(rand(0, 1000))
.forChannelAttribute(testChannelAttributeZ)
.log(rand(0, 1000))
.forChannelAttribute(testChannelAttributeGroup)
.log("Group 01")
.endLogEntry()
.send();
TelemeeJS.startLogEntry("Testlogentry Group 02", TelemeeJS.FINE)
.forChannelAttribute(testChannelAttributeX)
.log(Date.now())
.forChannelAttribute(testChannelAttributeY)
.log(rand(0, 1000))
.forChannelAttribute(testChannelAttributeZ)
.log(rand(0, 1000))
.forChannelAttribute(testChannelAttributeGroup)
.log("Group 02")
.endLogEntry()
.send();
}
</script>
3 - Run your script with the above telemee-calls and open http://localhost:8080/telemee to browse the generated data.
There is also an example in the sources: Test_IT.html