【Android】Android基于ibeacon信标实现蓝牙考勤功能,利用蓝牙信标做一款打卡软件,Android与服务器的蓝牙考勤系统
创始人
2025-01-18 00:03:35
0次

文章目录

  • 一、android开发
  • 二、服务器接口与gradio开发
  • 三、gradio前端界面展示
  • 问询、帮助

需要开发三部分的程序:

在这里插入图片描述

一、android开发

当手机的蓝牙开启并靠近ibeacon设备时,设备会主动发送蓝牙信号。
手机接收到这个信号后,根据ibeacon设备的UUID、major、minor和MAC这四个参数,就可以确认是哪一台ibeacon设备。然后,手机调用服务器上的考勤接口(注意:ibeacon设备只用于确认手机在考勤机附近,不会发送考勤数据到设备本身),这样就可以实现蓝牙考勤了。

android-beacon-library:

https://altbeacon.github.io/android-beacon-library/

android stdio
在这里插入图片描述

考虑和大众android手机的版本,选低一点的:

在这里插入图片描述
在AndroidManifest.xml文件中添加蓝牙、定位以及文件读取和写入权限的静态权限,可以按照以下格式进行:

                                                                                                                                                      

设计界面:

在这里插入图片描述

二、服务器接口与gradio开发

fastapi接口:

  @app.post("/check_in") def check_in_student(student: Student):     conn = connect_to_database('dakax.db')     result = check_in(conn, student.name, student.student_id)     close_connection(conn)     ret = {"status": "success", "message": "学生签到成功"} if result else {"status": "error", "message": "请联系老师添加学生信息"}     return ret   @app.post("/delete_student_record") def delete_student_record(student: Student):     try:         conn = connect_to_database('dakax.db')         delete_record(conn, student.name, student.student_id)         close_connection(conn)     except:         return {"status": "error", "message": "学生记录删除失败"}     return {"status": "success", "message": "学生记录删除成功"}   @app.post("/insert_student_record") def insert_student_record(student: Student):     try:         conn = connect_to_database('dakax.db')         ret = insert_record(conn, student.name, student.student_id)         close_connection(conn)         if ret:             return {"status": "success", "message": "学生记录新增成功"}         else:             return {"status": "error", "message": "学生记录已存在,无法新增"}      except:         return {"status": "error", "message": "学生记录新增失败"}   

gradio:

 def create_gradio():     with gr.Blocks() as demo:         gr.Markdown("# 蓝牙考勤打卡系统")         with gr.Tab("签到统计信息"):             with gr.Row():                 o1, o2 = checkin_data()                 with gr.Column():                     output_txt = gr.Textbox(label="签到人数/总人数:", value=o1)                 with gr.Column():                     output_pil_img = gr.Image(label="统计图", type="pil", value=o2)             with gr.Row():                 checkin_button = gr.Button("刷新")             checkin_button.click(checkin_data, [], [output_txt, output_pil_img])         with gr.Tab("查看学生"):             with gr.Row():                 with gr.Column():                     # gr.DataFrame                     output = gr.DataFrame(label="全部学生信息", value=update_data())                     update_button = gr.Button("刷新")                     update_button.click(update_data, [], output)         with gr.Tab("添加学生"):             with gr.Row():                 with gr.Column():                     add_name = gr.Textbox(label="姓名", value="请输入姓名")                     add_student_id = gr.Textbox(label="学号", value="请输入学号")                     output = gr.Textbox(label="log")                     add_button = gr.Button("添加")                     add_button.click(add_student, [add_name, add_student_id], output)         with gr.Tab("删除学生"):             with gr.Row():                 with gr.Column():                     delete_name = gr.Textbox(label="姓名", value="请输入姓名")                     delete_student_id = gr.Textbox(label="学号", value="请输入学号")                     output = gr.Textbox(label="log")                     delete_button = gr.Button("删除")                     delete_button.click(delete_student, [delete_name, delete_student_id], output)     return demo 

三、gradio前端界面展示

打开web graio界面就可以操作:

在这里插入图片描述

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述

问询、帮助

你如果需要帮助,请看这里:

https://docs.qq.com/sheet/DUEdqZ2lmbmR6UVdU?tab=BB08J2 

相关内容

热门资讯

每日必看!江岸多玩到底能开挂吗... 每日必看!江岸多玩到底能开挂吗(辅助挂),江岸多玩原来真的有辅助挂讲义1、江岸多玩脚本辅助下载、江岸...
玩家交流!颖河竞技怎么开挂(外... 玩家交流!颖河竞技怎么开挂(外挂),颖河竞技好像是有外挂教材一、颖河竞技游戏安装教程牌型概率发牌机制...
最新通报!皮皮四川麻将软件下载... 最新通报!皮皮四川麻将软件下载(辅助挂),皮皮四川麻将果然有辅助挂模块1、操作简单,无需皮皮四川麻将...
一分钟揭秘!52游戏开挂脚本(... 一分钟揭秘!52游戏开挂脚本(透视挂),52游戏切实有透视挂法子52游戏脚本下载中分为三种模型:52...
一分钟快速了解!堆堆乐开挂破解... 一分钟快速了解!堆堆乐开挂破解(外挂),堆堆乐竟然真的有外挂方针1、下载好堆堆乐正确养号方法之后点击...
重大通报!汇城贵州麻将开挂脚本... 重大通报!汇城贵州麻将开挂脚本(开挂),汇城贵州麻将原来真的有开挂法门1、重大通报!汇城贵州麻将开挂...
盘点一款!七色城透视挂件(外挂... 盘点一款!七色城透视挂件(外挂),七色城切实是真的有外挂经验1、全新机制【七色城ai辅助工具激活码】...
今日头条!多多休闲透视软件下载... 今日头条!多多休闲透视软件下载(外挂),多多休闲确实是真的有外挂攻略1、首先打开多多休闲辅助器下载最...
关于!钱柜麻将真的有透视吗(辅... 关于!钱柜麻将真的有透视吗(辅助器),钱柜麻将一贯是有辅助器练习钱柜麻将能透视中分为三种模型:钱柜麻...
今日焦点!河北家乡棋牌辅助工具... 今日焦点!河北家乡棋牌辅助工具(外挂),河北家乡棋牌果然是有外挂手册小薇(辅助器软件下载)致您一封信...