Gamepad & WSN

Tag Archives: 手柄

蓝牙HCI根据OpCode计算OCF、OGF源代码

Author:Gamepader    IN:Network    Tags: , , ,     评论: 0    超过223人围观

最近在折腾蓝牙HCI接口,苦于没有人教,自己慢慢,终于能够通上信了(HCI_Reset命令执行成功)。
鉴于不清楚那一百多个蓝牙HCI指令具体用在什么环境,特地买了个USB蓝牙CSR4.0的模块来研究学习(算是下了大本钱了 :))。
用BUS Hound抓到的部分数据如下:

1
2
3
4
5
6
7
8
9
10
11
18.0 CTL 20 00 00 00 00 00 03 00 SEND HCI 5.1.0
18.0 OUT 03 0c 00 ... 5.2.0
18.1 IN 0e 04 01 03 0c 00 ...... 6.1.0
18.0 CTL 20 00 00 00 00 00 03 00 SEND HCI 7.1.0
18.0 OUT 05 10 00 ... 7.2.0
18.1 IN 0e 0b 01 05 10 00 36 01 40 0a 00 08 00 [email protected] 8.1.0
18.0 CTL 20 00 00 00 00 00 03 00 SEND HCI 9.1.0
18.0 OUT 01 10 00 ... 9.2.0
18.1 IN 0e 0c 01 01 10 00 06 bb 22 06 0a 00 bb 22 ........"...." 10.1.0
18.0 CTL 20 00 00 00 00 00 03 00 SEND HCI 11.1.0
18.0 OUT 02 10 00 ... 11.2.0

但是鉴于以下两点,不方便拆分具体的OCF和OGF。

    1.蓝牙HCI命令使用小端格式(Little-Endian)
    2.OGF占6 bits、OCF占10 bits。

想到用一个比较简单的数据结构来实现拆分:

1
2
3
4
5
6
7
8
typedef union _opcode_t_
{
    unsigned int opcod;
    struct {
        unsigned short ocf :10;
        unsigned short ogf :6;
    } op;
} opcode_t;

附上C++程序源代码如下(由于功能简单,代码相对简单,勿喷):
蓝牙HCI根据OpCode计算OCF、OGF源代码:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#include <stdio .h>

typedef union _opcode_t_
{
    unsigned int opcod;
    struct {
        unsigned short ocf :10;
        unsigned short ogf :6;
    } op;
} opcode_t;

opcode_t HCI_OpCode;
unsigned int HCI_OP;

void main(unsigned char argc, unsigned char argv[])
{
    unsigned int* tmp;
    tmp = &HCI_OpCode;
    HCI_OP = 0x1005;

    while(1)
    {
        printf("Input OpCode (In Big-Endian):0x");
        scanf("%x",&HCI_OP);
        if(HCI_OP == 0) break;
        *tmp = HCI_OP;
        printf("OpCode=0x%04X\t",HCI_OpCode.opcod);
        printf("OGF=0x%02X\t",HCI_OpCode.op.ogf);
        printf("OCF=0x%02X\r\n\r\n",HCI_OpCode.op.ocf);
    }
    printf("Thankyou for use,Code by Gamepader.com");
    getch();

    return;
}

附上运行效果图(其实没有什么效果):
HCIOpCode2运行效果图
源代码下载:CalcOpCode.c
编译好的源程序:CalcOpCode.exe
原创文章,欢迎转载,但请注明来源://blog.gamepader.com/archives/2013/05/the-bluetooth-hci-according-opcode-calculated-ocf-ogf-source-code.html

05-14
2013

Sony PS4 DualShock 4 Controller with Eye Camera Can See, Hear and Move with You

Author:Gamepader    IN:手柄    Tags: ,     评论: 0    超过155人围观

In case you missed it, Sony at long last unveiled its PlayStation 4 console during a two-hour press event yesterday, featuring a surprise appearance by Blizzard, which is bringing Diablo III to the PS3 and PS4. You’ll get to play that game (and many others) on Sony’s wireless DualShock 4 controller. Yes, Sony is sticking with the DualShock design that’s become an iconic image of the PlayStation brand, though this newest version features several upgrades.

On the inside, the DualShock 4 features a new highly sensitive six-axis sensor for precise control. Externally, the DualShock 4 looks similar to previous models, though it now comes with a touchpad located on the front of the controller, opening up new gameplay avenues for software developers.

SonyDualShock_4

In addition to the D-Pad and analog sticks, the new controller retains the Triangle, Square, X, and Circle buttons. You’ll notice above that there’s no longer Start and Select buttons, both of which have been integrated into an Options button on the upper-right side.

On the opposite side is a Share button. This will allow gamers to broadcast their gameplay in real-time to friends through Internet streaming services such as Ustream. You’ll also be able to share gaming moments and accomplishments by uploading video gameplay footage to Facebook, all with the touch of the button — no fussing with video formats or conversions.

Below the touchpad in the center is a built-in speaker, which will pipe high-fidelity sound effects from games (don’t worry, your TV and/or home theater speakers will still play in-game sound effects, too).

DualShock_4_Lightbar

The DualShock 4 features a light bar on top with three color LEDs. It illuminates to match the color of characters in a game to offer an easier way to identify players, even when playing side by side, Sony says. It will also change patterns to reflect gameplay scenarios, such as being critically low on health or taking a major blow from an enemy.

PS4_Eye

Adding another element to gameplay, Sony developed a PlayStation 4 Eye camera that’s similar to Microsoft’s Kinect. It has two high-sensitive cameras with wide-angle lenses and 85-degree diagonal angle views. According to Sony, it’s capable of precise detection of depth of space.

“This enables PlayStation 4 Eye to cut out the image of player from background, or to grasp players’ position in front and behind, further broadening the ways to enjoy games,” Sony explains.

There are four microphones incorporated into the PS4 Eye, allowing the device to detect accurate sound and source origination. Gamers will be able to use the Eye to log into their PS4 using face recognition, too.

本文转载自://hothardware.com/News/Sony-PS4-DualShock-4-Controller-and-Eye-Camera-Can-See-Hear-and-Move-with-You/ ,版权归原作者所有。

02-22
2013

传中国取消游戏机禁令:索尼任天堂股价大涨

Author:Gamepader    IN:手柄    Tags:     评论: 0    超过24人围观

《中国日报》今天援引匿名消息人士的言论称,中国文化部正与其他部委会商,可能取消长达12年的游戏机禁令。消息传出后,索尼和任天堂股价大幅上涨。

索尼股价周一最高上涨8.8%,至1404日元,创2012年4月以来的新高;任天堂则最高上涨8.2%,至10,070日元,创2011年8月以来的新高。

由于担心可能会有害青少年身心发展,中国2000年开始实施游戏机禁令。但《中国日报》援引不具名人士的话称,文化部正在与其他部委商讨取消这一禁令。

东京投资公司Iwai Cosmo分析师Mitsuo Shimizu说:“投资者看好这一报道。这将给视频游戏制造商打开全新市场。”

他认为,任天堂、索尼和其他日本企业还将受益于日元汇率降至两年半新低。汇率降低将提升海外收入兑换成日元后的价值。

《中国日报》称,中国游戏机禁令2000年由7大部位联合颁发,因此要取消该禁令,同样需要这7部位一致通过。文化部发言人拒绝发表评论。索尼尚未在中国出售PlayStation游戏机,任天堂则尚未发表回应。

中国市场目前的游戏机都是通过黑市出售。而苹果iPad和iPhone等平板电脑和智能手机却可以在国内合法销售。

由于看好日元走软以及未盈利业务的复苏前景,美银美林分析师Eiichi Katayama将索尼股票评级上调至“买入”,并将其目标价从980日元上调至1850日元。

 

点评:国内可以合法出售索尼任天堂游戏机了,游戏相关行业是否会比过去的一年景气呢?期待吧

01-28
2013
loading...