def get_data_for_bluetooth(self): """ Prepare OutputData for voice. Generate the message for a Notification. Return BluetoothOutputData for sending. """ logger.info("starting get_data_for_bluetooth() in Notification") data = BluetoothOutputData() data.bluetooth_mac_address = self.bluetooth_mac_address data.server_address = self.bluetooth_server_address logger.info("Sending to Bluetooth Mac Address " + data.bluetooth_mac_address + " and Bluetooth Server " + data.server_address) try: self.hospital except Hospital.DoesNotExist: self.hospital = Hospital.get_current_hospital() content = self.reminder_text() uid = vcal.get_uid() data.data = vcal.create_vcal_string(self.date, self.hospital, content, uid) logger.info("Created vCal with uid %s" % str(uid)) logger.debug("Created vCal: " + data.data) return data
def test_send_bluetoothoutputobject(self): data = "test" mac = "1234" server_address = "127" bluetoothoutput = BluetoothOutputData() bluetoothoutput.data = data bluetoothoutput.bluetooth_mac_address = mac bluetoothoutput.server_address = server_address def send_vcal1(server_address2, mac2, data2): self.assertEquals(server_address2, server_address) self.assertEquals(mac2, mac) self.assertEquals(data2, data) send_vcal_old = bluetooth.send_vcal bluetooth.send_vcal = send_vcal1 bluetoothoutput.send() bluetooth.send_vcal = send_vcal_old