vb.net code为Android应用 [英] vb.net code for Android app

查看:178
本文介绍了vb.net code为Android应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的黑莓应用程序。这个应用程序已经开发在Android中的Basic4Android计划。在code为Android应用程序是用在vb.net。我需要写完全相同的code黑莓。我想了解这个方法,但我不能,因为我不是vb.net的专家。我不会粘贴整个方法,但只是部分,我需要澄清:

 子HEX_T24_SHORT_GPS(latitude_decimal_degrees为DOUBLE,longitude_decimal_degrees作为双,speed_knots如int,heading_degrees如int,time_seconds_since_midnight_gmt如int,alert_on由于布尔,alert_ack为布尔,external_interface_control为布尔,send_extended由于布尔)作为字符串
    昏暗的pbuffer(11)为int
    的pbuffer(0)= 0'T24 MSGID 0
    日志(的pbuffer(2)与& pbuffer的(2))
    昏暗的T1作为双
    '获取纬度标志
    昏暗lat_south由于布尔
    lat_south = TRUE
    如果latitude_decimal_degrees℃,然后lat_south =假
    '获取经度标志
    昏暗lon_west由于布尔
    lon_west = TRUE
    如果longitude_decimal_degrees℃,然后lon_west =假
    获得第二的人数自midnigh额外的位
    昏暗num_of_second_extra_bit由于布尔
    num_of_second_extra_bit =假
    如果time_seconds_since_midnight_gmt> 0xFFFF的那么num_of_second_extra_bit = TRUE
    以字节为单位1'转换纬度3
    latitude_decimal_degrees = ABS(latitude_decimal_degrees * 60000)

什么是如果time_seconds_since_midnight_gmt> 0xFFFF的呢?这里发生了什么latitude_decimal_degrees = ABS(latitude_decimal_degrees * 60000)。我查了Basic4Android文档,但无法找到绝对的API。

 如果num_of_second_extra_bit = TRUE,则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和十六进制值之间用AND操作?什么是pbuffer的(1)终值?什么是步骤pbuffer的目的(1)的pbuffer(3)。这是什么做的,什么是latitude_decimal_degrees的终值?以字节,字节数组或十六进制的最终价值?请解释。


解决方案

  

什么是如果time_seconds_since_midnight_gmt> 0xFFFF的呢?


这样做是检查是否time_seconds_since_midnight_gmt超过65,535更大 - 这可能是某种补偿 - 记得有86400秒一天


  

这是怎么发生的latitude_decimal_degrees =
  ABS(latitude_decimal_degrees * 60000)


纬度的小数部分乘以60,000 - 这是基于什么回事pretty很多方面 - 它可能有话跟你在移动的速度 - 你应该考虑在哪里这个功能从打电话揣摩什么号码范围是进入这个变量,然后尝试从推断出这一点。


  

如何在应用移位?


首先从0x800000添加(这是设置位23号的高点)


  

是一个int和十六进制值之间用AND操作?


是的。好像你混的事情了 - 一个整数值2进制(二进制),基数8(八进制),底座10(通常的方式),并以16为基数(十六进制)被repesented - 它仍然是相同的值


  

什么是pbuffer的(1)终值?请解释一下。


好吧 - 让我们通过一个例子来运行:

latitude_decimal_degrees = 0xE653(58963)

然后添加的0x800000

纬度= 0x80E653

然后,用为0xFF0000

纬度=从0x800000

和16终于右移

纬度= 0x000080

这意味着,另一方面是什么,是为你的内部pretation。

I am working on a BlackBerry app. This app has already been developed in Android in "Basic4Android" program. The code for the android app is written in vb.net. I need to write the exact same code for BlackBerry. I am trying to understand this method but I am unable to since I am not an expert with vb.net. I will not paste the entire method but only parts which I need to clarify:

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)

What does "If time_seconds_since_midnight_gmt > 0xFFFF" mean? What is happening here "latitude_decimal_degrees = Abs(latitude_decimal_degrees*60000)". I checked the "Basic4Android" documentation but could not find the 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)

How is the bit shift applied? Is the "AND" operation used between an int and hex value? What is the final value in pBuffer(1)? What is the purpose of steps pBuffer(1) to pBuffer(3). What is it doing and what is the final value of latitude_decimal_degrees?Is the final value in bytes, byte array or hex?Please explain.

解决方案

What does "If time_seconds_since_midnight_gmt > 0xFFFF" mean?

What this does is checking if the time_seconds_since_midnight_gmt is bigger than 65,535 - this is probably some sort of compensation - remember there's 86,400 seconds in a day.

What is happening here "latitude_decimal_degrees = Abs(latitude_decimal_degrees*60000)"

The decimal part of the latitude is being multiplied by 60,000 - this is pretty much context based what's going on - it's probably has something to do with the speed you are moving in - you should look into where this function is called from and try to figure out what the number range is that is going into this variable, and then try to deduce it from that.

How is the bit shift applied?

First 0x800000 is added (this is setting bit number 23 high)

Is the "AND" operation used between an int and hex value?

Yes. It seems like you're mixing things up - an integer value can be repesented in base 2 (binary), base 8 (octal), base 10(the usual way) and base 16 (hexadecimal) - it's still the same value.

What is the final value in pBuffer(1)? Please explain.

Okay - let's run through an example:

latitude_decimal_degrees = 0xE653 (58,963)

then add 0x800000

latitude = 0x80E653

then and with 0xFF0000

latitude = 0x800000

and finally right shift by 16

latitude = 0x000080

What this means on the other hand, is up for your interpretation.

这篇关于vb.net code为Android应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆