Exemplo n.º 1
0
	def __init__(self, dyio, index):
		self._dyio = dyio
		self.index = index
		self.org,self.lib,self.ver,self.name = None,None,None,None
	
	@staticmethod
	def parse_id(id):
		match = re.match(Namespace._ID_RE,id)
		org,lib,ver = match.groups()
		name = "{org}.{lib}".format(org=org,lib=lib)
		return org,lib,ver,name
	
	def send(self, func, args=[], priority=31, state=False, async=False, encrypted=False):		
		datagram = bowler.build_datagram(self._dyio.mac,func,args,priority,state,async,encrypted,self.index)
		bowler.send_datagram(self._dyio.port,datagram)
	
	# RETURN: func, args, priority, state, async, dir, encrypted
	def receive(self):
		return bowler.receive_datagram(self._dyio.port)

class BcsCore(Namespace):
	def __init__(self, dyio):
		Namespace.__init__(self,dyio,0)

		id = self.get_namespace_id(0)
		self.org,self.lib,self.ver,self.name = Namespace.parse_id(id)

	def ping(self):
		self.send("_png")
		try:
Exemplo n.º 2
0
# FOR TESTING PURPOSES ONLY
from dyio import DyIO
import bowler

func = "_rev"
args = []

dyio = DyIO("COM3","74:F7:26:80:00:4F")
datagram = bowler.build_datagram(dyio.mac,func,args=args)
bowler.send_datagram(dyio.port,datagram)
func,args,priority,state,async,dir,encrypted = bowler.receive_datagram(dyio.port)

for byte in args:
	print hex(byte)