【正文】
(TAG, Service discovery started)。 } @Override public void onServiceFound(NsdServiceInfo service) { // A service was found! Do something with it (TAG, Service discovery success + service)。 if (!().equals(SERVICE_TYPE)) { // Service type is the string containing the protocol and // transport layer for this service. (TAG, Unknown Service Type: + ())。 } else if (().equals(mServiceName)) { // The name of the service tells the user what they39。d be // connecting to. It could be Bob39。s Chat App. (TAG, Same machine: + mServiceName)。 } else if (().contains(NsdChat)){ 25 (service, mResolveListener)。 } @Override public void onServiceLost(NsdServiceInfo service) { // When the work service is no longer available. // Internal bookkeeping code goes here. (TAG, service lost + service)。 } @Override public void onDiscoveryStopped(String serviceType) { (TAG, Discovery stopped: + serviceType)。 } @Override public void onStartDiscoveryFailed(String serviceType, int errorCode) { (TAG, Discovery failed: Error code: + errorCode)。 (this)。 } @Override public void onStopDiscoveryFailed(String serviceType, int errorCode) { (TAG, Discovery failed: Error code: + errorCode)。 (this)。 } 公文處理的實(shí)現(xiàn) 系統(tǒng)能實(shí)時(shí)的接收內(nèi)部 OA系統(tǒng)發(fā)來(lái)的公文清單,歸類到 “待辦公文 ”中,當(dāng)公文處理完畢后,將公文歸類到 “已辦事項(xiàng) ”目錄中。如下圖所示: 26 圖 237待辦公文列表 圖 238已辦公文列表 與郵件不同,公文以文件的傳遞為主,處理選定公文后,服務(wù) 器將會(huì)把公文的狀態(tài)更改為 “處理中 ”狀態(tài),手機(jī)客戶端根據(jù)用戶的選擇從服務(wù)器下載相關(guān)的公文(權(quán)限允許的情況下),在當(dāng)前用戶處理完公文前,其他用戶不允許下載處理該公文。打開(kāi)公文后,可以在附件中查看公文的內(nèi)容,然后對(duì)公文作兩種形式的處理。 一是 “領(lǐng)導(dǎo)批示 ” 指的是使用客戶端的用戶角色為領(lǐng)導(dǎo)時(shí),可以對(duì)公文進(jìn)行批示,二是 “相關(guān)意見(jiàn) ”可以填寫(xiě)有關(guān)意見(jiàn),改變公文的審批狀態(tài)。對(duì)公文進(jìn)行批示后將批示信息反饋到服務(wù)器,服務(wù)器會(huì)將對(duì)應(yīng)公文的的批示狀態(tài)信息會(huì)改變。 239公文查看 240領(lǐng)導(dǎo)批示 241發(fā)送文件 公文處理的實(shí)現(xiàn)的主要代碼如下: public void initializeResolveListener() { 27 mResolveListener = new () { @Override public void onResolveFailed(NsdServiceInfo serviceInfo, int errorCode) { // Called when the resolve fails. Use the error code to debug. (TAG, Resolve failed + errorCode)。 } @Override public void onServiceResolved(NsdServiceInfo serviceInfo) { (TAG, Resolve Succeeded. + serviceInfo)。 if (().equals(mServiceName)) { (TAG, Same IP.)。 return。 } mService = serviceInfo。 int port = ()。 IAddress host = ()。 } protected void onPause() { if (mNsdHelper != null) { ()。 } ()。 } @Override protected void onResume() { ()。 if (mNsdHelper != null) { (())。 ()。 } @Override protected void onDestroy() { ()。 ()。 28 ()。 } // NsdHelper39。s tearDown method public void tearDown() { (mRegistrationListener)。 (mDiscoveryListener)。 } 公文查看 可以查看公文的詳細(xì)內(nèi)容和公文的審批過(guò)程。當(dāng)一個(gè)教師使用手機(jī)客戶端對(duì)公文進(jìn)行處理后,信息反饋到服務(wù)器是,對(duì)這份公文的相關(guān)數(shù)據(jù)庫(kù)的字段就會(huì)更新,另外一個(gè)用戶如果在更新后下載這份公文進(jìn)行處理,就會(huì)得到最新的公文審批信息。 242公文詳細(xì)情況 243公文審批記錄 實(shí)現(xiàn)公文查詢的主要代碼如下: @Override public void onReceive(Context context, Intent intent) { String action = ()。 if ((action)) { // Determine if Wifi Direct mode is enabled or not, alert // the Activity. int state = (, 1)。 if (state == ) { (true)。 } else { 29 (false)。 } } else if ((action)) { // The peer list has changed! We should probably do something about // that. } else if ((action)) { // Connection state changed! We should probably do something about // that. } else if ((action)) { DeviceListFragment fragment = (DeviceListFragment) () .findFragmentById()。 ((WifiP2pDevice) ( ))。 } } 30 第 三 章 系統(tǒng)測(cè)試 本軟件的開(kāi)發(fā)比預(yù)期中延遲了一個(gè)星期。原因主要是對(duì)編碼階段所需的時(shí)間估計(jì)不準(zhǔn)確。這主要由于在某些技術(shù)上的問(wèn)題在設(shè)計(jì)過(guò)程中沒(méi)有考慮到,導(dǎo)致在編碼過(guò)程中需要花一些時(shí)間去考慮所遇到技術(shù)的問(wèn)題延遲了完成的時(shí)間。 開(kāi)發(fā)過(guò)程團(tuán)隊(duì)配合,因?yàn)榻M員不在學(xué)校,在溝通配合方面給了我們很大的挑戰(zhàn),其次編碼的不熟悉,經(jīng)常要查資料,花費(fèi)時(shí)間巨大。 完善軟件。對(duì)各個(gè)模塊進(jìn)行測(cè)試,確保各個(gè)模塊正常運(yùn)作。 試 用例目標(biāo) 測(cè)試登錄模塊是否正常運(yùn)作 需求描述 正常登陸