def congrats(user_id): print("letting friends know you finished an activity") pub = PUB(network_topic, user_id + ":" + 'finish') client = pub.connect_mqtt() client.loop_start() pub.publish_text(client) client.disconnect()
def exercise_breathe(user_id): reminder_topic = '/' + user_id + '/reminders' print("calling breathing exercise") pub = PUB(reminder_topic, 'breathe') client = pub.connect_mqtt() client.loop_start() pub.publish_text(client) client.disconnect()
def reminder_handler(): print('reminder:' + classifier_action) #send gesture key over broker pub=PUB(imu_topic, 'Reminder:' + classifier_action) client = pub.connect_mqtt() client.loop_start() pub.publish_text(client) client.disconnect()
def activate(user_id): reminder_topic = '/' + user_id + '/reminders' print("send message to LED Matrix") pub = PUB(reminder_topic, 'reminder') client = pub.connect_mqtt() client.loop_start() pub.publish_text(client) client.disconnect() print("waiting for IMU activation")
def send_msg(self, *args): audio_topic = '/' + self.a.dest_user + '/audio/' + self.a.userID txt_topic = '/' + self.a.dest_user + '/text/' + self.a.userID audio_path = self.a.speech_instance.get_audiopath() txt_path = self.a.speech_instance.get_txtpath() pub = PUB(audio_topic, "hello from audio") client = pub.connect_mqtt() client.loop_start() pub.publish_file(client, audio_path) client.disconnect() pub = PUB(txt_topic, self.a.dest_user + 'hello from txt') client = pub.connect_mqtt() client.loop_start() pub.publish_file(client, txt_path) client.disconnect() Clock.schedule_once(self.update_screen_completed)
def send_msg(self, *args): if self.a.dest_user == 'all': audio_topic = '/team2/network/audio/' + self.a.userID txt_topic = '/team2/network/text/' + self.a.userID else: audio_topic = '/' + self.a.dest_user + '/audio/' + self.a.userID txt_topic = '/' + self.a.dest_user + '/text/' + self.a.userID audio_path = self.a.speech_instance.get_audiopath() txt_path = self.a.speech_instance.get_txtpath() pub = PUB(audio_topic, "hello from audio") client = pub.connect_mqtt() client.loop_start() pub.publish_file(client, audio_path) client.disconnect() pub = PUB(txt_topic, self.a.dest_user + 'hello from txt') client = pub.connect_mqtt() client.loop_start() pub.publish_file(client, txt_path) client.disconnect() Clock.schedule_once(self.switch_congrats)