本文整理汇总了Python中pyndn.Name.appendTimestamp方法的典型用法代码示例。如果您正苦于以下问题:Python Name.appendTimestamp方法的具体用法?Python Name.appendTimestamp怎么用?Python Name.appendTimestamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyndn.Name
的用法示例。
在下文中一共展示了Name.appendTimestamp方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from pyndn import Name [as 别名]
# 或者: from pyndn.Name import appendTimestamp [as 别名]
def main():
seg = 0
if len(sys.argv) < 3:
print("argv error: please input capture or capture with #seg")
exit(1)
elif len(sys.argv) == 2:
cmd = sys.argv[1]
else:
cmd = sys.argv[1]
seg = sys.argv[2]
loop = asyncio.get_event_loop()
#face = ThreadsafeFace(loop, "localhost")
face = Face("localhost")
# Counter will stop the ioService after callbacks for all expressInterest.
counter = Counter(loop, 3)
seed = HMACKey(0,0,"seed","seedName")
# Try to fetch anything.
import time
r = time.time()
name1 = Name("/home/security/camera/0/"+cmd)
name1.appendTimestamp(int(r))
name1.appendSegment(int(seg))
interest = Interest(name1)
interest.setInterestLifetimeMilliseconds(3000)
dump("Express name ", interest.toUri())
face.expressInterest(interest, counter.onData, counter.onTimeout)
"""
name2 = Name("/home/sensor/LED/T0829374723/turnOff")
dump("Express name ", name2.toUri())
face.expressInterest(name2, counter.onData, counter.onTimeout)
"""
while counter._callbackCount < 1:
face.processEvents()
# We need to sleep for a few milliseconds so we don't use 100% of the CPU.
time.sleep(2)
face.shutdown()