Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
twatteyne committed Sep 22, 2014
2 parents 22c4a54 + af48be6 commit 3193cb6
Show file tree
Hide file tree
Showing 267 changed files with 28,423 additions and 13,400 deletions.
19 changes: 19 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto

# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.css text
*.html text
*.java text
*.js text
*.md text
*.py text
*.tmpl text
*.txt text
SCons* text

# Denote all files that are truly binary and should not be modified.
*.gif binary
*.jar binary
*.png binary
22 changes: 14 additions & 8 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
*.log
*.log.1
*.log.2
*.log.3
*.log.4
*.log.5
*.pyc
__pycache__
*.log
*.log.1
*.log.2
*.log.3
*.log.4
*.log.5
*.pyc
__pycache__
.sconsign.dblite
test_report_*.xml


*.vcd
/software/openApps/ietf90client/*.config
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: python
python:
- "2.7"

# Install dependencies
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq python-tk
install: pip install -r requirements.txt --use-mirrors

# Whitelist
#branches:
# only:
# - develop

# Command to run tests
script:
- cd software/openvisualizer/
- scons unittests
- scons docs
22 changes: 18 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
openwsn-sw
==========

OpenWSN software: stuff that runs on a computer
OpenWSN software: stuff that runs on a computer.

Part of UC Berkeley's OpenWSN project, http://www.openwsn.org/.

Build status
------------

| builder | build | outcome
| ------------------------------------------------------------------------------------ | --------------------- | -------
| [Travis](https://travis-ci.org/openwsn-berkeley/openwsn-sw) | unit tests | [![Build Status](https://travis-ci.org/openwsn-berkeley/openwsn-sw.png?branch=develop)](https://travis-ci.org/openwsn-berkeley/openwsn-sw)
| [OpenWSN builder](http://builder.openwsn.org/job/OpenVisualizer%20Unit%20Tests/) | unit tests | [![Build Status](http://builder.openwsn.org/buildStatus/icon?job=OpenVisualizer Unit Tests)](http://builder.openwsn.org/job/OpenVisualizer%20Unit%20Tests/)
| [OpenWSN builder](http://builder.openwsn.org/job/OpenVisualizer%20Docs/) | build documentation | [![Build Status](http://builder.openwsn.org/buildStatus/icon?job=OpenVisualizer Docs)](http://builder.openwsn.org/job/OpenVisualizer%20Docs/)
| [OpenWSN builder](http://builder.openwsn.org/job/OpenVisualizer%20Docs%20Publisher/) | publish documentation | [![Build Status](http://builder.openwsn.org/buildStatus/icon?job=OpenVisualizer Docs Publisher)](http://builder.openwsn.org/job/OpenVisualizer%20Docs%20Publisher/)


Documentation
-------------

- overview: https://openwsn.atlassian.net/wiki/
- source code: http://openwsn-berkeley.github.io/openvisualizer/
4 changes: 4 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
pyserial==2.6
PyDispatcher==2.0.3
bottle==0.11.6
Sphinx==1.1.3
94 changes: 47 additions & 47 deletions software/installtest/test_python_installation.py
Original file line number Diff line number Diff line change
@@ -1,47 +1,47 @@
import sys

boiler = "================================\n"
boiler += "Python installation test script \n"
boiler += "Thomas Watteyne, August 2010 \n"
boiler += "================================"
print boiler

#================== Python

print "\nTesting Python...",
print "works!"

#================== PySerial

print "\nTesting PySerial...",

try:
import serial
except:
err = sys.exc_info()
sys.stderr.write("Error: %s (%s) \n" % (str(err[0]), str(err[1])))
else:
print "works!"

#================== TkInter

print "\nTesting TkInter...",

def releaseAndQuit():
root.quit()
sys.exit()

try:
import Tkinter
root=Tkinter.Tk()
root.title("Testing TkInter")
root.protocol("WM_DELETE_WINDOW",releaseAndQuit)
root.resizable(0,0)
except:
err = sys.exc_info()
sys.stderr.write("Error: %s (%s) \n" % (str(err[0]), str(err[1])))
else:
print "works!\n(make sure you can see the window titled \"Testing TkInter\")"

raw_input("\nPress return to close this window...")
import sys

boiler = "================================\n"
boiler += "Python installation test script \n"
boiler += "Thomas Watteyne, August 2010 \n"
boiler += "================================"
print boiler

#================== Python

print "\nTesting Python...",
print "works!"

#================== PySerial

print "\nTesting PySerial...",

try:
import serial
except:
err = sys.exc_info()
sys.stderr.write("Error: %s (%s) \n" % (str(err[0]), str(err[1])))
else:
print "works!"

#================== TkInter

print "\nTesting TkInter...",

def releaseAndQuit():
root.quit()
sys.exit()

try:
import Tkinter
root=Tkinter.Tk()
root.title("Testing TkInter")
root.protocol("WM_DELETE_WINDOW",releaseAndQuit)
root.resizable(0,0)
except:
err = sys.exc_info()
sys.stderr.write("Error: %s (%s) \n" % (str(err[0]), str(err[1])))
else:
print "works!\n(make sure you can see the window titled \"Testing TkInter\")"

raw_input("\nPress return to close this window...")

119 changes: 119 additions & 0 deletions software/openApps/6tusCli/sixtusCli.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@



'''
Created on 02/05/2013
@author: xvilajosana
'''
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('sixtusCli')
log.setLevel(logging.DEBUG)
log.addHandler(NullHandler())


import sys
import os
import threading

if __name__=='__main__':
cur_path = sys.path[0]
sys.path.insert(0, os.path.join(cur_path, '..', '..','..','..','coap','coap')) # coap/
sys.path.insert(0, os.path.join(cur_path, '..', '..','openvisualizer','eventBus','PyDispatcher-2.0.3'))# PyDispatcher-2.0.3/
sys.path.insert(0, os.path.join(cur_path, '..', '..', 'openCli')) # openCli/


from OpenCli import OpenCli

from sixtusCoap import sixtusCoap

class sixtusCli(OpenCli):


def __init__(self):

# initialize parent class
OpenCli.__init__(self,"6tus client",self.quit_cb)

self.sixtusCoap = sixtusCoap()
# add commands
# 1415:923b::009e 7 2 0 11
self.registerCommand('create_link',
'c',
'create a link',
['dst_url','target_addr','slot_num','slot_type','shared','ch_offset'],
self._handlerCreateLink)

self.registerCommand('update_link',
'u',
'updates a link',
['dst_url','target_addr','slot_num','slot_type','shared','ch_offset'],
self._handlerUpdateLink)

# add commands
self.registerCommand('read_link',
'r',
'reads a link from the schedule',
['dst_url','target_addr','slot_num',],
self._handlerReadLink)
# add commands
self.registerCommand('delete_link',
'd',
'deletes a link from the schedule',
['dst_url','target_addr','slot_num',],
self._handlerDeleteLink)



#example query from terminal: c BBBB::1415:920b:0301:00f2 BBBB::1415:920b:0301:00e9 7 2 0 11
def _handlerCreateLink(self,params):
print 'CREATE_LINK: ' + ' '.join(params)
log.debug('CREATE_LINK: ' + ' '.join(params))
self.sixtusCoap.CREATE_LINK(params[0],params[1],params[2],params[3],params[4],params[5])

def _handlerUpdateLink(self,params):
print 'UPDATE_LINK: ' + ' '.join(params)
log.debug('UPDATE_LINK: ' + ' '.join(params))
self.sixtusCoap.UPDATE_LINK(params[0],params[1],params[2],params[3],params[4],params[5])

#the url will look like coap://[2001:0470:48b8:aaaa:1415:920b:0301:00e9]:5683/6tus/1/1/1415923b0000009e/3
#the command to issue: r BBBB::1415:923b:0301:00e9 1415:923b::009e 7
def _handlerReadLink(self,params):
print 'READ_LINK: ' + ' '.join(params)
log.debug('READ_LINK: ' + ' '.join(params))
self.sixtusCoap.READ_LINK(params[0],params[1],params[2])


def _handlerDeleteLink(self,params):
print 'DELETE_LINK: ' + ' '.join(params)
log.debug('DELETE_LINK: ' + ' '.join(params))
self.sixtusCoap.DELETE_LINK(params[0],params[1],params[2])
#===== helpers

def quit_cb(self):
print "quit"

#this initializes everything
def main():

cli = sixtusCli()
cli.start()

#============================ application logging =============================
import logging
import logging.handlers
logHandler = logging.handlers.RotatingFileHandler('sixtusCli.log',
maxBytes=2000000,
backupCount=5,
mode='w')
logHandler.setFormatter(logging.Formatter("%(asctime)s [%(name)s:%(levelname)s] %(message)s"))
for loggerName in ['sixtusCli','sixtusCoap']:
temp = logging.getLogger(loggerName)
temp.setLevel(logging.DEBUG)
temp.addHandler(logHandler)

if __name__=="__main__":
main()
Loading

0 comments on commit 3193cb6

Please sign in to comment.