本發明涉(she)(she)及(ji)數(shu)據處理領域,具體涉(she)(she)及(ji)一種光傳感(gan)通信終端的(de)升級方法、裝置、設備及(ji)存儲介質。
背景技術:
1、現(xian)有技術(shu)中對于(yu)光(guang)(guang)(guang)傳感(gan)(gan)通(tong)信(xin)終(zhong)(zhong)(zhong)(zhong)端(duan)的(de)(de)(de)升(sheng)級是(shi)通(tong)過燒錄新的(de)(de)(de)固(gu)件(jian)或軟件(jian)程序(xu)對光(guang)(guang)(guang)傳感(gan)(gan)通(tong)信(xin)終(zhong)(zhong)(zhong)(zhong)端(duan)功能進行(xing)更新和(he)擴(kuo)展實(shi)現(xian)的(de)(de)(de),在實(shi)際應(ying)用中由(you)于(yu)光(guang)(guang)(guang)傳感(gan)(gan)通(tong)信(xin)終(zhong)(zhong)(zhong)(zhong)端(duan)的(de)(de)(de)應(ying)用場景以及安(an)(an)裝場景都(dou)是(shi)在地下(xia)、管廊、水下(xia)等(deng)特殊環境(jing)(jing),導致光(guang)(guang)(guang)傳感(gan)(gan)通(tong)信(xin)終(zhong)(zhong)(zhong)(zhong)端(duan)在安(an)(an)裝后進行(xing)調試(shi)、升(sheng)級時無法直接與(yu)終(zhong)(zhong)(zhong)(zhong)端(duan)進行(xing)硬件(jian)連接,且由(you)于(yu)光(guang)(guang)(guang)傳感(gan)(gan)通(tong)信(xin)終(zhong)(zhong)(zhong)(zhong)端(duan)的(de)(de)(de)特殊安(an)(an)裝環境(jing)(jing),因此對終(zhong)(zhong)(zhong)(zhong)端(duan)本(ben)身的(de)(de)(de)結果具有較(jiao)高的(de)(de)(de)防水性(xing)能的(de)(de)(de)要求,因此不(bu)能設置較(jiao)多數量的(de)(de)(de)串口。總體而言(yan),由(you)于(yu)光(guang)(guang)(guang)傳感(gan)(gan)通(tong)信(xin)終(zhong)(zhong)(zhong)(zhong)端(duan)在光(guang)(guang)(guang)纖通(tong)訊線(xian)路中所處的(de)(de)(de)環境(jing)(jing)具有不(bu)確定性(xing),導致直接獲取(qu)光(guang)(guang)(guang)傳感(gan)(gan)通(tong)信(xin)終(zhong)(zhong)(zhong)(zhong)端(duan)并直接對硬件(jian)本(ben)身進行(xing)燒錄升(sheng)級不(bu)易(yi)實(shi)現(xian)。
技術實現思路
1、本發明的主要目(mu)的在(zai)(zai)于(yu)解決現有的光傳感通信終(zhong)端難以在(zai)(zai)特殊環境下(xia)進行(xing)基于(yu)升級包的設備(bei)升級的技術問題。
2、本發(fa)明第一方面提供(gong)了(le)一種光(guang)(guang)傳(chuan)(chuan)感通(tong)(tong)(tong)信(xin)(xin)終端的(de)升(sheng)(sheng)級(ji)(ji)方法,所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)光(guang)(guang)傳(chuan)(chuan)感通(tong)(tong)(tong)信(xin)(xin)終端用(yong)于(yu)夾持在光(guang)(guang)纜(lan)上,并(bing)對(dui)(dui)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)光(guang)(guang)纜(lan)進(jin)行(xing)擾動(dong),所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)光(guang)(guang)傳(chuan)(chuan)感通(tong)(tong)(tong)信(xin)(xin)終端僅(jin)設(she)(she)置一個通(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou),所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)通(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)用(yong)于(yu)連接(jie)(jie)外(wai)部設(she)(she)備,與所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)外(wai)部設(she)(she)備進(jin)行(xing)數(shu)據(ju)(ju)(ju)傳(chuan)(chuan)輸(shu),所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)升(sheng)(sheng)級(ji)(ji)方法包(bao)(bao)(bao)(bao)括:通(tong)(tong)(tong)過(guo)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)通(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)向(xiang)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)外(wai)部設(she)(she)備傳(chuan)(chuan)輸(shu)日(ri)志數(shu)據(ju)(ju)(ju),其中,所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)日(ri)志數(shu)據(ju)(ju)(ju)至少包(bao)(bao)(bao)(bao)括所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)光(guang)(guang)傳(chuan)(chuan)感通(tong)(tong)(tong)信(xin)(xin)終端的(de)休眠(mian)數(shu)據(ju)(ju)(ju)、運行(xing)數(shu)據(ju)(ju)(ju)、擾動(dong)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)光(guang)(guang)纜(lan)的(de)執行(xing)數(shu)據(ju)(ju)(ju)中的(de)一種;當檢(jian)測到所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)外(wai)部設(she)(she)備通(tong)(tong)(tong)過(guo)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)通(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)向(xiang)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)光(guang)(guang)傳(chuan)(chuan)感通(tong)(tong)(tong)信(xin)(xin)終端傳(chuan)(chuan)輸(shu)數(shu)據(ju)(ju)(ju)包(bao)(bao)(bao)(bao)時,停止(zhi)發(fa)送(song)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)日(ri)志數(shu)據(ju)(ju)(ju)并(bing)控制所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)通(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)切換(huan)至接(jie)(jie)收(shou)模式;通(tong)(tong)(tong)過(guo)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)通(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)接(jie)(jie)收(shou)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)數(shu)據(ju)(ju)(ju)包(bao)(bao)(bao)(bao),并(bing)對(dui)(dui)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)數(shu)據(ju)(ju)(ju)包(bao)(bao)(bao)(bao)進(jin)行(xing)解(jie)析,得到所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)數(shu)據(ju)(ju)(ju)包(bao)(bao)(bao)(bao)的(de)驗證文(wen)件(jian)(jian)和升(sheng)(sheng)級(ji)(ji)文(wen)件(jian)(jian);基(ji)于(yu)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)驗證文(wen)件(jian)(jian)判斷所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)數(shu)據(ju)(ju)(ju)包(bao)(bao)(bao)(bao)是否滿足預設(she)(she)有序條件(jian)(jian);若(ruo)滿足,則確認所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)數(shu)據(ju)(ju)(ju)包(bao)(bao)(bao)(bao)為升(sheng)(sheng)級(ji)(ji)包(bao)(bao)(bao)(bao),對(dui)(dui)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)確認為升(sheng)(sheng)級(ji)(ji)包(bao)(bao)(bao)(bao)的(de)數(shu)據(ju)(ju)(ju)包(bao)(bao)(bao)(bao)進(jin)行(xing)應(ying)答(da),并(bing)基(ji)于(yu)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)升(sheng)(sheng)級(ji)(ji)文(wen)件(jian)(jian)對(dui)(dui)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)(shu)(shu)(shu)光(guang)(guang)傳(chuan)(chuan)感通(tong)(tong)(tong)信(xin)(xin)終端進(jin)行(xing)升(sheng)(sheng)級(ji)(ji)。
3、可選的(de),在(zai)本發明(ming)第一方面的(de)第一種實現(xian)方式(shi)(shi)中(zhong),在(zai)當檢測到所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)外部(bu)設備通(tong)(tong)(tong)(tong)(tong)過所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)(kou)向(xiang)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)光(guang)傳(chuan)(chuan)感通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)終(zhong)(zhong)端(duan)傳(chuan)(chuan)輸數(shu)據(ju)(ju)包時,停止(zhi)發送所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)日志數(shu)據(ju)(ju)并控制所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)(kou)切換(huan)至(zhi)接收模式(shi)(shi)之前,還包括:設置所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)(kou)的(de)串(chuan)(chuan)口(kou)(kou)參(can)數(shu),對所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)(kou)進行(xing)初(chu)始(shi)化,并在(zai)光(guang)傳(chuan)(chuan)感通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)終(zhong)(zhong)端(duan)中(zhong)創(chuang)建數(shu)據(ju)(ju)緩沖區,其中(zhong),所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)數(shu)據(ju)(ju)緩沖區用(yong)于存儲通(tong)(tong)(tong)(tong)(tong)過通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)(kou)傳(chuan)(chuan)輸的(de)數(shu)據(ju)(ju)包;通(tong)(tong)(tong)(tong)(tong)過檢測模塊對所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)(kou)的(de)接收狀態進行(xing)監測,判斷所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)外部(bu)設備是(shi)否通(tong)(tong)(tong)(tong)(tong)過所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)串(chuan)(chuan)口(kou)(kou)向(xiang)所(suo)(suo)(suo)(suo)述(shu)(shu)(shu)光(guang)傳(chuan)(chuan)感通(tong)(tong)(tong)(tong)(tong)信(xin)(xin)終(zhong)(zhong)端(duan)傳(chuan)(chuan)輸數(shu)據(ju)(ju)包。
4、可選的(de)(de),在本(ben)發(fa)(fa)(fa)明(ming)第一方面的(de)(de)第二(er)種實現方式(shi)中,所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)當檢測(ce)到所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)外部設(she)備通(tong)過(guo)所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)信(xin)串(chuan)口向所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)光(guang)(guang)傳(chuan)(chuan)感(gan)(gan)通(tong)信(xin)終(zhong)端傳(chuan)(chuan)輸(shu)數(shu)(shu)據(ju)(ju)包(bao)時(shi)(shi),停止發(fa)(fa)(fa)送(song)(song)所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)日志數(shu)(shu)據(ju)(ju)并(bing)控(kong)制(zhi)所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)信(xin)串(chuan)口切(qie)換至(zhi)接(jie)收(shou)(shou)模式(shi),包(bao)括:當檢測(ce)到所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)外部設(she)備通(tong)過(guo)所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)信(xin)串(chuan)口向所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)光(guang)(guang)傳(chuan)(chuan)感(gan)(gan)通(tong)信(xin)終(zhong)端傳(chuan)(chuan)輸(shu)數(shu)(shu)據(ju)(ju)包(bao)時(shi)(shi),設(she)置數(shu)(shu)據(ju)(ju)包(bao)傳(chuan)(chuan)輸(shu)標(biao)志位(wei),并(bing)判斷所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)光(guang)(guang)傳(chuan)(chuan)感(gan)(gan)通(tong)信(xin)終(zhong)端是(shi)否處于發(fa)(fa)(fa)送(song)(song)狀(zhuang)態(tai);若(ruo)處于發(fa)(fa)(fa)送(song)(song)狀(zhuang)態(tai),則(ze)啟用數(shu)(shu)據(ju)(ju)緩存(cun)區,并(bing)判斷處于發(fa)(fa)(fa)送(song)(song)狀(zhuang)態(tai)下(xia)的(de)(de)光(guang)(guang)傳(chuan)(chuan)感(gan)(gan)通(tong)信(xin)終(zhong)端是(shi)否正在發(fa)(fa)(fa)送(song)(song)所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)日志數(shu)(shu)據(ju)(ju);若(ruo)正在發(fa)(fa)(fa)送(song)(song)所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)日志數(shu)(shu)據(ju)(ju),則(ze)基于所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)數(shu)(shu)據(ju)(ju)包(bao)傳(chuan)(chuan)輸(shu)標(biao)志位(wei)控(kong)制(zhi)所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)光(guang)(guang)傳(chuan)(chuan)感(gan)(gan)通(tong)信(xin)終(zhong)端停止發(fa)(fa)(fa)送(song)(song)所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)日志數(shu)(shu)據(ju)(ju),并(bing)控(kong)制(zhi)所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)(shu)通(tong)信(xin)串(chuan)口切(qie)換至(zhi)接(jie)收(shou)(shou)模式(shi)。
5、可選(xuan)的(de),在本發明第(di)一方(fang)(fang)面的(de)第(di)三種實現方(fang)(fang)式中(zhong),所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)通過所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)通信串口接收所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)數據(ju)(ju)包(bao)(bao),并對所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)數據(ju)(ju)包(bao)(bao)進行解析(xi),得到所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)數據(ju)(ju)包(bao)(bao)的(de)驗(yan)(yan)證(zheng)文(wen)件和升(sheng)級(ji)文(wen)件,包(bao)(bao)括(kuo):通過所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)通信串口接收所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)數據(ju)(ju)包(bao)(bao),并提取所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)數據(ju)(ju)包(bao)(bao)的(de)數據(ju)(ju)負(fu)載,其中(zhong),所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)數據(ju)(ju)負(fu)載包(bao)(bao)括(kuo)數據(ju)(ju)包(bao)(bao)的(de)解析(xi)方(fang)(fang)式和校(xiao)驗(yan)(yan)字段(duan);基于所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)校(xiao)驗(yan)(yan)字段(duan)對所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)數據(ju)(ju)包(bao)(bao)進行完整性校(xiao)驗(yan)(yan),并在校(xiao)驗(yan)(yan)結果(guo)為(wei)數據(ju)(ju)包(bao)(bao)完整時,基于所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)解析(xi)方(fang)(fang)式對所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)數據(ju)(ju)包(bao)(bao)進行解析(xi)分割,得到所(suo)(suo)(suo)(suo)(suo)述(shu)(shu)數據(ju)(ju)包(bao)(bao)的(de)驗(yan)(yan)證(zheng)文(wen)件和升(sheng)級(ji)文(wen)件。
6、可選的(de),在(zai)本發明(ming)第(di)一方面的(de)第(di)四種實(shi)現方式中,所述(shu)基于所述(shu)驗證文(wen)件(jian)判斷(duan)所述(shu)數據(ju)包(bao)(bao)(bao)是否滿(man)足預設有序條(tiao)件(jian),包(bao)(bao)(bao)括:從所述(shu)驗證文(wen)件(jian)中提(ti)取包(bao)(bao)(bao)頭字段(duan)和包(bao)(bao)(bao)尾(wei)字段(duan),并將所述(shu)包(bao)(bao)(bao)頭字段(duan)和所述(shu)包(bao)(bao)(bao)尾(wei)字段(duan)與(yu)預設數據(ju)包(bao)(bao)(bao)類型與(yu)包(bao)(bao)(bao)頭包(bao)(bao)(bao)尾(wei)格式的(de)對應(ying)關系表進行匹配(pei),得到匹配(pei)結(jie)(jie)果(guo);當匹配(pei)結(jie)(jie)果(guo)為(wei)第(di)一判斷(duan)結(jie)(jie)果(guo)為(wei)存在(zai)且第(di)二判斷(duan)結(jie)(jie)果(guo)為(wei)存在(zai)時(shi),確認所述(shu)數據(ju)包(bao)(bao)(bao)滿(man)足預設有序條(tiao)件(jian)。
7、可(ke)選的,在(zai)本發明第(di)一方(fang)(fang)面的第(di)五(wu)種(zhong)實現方(fang)(fang)式(shi)(shi)中(zhong),所(suo)(suo)(suo)(suo)述(shu)(shu)將(jiang)所(suo)(suo)(suo)(suo)述(shu)(shu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)頭(tou)(tou)字(zi)(zi)段(duan)和所(suo)(suo)(suo)(suo)述(shu)(shu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)尾(wei)(wei)字(zi)(zi)段(duan)與(yu)(yu)預設(she)(she)數(shu)據包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)類(lei)(lei)(lei)型(xing)與(yu)(yu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)頭(tou)(tou)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)尾(wei)(wei)格(ge)式(shi)(shi)的對(dui)(dui)應(ying)關系(xi)表(biao)進(jin)行(xing)匹(pi)配(pei),得到(dao)(dao)匹(pi)配(pei)結(jie)果(guo),包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)括:將(jiang)所(suo)(suo)(suo)(suo)述(shu)(shu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)頭(tou)(tou)字(zi)(zi)段(duan)與(yu)(yu)預設(she)(she)數(shu)據包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)類(lei)(lei)(lei)型(xing)與(yu)(yu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)頭(tou)(tou)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)尾(wei)(wei)格(ge)式(shi)(shi)的對(dui)(dui)應(ying)關系(xi)表(biao)中(zhong)的包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)頭(tou)(tou)格(ge)式(shi)(shi)進(jin)行(xing)匹(pi)配(pei),判斷(duan)所(suo)(suo)(suo)(suo)述(shu)(shu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)頭(tou)(tou)格(ge)式(shi)(shi)中(zhong)是否存(cun)在(zai)所(suo)(suo)(suo)(suo)述(shu)(shu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)頭(tou)(tou)字(zi)(zi)段(duan),得到(dao)(dao)第(di)一判斷(duan)結(jie)果(guo);將(jiang)所(suo)(suo)(suo)(suo)述(shu)(shu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)尾(wei)(wei)字(zi)(zi)段(duan)與(yu)(yu)預設(she)(she)數(shu)據包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)類(lei)(lei)(lei)型(xing)與(yu)(yu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)頭(tou)(tou)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)尾(wei)(wei)格(ge)式(shi)(shi)的對(dui)(dui)應(ying)關系(xi)表(biao)中(zhong)的包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)尾(wei)(wei)格(ge)式(shi)(shi)進(jin)行(xing)匹(pi)配(pei),判斷(duan)所(suo)(suo)(suo)(suo)述(shu)(shu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)尾(wei)(wei)格(ge)式(shi)(shi)中(zhong)是否存(cun)在(zai)所(suo)(suo)(suo)(suo)述(shu)(shu)包(bao)(bao)(bao)(bao)(bao)(bao)(bao)(bao)尾(wei)(wei)字(zi)(zi)段(duan),得到(dao)(dao)第(di)二判斷(duan)結(jie)果(guo);整個所(suo)(suo)(suo)(suo)述(shu)(shu)第(di)一判斷(duan)結(jie)果(guo)和所(suo)(suo)(suo)(suo)述(shu)(shu)第(di)二判斷(duan)結(jie)果(guo),得到(dao)(dao)匹(pi)配(pei)結(jie)果(guo)。
8、可選的(de),在本發(fa)(fa)明第一(yi)方(fang)面的(de)第六種(zhong)實現方(fang)式中,所(suo)(suo)述(shu)(shu)(shu)(shu)確認所(suo)(suo)述(shu)(shu)(shu)(shu)數(shu)據(ju)包(bao)(bao)(bao)(bao)為升(sheng)(sheng)級(ji)(ji)包(bao)(bao)(bao)(bao),對所(suo)(suo)述(shu)(shu)(shu)(shu)確認為升(sheng)(sheng)級(ji)(ji)包(bao)(bao)(bao)(bao)的(de)數(shu)據(ju)包(bao)(bao)(bao)(bao)進行應(ying)答,包(bao)(bao)(bao)(bao)括(kuo):確認滿足預設有序(xu)(xu)條件的(de)數(shu)據(ju)包(bao)(bao)(bao)(bao)為升(sheng)(sheng)級(ji)(ji)包(bao)(bao)(bao)(bao),并提取所(suo)(suo)述(shu)(shu)(shu)(shu)升(sheng)(sheng)級(ji)(ji)包(bao)(bao)(bao)(bao)中的(de)包(bao)(bao)(bao)(bao)序(xu)(xu)號和(he)包(bao)(bao)(bao)(bao)總(zong)數(shu),基于所(suo)(suo)述(shu)(shu)(shu)(shu)包(bao)(bao)(bao)(bao)序(xu)(xu)號和(he)所(suo)(suo)述(shu)(shu)(shu)(shu)包(bao)(bao)(bao)(bao)總(zong)數(shu)判(pan)斷(duan)所(suo)(suo)述(shu)(shu)(shu)(shu)升(sheng)(sheng)級(ji)(ji)包(bao)(bao)(bao)(bao)是否(fou)發(fa)(fa)送完(wan)畢;若是,則提取所(suo)(suo)述(shu)(shu)(shu)(shu)升(sheng)(sheng)級(ji)(ji)包(bao)(bao)(bao)(bao)對應(ying)的(de)應(ying)答包(bao)(bao)(bao)(bao),并將所(suo)(suo)述(shu)(shu)(shu)(shu)應(ying)答包(bao)(bao)(bao)(bao)通(tong)過所(suo)(suo)述(shu)(shu)(shu)(shu)通(tong)信串(chuan)口發(fa)(fa)送至所(suo)(suo)述(shu)(shu)(shu)(shu)外部(bu)設備,對所(suo)(suo)述(shu)(shu)(shu)(shu)升(sheng)(sheng)級(ji)(ji)包(bao)(bao)(bao)(bao)進行應(ying)答。
9、本發明第二方(fang)面提供了一(yi)種(zhong)光傳感通信(xin)終(zhong)(zhong)端的升級裝置(zhi),所(suo)述(shu)(shu)光傳感通信(xin)終(zhong)(zhong)端用于夾持在光纜上,并對所(suo)述(shu)(shu)光纜進(jin)行擾(rao)動(dong),所(suo)述(shu)(shu)光傳感通信(xin)終(zhong)(zhong)端僅設置(zhi)一(yi)個通信(xin)串口,所(suo)述(shu)(shu)通信(xin)串口用于連(lian)接外部設備(bei),與所(suo)述(shu)(shu)外部設備(bei)進(jin)行數據傳輸(shu),所(suo)述(shu)(shu)裝置(zhi)包括:
10、傳(chuan)(chuan)輸模塊,用于通(tong)過(guo)所(suo)述通(tong)信串口向所(suo)述外部設(she)備傳(chuan)(chuan)輸日志數(shu)據(ju),其中,所(suo)述日志數(shu)據(ju)至少包括所(suo)述光傳(chuan)(chuan)感通(tong)信終端的(de)(de)休眠數(shu)據(ju)、運(yun)行數(shu)據(ju)、擾動所(suo)述光纜的(de)(de)執行數(shu)據(ju)中的(de)(de)一種;
11、切換模(mo)(mo)塊,用于(yu)當檢測到(dao)所述(shu)外部設(she)備通(tong)(tong)(tong)過所述(shu)通(tong)(tong)(tong)信串口(kou)向所述(shu)光傳感通(tong)(tong)(tong)信終端傳輸數(shu)據(ju)包時,停止(zhi)發送所述(shu)日(ri)志數(shu)據(ju)并控制所述(shu)通(tong)(tong)(tong)信串口(kou)切換至接(jie)收模(mo)(mo)式;
12、解析模塊,用于(yu)通過所述通信串口接收(shou)所述數(shu)據包(bao),并對所述數(shu)據包(bao)進行(xing)解析,得到所述數(shu)據包(bao)的驗(yan)證文(wen)件和(he)升(sheng)級文(wen)件;
13、判斷模塊,用于基于所述驗證文件判斷所述數據包是否滿足預設有序(xu)條件;
14、應答(da)模塊,用于若滿足,則確認所述數(shu)據(ju)包(bao)(bao)為(wei)升(sheng)級(ji)包(bao)(bao),對所述確認為(wei)升(sheng)級(ji)包(bao)(bao)的數(shu)據(ju)包(bao)(bao)進(jin)行應答(da),并基于所述升(sheng)級(ji)文件對所述光傳感通信(xin)終端(duan)進(jin)行升(sheng)級(ji)。
15、可選地,在本(ben)發明第二方面的第一種(zhong)實現方式中(zhong),所述(shu)切換(huan)模(mo)塊包括:
16、狀(zhuang)(zhuang)態(tai)確定單元,用于(yu)(yu)當檢測(ce)到所述(shu)外部設(she)(she)備通(tong)(tong)過所述(shu)通(tong)(tong)信(xin)串(chuan)口向所述(shu)光傳(chuan)感通(tong)(tong)信(xin)終(zhong)端(duan)傳(chuan)輸數據包(bao)時(shi),設(she)(she)置(zhi)數據包(bao)傳(chuan)輸標志(zhi)位,并判斷(duan)所述(shu)光傳(chuan)感通(tong)(tong)信(xin)終(zhong)端(duan)是(shi)否處于(yu)(yu)發(fa)送狀(zhuang)(zhuang)態(tai);若處于(yu)(yu)發(fa)送狀(zhuang)(zhuang)態(tai),則啟(qi)用數據緩存(cun)區(qu),并判斷(duan)處于(yu)(yu)發(fa)送狀(zhuang)(zhuang)態(tai)下的光傳(chuan)感通(tong)(tong)信(xin)終(zhong)端(duan)是(shi)否正在(zai)發(fa)送所述(shu)日志(zhi)數據;
17、控制(zhi)(zhi)單元,用于若正在發(fa)送所(suo)述(shu)日志數據(ju),則基于所(suo)述(shu)數據(ju)包傳輸(shu)標志位控制(zhi)(zhi)所(suo)述(shu)光傳感通信終端停(ting)止發(fa)送所(suo)述(shu)日志數據(ju),并控制(zhi)(zhi)所(suo)述(shu)通信串口切換至接收模式。
18、可選地,在本發明第二方(fang)面的(de)第二種實現方(fang)式中,所述切(qie)換模塊還包括(kuo):
19、初始(shi)化(hua)單元,用于設(she)置所(suo)(suo)述通信(xin)串口的串口參數,對(dui)所(suo)(suo)述通信(xin)串口進行(xing)初始(shi)化(hua),并在光(guang)傳感通信(xin)終端中創建數據緩(huan)沖區,其(qi)中,所(suo)(suo)述數據緩(huan)沖區用于存儲通過(guo)通信(xin)串口傳輸的數據包(bao);通過(guo)檢測模塊對(dui)所(suo)(suo)述通信(xin)串口的接收狀態進行(xing)監測,判斷所(suo)(suo)述外部設(she)備是否通過(guo)所(suo)(suo)述通信(xin)串口向(xiang)所(suo)(suo)述光(guang)傳感通信(xin)終端傳輸數據包(bao)。
20、可選(xuan)地,在(zai)本發明第二(er)方面的(de)第三種(zhong)實(shi)現(xian)方式中,所(suo)述解析模塊(kuai)包括(kuo):
21、接收單元(yuan),用(yong)于通過(guo)所述(shu)通信(xin)串口接收所述(shu)數(shu)(shu)據包(bao),并提取(qu)所述(shu)數(shu)(shu)據包(bao)的數(shu)(shu)據負(fu)載,其中(zhong),所述(shu)數(shu)(shu)據負(fu)載包(bao)括數(shu)(shu)據包(bao)的解(jie)析方式(shi)和校(xiao)驗字段;
22、校驗(yan)單元,用于基于所(suo)述(shu)(shu)校驗(yan)字段對所(suo)述(shu)(shu)數據包(bao)(bao)進行(xing)完整性(xing)校驗(yan),并在校驗(yan)結果為數據包(bao)(bao)完整時,基于所(suo)述(shu)(shu)解析方式對所(suo)述(shu)(shu)數據包(bao)(bao)進行(xing)解析分割,得到所(suo)述(shu)(shu)數據包(bao)(bao)的驗(yan)證文(wen)件(jian)和升級文(wen)件(jian)。
23、可(ke)選地,在(zai)本發明(ming)第(di)二(er)方面的第(di)四種實現方式中(zhong),所述(shu)判斷模塊包括:
24、匹(pi)配單元,用于(yu)從(cong)所(suo)述驗(yan)證(zheng)文(wen)件中提取包(bao)頭字段和包(bao)尾(wei)字段,并將所(suo)述包(bao)頭字段和所(suo)述包(bao)尾(wei)字段與(yu)預設數據包(bao)類型與(yu)包(bao)頭包(bao)尾(wei)格式的對應關系(xi)表進(jin)行匹(pi)配,得到匹(pi)配結(jie)果;
25、確(que)認(ren)單(dan)元(yuan),用于當匹配結果(guo)為第一判(pan)斷結果(guo)為存(cun)在且第二判(pan)斷結果(guo)為存(cun)在時(shi),確(que)認(ren)所述數據(ju)包(bao)滿足(zu)預設(she)有序條件(jian)。
26、可(ke)選地(di),在(zai)(zai)本(ben)發明(ming)第二(er)方(fang)面的第五種實現方(fang)式(shi)(shi)(shi)(shi)中(zhong)(zhong),所(suo)(suo)述匹(pi)配(pei)單元(yuan)具體用于:將所(suo)(suo)述包(bao)(bao)(bao)(bao)頭(tou)字段(duan)與(yu)預設(she)數據(ju)包(bao)(bao)(bao)(bao)類(lei)型(xing)與(yu)包(bao)(bao)(bao)(bao)頭(tou)包(bao)(bao)(bao)(bao)尾格式(shi)(shi)(shi)(shi)的對應(ying)(ying)關系表中(zhong)(zhong)的包(bao)(bao)(bao)(bao)頭(tou)格式(shi)(shi)(shi)(shi)進行匹(pi)配(pei),判(pan)(pan)斷(duan)(duan)(duan)所(suo)(suo)述包(bao)(bao)(bao)(bao)頭(tou)格式(shi)(shi)(shi)(shi)中(zhong)(zhong)是否(fou)存(cun)在(zai)(zai)所(suo)(suo)述包(bao)(bao)(bao)(bao)頭(tou)字段(duan),得(de)(de)到第一判(pan)(pan)斷(duan)(duan)(duan)結果(guo);將所(suo)(suo)述包(bao)(bao)(bao)(bao)尾字段(duan)與(yu)預設(she)數據(ju)包(bao)(bao)(bao)(bao)類(lei)型(xing)與(yu)包(bao)(bao)(bao)(bao)頭(tou)包(bao)(bao)(bao)(bao)尾格式(shi)(shi)(shi)(shi)的對應(ying)(ying)關系表中(zhong)(zhong)的包(bao)(bao)(bao)(bao)尾格式(shi)(shi)(shi)(shi)進行匹(pi)配(pei),判(pan)(pan)斷(duan)(duan)(duan)所(suo)(suo)述包(bao)(bao)(bao)(bao)尾格式(shi)(shi)(shi)(shi)中(zhong)(zhong)是否(fou)存(cun)在(zai)(zai)所(suo)(suo)述包(bao)(bao)(bao)(bao)尾字段(duan),得(de)(de)到第二(er)判(pan)(pan)斷(duan)(duan)(duan)結果(guo);整個所(suo)(suo)述第一判(pan)(pan)斷(duan)(duan)(duan)結果(guo)和所(suo)(suo)述第二(er)判(pan)(pan)斷(duan)(duan)(duan)結果(guo),得(de)(de)到匹(pi)配(pei)結果(guo)。
27、可選地,在本(ben)發明第(di)二方面的(de)第(di)六種實現方式中,所述應答模塊(kuai)包括:
28、提取(qu)單元,用于確認滿足預(yu)設有序(xu)條件的數據包(bao)為升(sheng)級(ji)(ji)包(bao),并提取(qu)所(suo)述升(sheng)級(ji)(ji)包(bao)中的包(bao)序(xu)號和(he)包(bao)總數,基于所(suo)述包(bao)序(xu)號和(he)所(suo)述包(bao)總數判(pan)斷所(suo)述升(sheng)級(ji)(ji)包(bao)是否發送(song)完畢;
29、發送單元,用于若是(shi),則提取所(suo)(suo)述升級包(bao)對(dui)應的應答包(bao),并將(jiang)所(suo)(suo)述應答包(bao)通過所(suo)(suo)述通信(xin)串口發送至所(suo)(suo)述外部設(she)備,對(dui)所(suo)(suo)述升級包(bao)進(jin)行應答。
30、本發明的(de)第三方(fang)面(mian)提供了一種光傳(chuan)感(gan)(gan)(gan)通(tong)信終(zhong)(zhong)端(duan)(duan)的(de)升(sheng)(sheng)級設(she)備(bei)(bei),所述(shu)(shu)光傳(chuan)感(gan)(gan)(gan)通(tong)信終(zhong)(zhong)端(duan)(duan)的(de)升(sheng)(sheng)級設(she)備(bei)(bei)包(bao)括存(cun)(cun)儲器和至(zhi)少一個處(chu)理器,所述(shu)(shu)存(cun)(cun)儲器中(zhong)存(cun)(cun)儲有指(zhi)令;所述(shu)(shu)至(zhi)少一個處(chu)理器調用所述(shu)(shu)存(cun)(cun)儲器中(zhong)的(de)所述(shu)(shu)指(zhi)令,以使得所述(shu)(shu)光傳(chuan)感(gan)(gan)(gan)通(tong)信終(zhong)(zhong)端(duan)(duan)的(de)升(sheng)(sheng)級設(she)備(bei)(bei)執行如上(shang)所述(shu)(shu)的(de)光傳(chuan)感(gan)(gan)(gan)通(tong)信終(zhong)(zhong)端(duan)(duan)的(de)升(sheng)(sheng)級方(fang)法。
31、本(ben)發明的(de)第四方面提供(gong)了一種計(ji)算機(ji)可(ke)讀(du)存儲(chu)介(jie)質,所述(shu)計(ji)算機(ji)可(ke)讀(du)存儲(chu)介(jie)質上(shang)存儲(chu)有指(zhi)令,所述(shu)指(zhi)令被處理器執(zhi)行時實現如上(shang)所述(shu)光傳(chuan)感通(tong)信終端的(de)升級方法。
32、本發明(ming)提供的(de)(de)技術方(fang)案(an)中(zhong),當光傳(chuan)感(gan)通(tong)(tong)(tong)(tong)信(xin)終端(duan)檢測到(dao)有數(shu)據(ju)包(bao)(bao)(bao)通(tong)(tong)(tong)(tong)過通(tong)(tong)(tong)(tong)信(xin)串口傳(chuan)輸時(shi),控制通(tong)(tong)(tong)(tong)信(xin)串口切(qie)換至接(jie)收(shou)模式;通(tong)(tong)(tong)(tong)過通(tong)(tong)(tong)(tong)信(xin)串口接(jie)收(shou)數(shu)據(ju)包(bao)(bao)(bao),并(bing)對(dui)(dui)數(shu)據(ju)包(bao)(bao)(bao)進(jin)行解析,得到(dao)數(shu)據(ju)包(bao)(bao)(bao)的(de)(de)驗證文件(jian)和(he)升(sheng)級(ji)(ji)文件(jian);基(ji)于(yu)(yu)驗證文件(jian)判斷數(shu)據(ju)包(bao)(bao)(bao)是否滿(man)足預(yu)設有序(xu)條(tiao)件(jian);若滿(man)足,則確(que)認數(shu)據(ju)包(bao)(bao)(bao)為(wei)升(sheng)級(ji)(ji)包(bao)(bao)(bao),對(dui)(dui)確(que)認為(wei)升(sheng)級(ji)(ji)包(bao)(bao)(bao)的(de)(de)數(shu)據(ju)包(bao)(bao)(bao)進(jin)行應(ying)答,并(bing)基(ji)于(yu)(yu)升(sheng)級(ji)(ji)文件(jian)進(jin)行升(sheng)級(ji)(ji)包(bao)(bao)(bao)括。本方(fang)案(an)通(tong)(tong)(tong)(tong)過預(yu)先設置(zhi)升(sheng)級(ji)(ji)包(bao)(bao)(bao)的(de)(de)數(shu)據(ju)包(bao)(bao)(bao)格(ge)式,從而確(que)認接(jie)收(shou)到(dao)的(de)(de)數(shu)據(ju)包(bao)(bao)(bao)是否為(wei)升(sheng)級(ji)(ji)包(bao)(bao)(bao),實(shi)現對(dui)(dui)升(sheng)級(ji)(ji)包(bao)(bao)(bao)的(de)(de)判定(ding),并(bing)實(shi)現了(le)在當前光傳(chuan)感(gan)通(tong)(tong)(tong)(tong)信(xin)終端(duan)中(zhong)通(tong)(tong)(tong)(tong)過發送日志的(de)(de)串口接(jie)收(shou)升(sheng)級(ji)(ji)包(bao)(bao)(bao),降(jiang)低了(le)光傳(chuan)感(gan)通(tong)(tong)(tong)(tong)信(xin)終端(duan)的(de)(de)升(sheng)級(ji)(ji)成本,提高了(le)光傳(chuan)感(gan)通(tong)(tong)(tong)(tong)信(xin)終端(duan)的(de)(de)升(sheng)級(ji)(ji)效率和(he)便捷(jie)性。