def execute(self, userdata): rospy.loginfo("Informing Fire Department...............") no_of_people_need_assistance = ImageCreator(location_list=userdata.location_list, origin=IMAGE_ORIGIN, scale=RESOLUTION, image_name=IMAGE_NAME, pkg_path=PKG_PATH, image_path=IMAGE_PATH, fire_location=userdata.location_of_fire) create_pdf(PKG_PATH + '/config/', no_of_people_need_assistance) print "PDF CREATED in " + PKG_PATH + '/config/reem3.pdf' rospy.loginfo("Copying file to %s/reem3.pdf" % self.pendrive_location) shutil.copy(PKG_PATH + '/config/' + "reem3.pdf", self.pendrive_location + '/reem3.pdf') rospy.loginfo("Fire department informed successfully !!!!") return succeeded
def execute(self, userdata): print "Informing Fire Department..............." ImageCreator( location_list=userdata.location_list, origin=IMAGE_ORIGIN, scale=RESOLUTION, image_name=IMAGE_NAME, pkg_path=PKG_PATH, image_path=IMAGE_PATH, ) create_pdf(PKG_PATH + "/config/") print "PDF CREATED..............." mail_sender( "*****@*****.**", "Emergency Situation", "Location attached", PKG_PATH + "/config/" + "reem2.pdf" ) print "MAIL SENT................" return "succeeded"
def create_pdf(): #Takes a message from RapidPro or wherever, returns a pdf (Which is currently being written to the resources dir, but Where will it ultimately go?) message = request.args.get("message") try: pdf_file_path = pdf_creator.create_pdf(message) send_fax_app(pdf_file_path) return render_template("index.html", file_path=pdf_file_path, response_message="Pdf successfully created with text: " + message) except: return render_template("index.html", response_message="Failed to create pdf.")