我正在开发一个黑莓应用程序。这个应用程序已经在“Basic4Android”程序中在Android中开发。android 应用程序的代码是用 vb.net 编写的。我需要为 BlackBerry 编写完全相同的代码。我试图理解这种方法,但我无法理解,因为我不是 vb.net 的专家。我不会粘贴整个方法,而只会粘贴我需要澄清的部分:
Sub HEX_T24_SHORT_GPS(latitude_decimal_degrees As Double, longitude_decimal_degrees As Double, speed_knots As Int, heading_degrees As Int, time_seconds_since_midnight_gmt As Int, alert_on As Boolean, alert_ack As Boolean, external_interface_control As Boolean, send_extended As Boolean) As String
Dim pBuffer(11) As Int
pBuffer(0)=0 ' T24 MSGID 0
Log("pBuffer(2)" & pBuffer(2))
Dim t1 As Double
'Get latitude sign
Dim lat_south As Boolean
lat_south=True
If latitude_decimal_degrees<0 Then lat_south=False
'Get Longitude sign
Dim lon_west As Boolean
lon_west=True
If longitude_decimal_degrees<0 Then lon_west=False
'Get number of second since midnigh extra bit
Dim num_of_second_extra_bit As Boolean
num_of_second_extra_bit=False
If time_seconds_since_midnight_gmt > 0xFFFF Then num_of_second_extra_bit=True
'Convert latitude in bytes 1 to 3
latitude_decimal_degrees = Abs(latitude_decimal_degrees*60000)
“如果 time_seconds_since_midnight_gmt > 0xFFFF”是什么意思?这里发生了什么“latitude_decimal_degrees = Abs(latitude_decimal_degrees*60000)”。我检查了“Basic4Android”文档,但找不到 Abs API。
If num_of_second_extra_bit=True Then latitude_decimal_degrees=latitude_decimal_degrees + 0x800000
pBuffer(1)=Bit.ShiftRight(Bit.And(latitude_decimal_degrees, 0xFF0000),16)
pBuffer(2)=Bit.ShiftRight(Bit.And(latitude_decimal_degrees, 0x00FF00),8)
pBuffer(3)=Bit.And(latitude_decimal_degrees, 0xFF)
位移是如何应用的?在 int 和 hex 值之间使用“AND”运算吗?pBuffer(1) 的最终值是多少?步骤 pBuffer(1) 到 pBuffer(3) 的目的是什么。它在做什么,latitude_decimal_degrees的最终值是多少?最终值是字节,字节数组还是十六进制?请解释一下。