def publishData(self,idstr, datastr, fidbv=None, strtg=None): '''Publishes Data with LID''' if(fidbv): lidarray = array.array('B', '\0' * (self.bvsize / 8)) bitvectoruint32t = self.bvsize / 4 start = 0 for i in range(0, bitvectoruint32t): datachunk = 0x00000000 currentCycle = 32*(bitvectoruint32t - i) - 1 for j in range(0, 32): if(fidbv[currentCycle-j] == 1): datachunk = datachunk | (1 << j) lidarray = self.add_FID_long_base(lidarray, start, datachunk) start = start + 4 baddernetlink.baddersend(sockfd=self.sockfd,type=self.PUBLISH_DATA, idlen=(len(idstr)/8), id=idstr.tostring(), pidlen=0, prefixid=None, strategy=strtg , LID=lidarray.tostring(), data=datastr) else: baddernetlink.baddersend(sockfd=self.sockfd,type=PUBLISH_DATA, idlen=(len(idstr)/8), id=idstr, pidlen=0, prefixid=None, strategy=0, LID=None, data=datastr)
def startPublish(self, scopeid, prefixidstr, strtg, lidstr=None): '''Publishes Actions only''' baddernetlink.baddersend(sockfd=self.sockfd, type=START_PUBLISH, idlen=(len(scopeid)/8), id=scopeid, pidlen=(len(prefixid)/8), prefixid=prefixidstr, strategy=strtg, LID=lidstr, data=None)
def unsubscribeScope(self, scopeid, prefixidstr, strtg, lidstr=None): '''Publishes Actions only''' baddernetlink.baddersend(sockfd=self.sockfd, type=UNSUBSCRIBE_SCOPE, idlen=(len(scopeid)/8), id=scopeid, pidlen=(len(prefixid)/8), prefixid=prefixidstr, strategy=strtg, LID=lidstr, data=None)
def unpublishInfo(self, scopeid, prefixidstr, strtg, lidstr=None): '''Publishes Actions only''' baddernetlink.baddersend(sockfd=self.sockfd, type=UNPUBLISH_INFO, idlen=(len(scopeid)/8), id=scopeid, pidlen=(len(prefixid)/8), prefixid=prefixidstr, strategy=strtg, LID=lidstr, data=None)
def publishScope(self, scopeid, prefixidstr, strtg, lidstr=None): '''Publishes Scope''' baddernetlink.baddersend(sockfd=self.sockfd, type=PUBLISH_SCOPE, idlen=(len(scopeid)/8), id=scopeid, pidlen=(len(prefixid)/8), prefixid=prefixidstr, strategy=strtg, LID=lidstr, data=None)
def publishActionLID(self,atype, scopeid, prefixidstr, strtg, lidstr): '''Publishes Actions only''' baddernetlink.baddersend(sockfd=self.sockfd, type=atype, idlen=(len(scopeid)/8), id=scopeid, pidlen=(len(prefixid)/8), prefixid=prefixidstr, strategy=strtg, LID=lidstr, data=None)
def send(self,mtype,idlength,idstr,prefixlen,prefixidstr,strtg,lidlength,lidstr,datalen,datastr): '''A raw version of send - probably it will never be used''' baddernetlink.baddersend(sockfd=self.sockfd,type=mtype, idlen=(idlength/8), id=idstr, pidlen=(prefixlen/8), prefixid=prefixidstr, strategy=strtg, LID=lidstr, data=datastr)