- 獨立型:充放電控制器、蓄電池
- 直流負載
- 交流負載:離網型逆變器
- 市電併聯型 (Grid Connected):把電力公司的供電系統當成是蓄電池。可併接內線或外線。併聯型逆變器
- 餘電躉售
- 全額躉售
- 混合型
2020年12月26日 星期六
太陽光電發電系統 Solar System
2020年12月25日 星期五
藍牙
藍牙 5.2 新功能「LE Audio」(低功率音訊),可利用低功耗藍牙 (LE) 無線電波來傳輸音訊。
- 廣播
LC3 音訊編解碼器可以在每秒 160kb 的數據速率下提供極高品質的音訊,品質卻高於數據速率為每秒 345kb 的SBC編解碼器,意味著更省電,可以創造電池壽命更長或外形尺寸更小的設備。
真無線耳機 (True Wireless Stereo, TWS) 與智慧音箱。https://www.2cm.com.tw/2cm/zh-tw/tech/BD9B8456964D47A6A6DDD8B3ADB03A87
具備 LE Audio 功能的 TWS 耳機堅固耐用且延遲較低。LE Audio 可以執行音訊分享 (Audio Sharing) 功能,多個裝置可以連接同一個聲音來源,能夠從公共資源接取音訊串流,例如等候室或戲院、劇場或者會議室等場所的電視,甚至可以選擇自己母語的資料串流。
空中飛鼠- Targus 虛擬雷射簡報器 AMP38GL-50 $1999 $2064 $2575 $2580
- Hawk R310 空中飛鼠無線簡報器 (非藍牙)
- 觸控鍵盤
- 手機可作為遙控器?
2020年12月19日 星期六
SIP NOTIFY
SIP Method NOTIFY 讓遠端有事件時提供 notification 。
RFC6665 向前相容並 obsolete RFC3265,並稍微更新 RFC4660。
能夠 request asynchronous notification of events 提供用處 in many types of SIP services for which cooperation between end-nodes is required. Note, however, that event packages based on this framework may define arbitrarily elaborate rules that govern the subscription and notification for the events or classes of events they describe. "event packages" in Section 5.
應用
- automatic callback services (based on terminal state events)
- buddy lists (based on user presence events)
- 留言通知 (MWI,message waiting indications)
- PSTN and Internet Internetworking (PINT) [RFC2848] status (based on call state events).
- 搭配 REFER
- 告知特業設定,例如註冊後告知是否有設勿干擾或轉接
典型流程是先透過 SIP SUBSCRIBE 訂閱 Event 後建立 dialog,Event 包括 resource or call state for various resources or calls。之後收到 SIP NOTIFY 並更新 dialog 狀態。
Subscriber Notifier
|-----SUBSCRIBE---->| Request state subscription
|<-------200--------| Acknowledge subscription
|<------NOTIFY----- | Return current state information
|--------200------->|
|<------NOTIFY----- | Return current state information
|--------200------->|
訂閱有逾時,由後續 SUBSCRIBE 請求續訂。
...
3.1.2. Identification of Subscribed Events and Event Classes
Event 由 Request URI、Event Type、和 (optionally) 信體識別。The Request URI of a SUBSCRIBE request contains enough information to route the request to the appropriate entity per the request routing procedures outlined in [RFC3261]. It also contains enough information to identify the resource for which event notification is desired, but not necessarily enough information to uniquely identify the nature of the event (e.g., "sip:adam@example.com" would be an appropriate URI to subscribe to for my presence state; it would also be an appropriate URI to subscribe to the state of my voice mailbox).
SUBSCRIBE 必須含有單一 Event,表示要訂閱哪個 event 或 class of events。The "Event" header field will contain a token that indicates the type of state for which a subscription is being requested. This token will be registered with the IANA and will correspond to an event package that further describes the semantics of the event or event class. If the event package to which the event token corresponds defines behavior associated with the body of its SUBSCRIBE requests, those semantics apply. Event packages may also define parameters for the "Event" header field; if they do so, they must define the semantics for such parameters.
3.1.3. Additional SUBSCRIBE Header Field Values
Because SUBSCRIBE 建立 dialog,可包含 Accept 表示後續 NOTIFY 允許的信體格式。Event packages MUST define the behavior for SUBSCRIBE requests without "Accept" header fields; usually, this will connote a single, default body type.
3.2. NOTIFY
NOTIFY 通知 subscribers 有訂閱的狀態改變。訂閱透過 SUBSCRIBE 建立,過去也透過 REFER [RFC3515] 或其它方式建立。NOTIFY 是 target refresh request。
3.2.1. Identification of Reported Events, Event Classes, and Current State
Identification of events being reported in a notification is very similar to that described for subscription to events (see Section 3.1.2). NOTIFY request "Event" MUST 包含單一 event package name for which a notification is being generated. The package name in the "Event" header field MUST match the "Event" header field in the corresponding SUBSCRIBE request. Event packages may define semantics associated with the body of their NOTIFY requests; if they do so, those semantics apply. NOTIFY request bodies are expected to provide additional details about the nature of the event that has occurred and the resultant resource state. When present, the body of the NOTIFY request MUST be formatted into one of the body formats specified in the "Accept" header field of the corresponding SUBSCRIBE request (or the default type according to the event package description, if no "Accept" header field was specified). This body will contain either the state of the subscribed resource or a pointer to such state in the form of a URI (see Section 5.4.13).
4. Node Behavior
...
8.4. Augmented BNF Definitions
SUBSCRIBEm = %x53.55.42.53.43.52.49.42.45 ; SUBSCRIBE in caps
NOTIFYm = %x4E.4F.54.49.46.59 ; NOTIFY in caps
extension-method = SUBSCRIBEm / NOTIFYm / token
Event = ( "Event" / "o" ) HCOLON event-type
*( SEMI event-param )
event-type = event-package *( "." event-template )
event-package = token-nodot
event-template = token-nodot
token-nodot = 1*( alphanum / "-" / "!" / "%" / "*"
/ "_" / "+" / "`" / "'" / "~" )
; The use of the "id" parameter is deprecated; it is included
; for backwards-compatibility purposes only.
event-param = generic-param / ( "id" EQUAL token )
Allow-Events = ( "Allow-Events" / "u" ) HCOLON event-type
*(COMMA event-type)
Subscription-State = "Subscription-State" HCOLON substate-value
*( SEMI subexp-params )
substate-value = "active" / "pending" / "terminated"
/ extension-substate
extension-substate = token
subexp-params = ("reason" EQUAL event-reason-value)
/ ("expires" EQUAL delta-seconds)
/ ("retry-after" EQUAL delta-seconds)
/ generic-param
event-reason-value = "deactivated"
/ "probation"
/ "rejected"
/ "timeout"
/ "giveup"
/ "noresource"
/ "invariant"
/ event-reason-extension
event-reason-extension = token
參考
2020年12月18日 星期五
RTCP
RTCP (Real-time Transport Control Protocol 或 RTP Control Protocol)
- 用來做 QoS 回報 (RTCP)
- 作為獨立的協定溝通 clock 的頻率,也就是用來做 Adaptive clock recovery。
每筆 RTCP 資料開始有固定的部份,和 RTP 的類似。接下來的部份會有不同長度,但都必須在 32-bit boundary 結束。固定的部份有長度欄位,讓多個 RTCP 資料可以結合到一個封包傳送。
RTCP 封包類型:
- SR (Sender Report):傳送端回報傳送和接收統計。
- header
- 「傳送資訊」
- 0 個以上「接收統計」包括
- 關聯 SSRC
- 8-bit fraction lost:期間 (上次送 SR 或 RR 後) 封包遺失率 x256
- 24-bit cumulative number of packets lost:累計遺失封包數
- 32-bit extended highest sequence number received:包含 16-bit 最後收到序號和 16-bit 累進次數。
- interarrival jitter
- last SR (LSR):最後收到的 SR timestamp
- delay since last SR (DLSR)
- profile-specific extension
- RR (Receiver Report):只接收不傳送時回報「接收統計」and in combination with SR for active senders reporting on more than 31 sources。封包格式和 SR 一樣,只是沒有「傳送資訊」。
- SDES (Source DEScription items), including CNAME
- BYE:表示結束
- APP:特殊應用功能
參考
2020年12月12日 星期六
2020年12月11日 星期五
Read-Copy-Update
Read-Copy-Update (RCU) 是 Linux kernel 一種同步讀取和更新的機制,適合大多為讀取的情況。
一個資料結構有 reader 讀取和 updater 更新,RCU 的更新是透過覆蓋指標值來把舊資料換掉。
參考
2020年12月5日 星期六
USB Signal
USB 資料訊號 D+ 和 D- 是阻抗 90Ω ±15% 的雙絞線,使用 NRZI 差動訊號,電壓準位 low 為 0.0~0.3V、high 為 2.8~3.6V。
在主機端,D+ 和 D- 用 15 kΩ pull-down,在沒驅動的時候,訊號停在所謂的 single-ended zero (SE0)
狀態,表示 reset 或 disconnected。10~20 ms SE0 表示 reset。
D+ 和 D- 其中之一為 high 有兩種情形,其中一個稱為 J,另一個為 K。
USB 採用 NRZI 編碼,toggle (J 及 K 切換) 表示 0,不變 (維持 J 或 K) 表示 1,六個
連續 1 要作 bit-stuffing,多加一個 0。
連續六個 1 時,bit stuffing 一個 0 來避免太久沒準位變動。
USB 週邊 1.5 kΩ pull high 克服主機端的 pull-down,使得 data line 停在 idle state,稱為「J」。當 D+ 及 D- 一個為 high,一個為 low 為 J 或 K 狀態。
USB 封包一開始是 8-bit synchronization sequence '00000001',也就是在 idle state J 後出現「KJKJKJKK」,最後重複的 K 表示 sync pattern
的結束、USB frame 的開始。高頻寬 USB,使用 32-bit synchronization sequence。
USB 封包的結束稱為 EOP (end-of-packet),此時傳送端驅動 2 個 SE0 和 1 個 J,然後停止驅動而停在 J
(idle) state。有時 hub 的 skew,在 EOP SE0 前多了 one bit,要忽略。
chirping 步驟:週邊先當作自己是 FS 而拉高 D+,然後收到 USB RESET 後改拉高 D− (K) 告訴主機端要用 HS。如果主機端支援 HS,會回 JK 告訴週邊端。週邊端至少要收到 3 sets of KJ chirps 才能切換到 HS。
Linux Network Block Devices
Network block devices (NBD) 是 client/server 架構,server 提供遠端儲存裝置或檔案,給 client 對應為本地裝置檔,可開機等。也可以格式化、modify or copy 整個分割,這在 NFS 是不行的,因為這些動作需要 unmount 才能進行,而 unmount 就失去連線了。
問題:NFS 似乎可以提供給多個 client 使用,而 NBD 似乎只能給一個 client 使用。
apt-get install nbd-server modprobe nbd nbd-server 9999 /dev/sda # export a device on port 9999 nbd-server 9998 vmdisk.img # export image file on port 9998Client
apt-get install nbd-client modprobe nbd-client # map remote NBD as local device nbd-client 192.168.1.100 9999 /dev/nbd0 nbd-client 192.168.1.100 9998 /dev/nbd1
然後可以 format it、可以 resize partitions、可以建立檔案系統...
問題:Server export 後,Server 可以使用嗎?
https://medium.com/@aysadx/linux-nbd-introduction-to-linux-network-block-devices-143365f1901b
https://www.kernel.org/doc/html/latest/admin-guide/blockdev/nbd.html
https://nbd.sourceforge.io/
SIP header Via
所有 SIP 訊息 都要有 Via,縮寫 v。一開始的 UAC 和後續途經的每個 proxy 都會疊加一個 Via 放傳送的位址,依序作為回應的路徑。 格式 sent-protocol sent-by [ ;branch= branch ][ ; 參數 ...] s...
-
列出目錄的檔案。 opendir(目錄) 或 fdopendir(fd) 開啟一個 directory stream (DIR),包含此目錄的所有檔案 (含目錄)。readdir(DIR *) 自 directory stream 取得一個檔案,用 struct direct ...
-
-l:輸出 Long Listing 格式,包括下列資訊: 檔案 type and permissions:有 10 個字母,第 1 個字母是 file type: -:一般檔案 b:block device c:character device d:direct...
-
APRS(Automatic Packet Reporting System)字面翻是「自動封包回報系統」,其實是「自動位置回報系統』,是業餘無線電結合全球衛星定位系統 (GPS),以 AFSK AX.25 通訊模式回報給世界各地的 APRS 接收電台,電台再透過網際網路上傳到 ...