方法“session:peer:didChangeState”
我读了那篇文章:“ http://www.devx.com/wireless /Article/43502/0/page/1 "
我想在我的应用程序中集成蓝牙。我有一个问题。我想连接 2 个设备,并且想知道两个设备上是否都调用了函数“session:peer:didChangeState”。在我看来,我认为它在两种设备上都被调用。
我想知道是否在两个设备上调用了方法 session:peer:didChangeState 。
我想通过蓝牙发送一个结构: 我的结构如下:
typedef struct Package
{
tip_Comunicare_Enum type;
union mesaj_Comunicare
{
Msg_Cerere_Struct msg_Cerere;
Msg_Raspuns_Struct msg_Raspuns;
Msg_Initializare msg_Initializare;
}mesaj_Comunicare;
}
Package ;
我的序列化器看起来像这样:
-(void) SendData:(Package *) pachet
{
NSLog(@"Send DATA pachet");
printf("%d\n",sizeof(*pachet));
NSData * myData = [[NSData dataWithBytes:pachet
length:sizeof(*pachet)] autorelease];
[self mySendDataToPeers:myData];
}
如果我这样使用它就不起作用,我会给出 SIGKILL 或类似的东西。
感谢和我一起度过的时光:)
I read that article : " http://www.devx.com/wireless/Article/43502/0/page/1 "
I want to integrate in my application Bluetooth. I had a problem. I want to connect 2 devices and i want to know if the function "session:peer:didChangeState" is called on the both device. In my opinion i think it is called on the both devices.
I want to know if the method session:peer:didChangeState is called on the both devices .
I want to send via bluetooth a structure:
My structure is following :
typedef struct Package
{
tip_Comunicare_Enum type;
union mesaj_Comunicare
{
Msg_Cerere_Struct msg_Cerere;
Msg_Raspuns_Struct msg_Raspuns;
Msg_Initializare msg_Initializare;
}mesaj_Comunicare;
}
Package ;
My serializer looks like that :
-(void) SendData:(Package *) pachet
{
NSLog(@"Send DATA pachet");
printf("%d\n",sizeof(*pachet));
NSData * myData = [[NSData dataWithBytes:pachet
length:sizeof(*pachet)] autorelease];
[self mySendDataToPeers:myData];
}
If i use like that it is doesn't work and i give SIGKILL or something like that.
Thant for the time spent with me :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
myData 已经自动发布。你必须这样写:
记住:自动释放消息被发送的次数与被调用的次数一样多。
myData is already autoreleased. You have to write:
Remember: autorelease message is sent as many times as it is called.