proc seg_strip { args } {
global HciConnName
set mode [keylget args MODE]
switch -exact — $mode {
start {
return “”
}
run {
set mh [keylget args MSGID]
set msgLIST [split [msgget $mh] r]
set dispList
#set msgLIST [split [msgget $mh] r]
set newmsg {}
set nmh {}
set nmsg {}
set counter 0
foreach msg $msgLIST {
set VAR [string range $msg 0 2]
if {[string equal $VAR BTS] || [string equal $VAR BHS] ||
[string equal $VAR FTS]} {
#DO nothing!
} elseif {[string equal $VAR MSH]} {
if {$counter > 0} {
# means you encounter start of new message so time to build the message
# join your newmsg list with r and do the set nmh [msgcopy $mh] and msgset # and lappend for dispList
set nmh [msgcopy $mh]
set nmsg [join $newmsg r]
msgset $nmh $nmsg
lappend newmsg $msg
incr counter
} else {
set nmh [msgcopy $mh]
set nmsg
lappend newmsg $msg
incr counter
}
} else {
lappend newmsg $msg
}
}
# join your newmsg list with r and do the set nmh [msgcopy $mh] and msgset and lappend for dispList
set nmh [msgcopy $mh]
set nmsg [join $newmsg r]
msgset $nmh $nmsg
lappend dispList “CONTINUE $nmh”
}
return $dispList
}
}
shutdown {
return “”
}
}