I tried to implement the method 2 of sharing a BLE connection. Whatever I tried, it's not compiling. I'm new to Java, Android, BLE, RX etc., so I'm lost without help.
Here is an excerpt of my code:
import com.jakewharton.rx3.ReplayingShare;
import com.polidea.rxandroidble2.RxBleClient;
import com.polidea.rxandroidble2.RxBleConnection;
import com.polidea.rxandroidble2.RxBleDevice;
:
public class sbrBTSupport
{
:
private Observable<RxBleConnection> connectionObservable;
:
RxBleDevice bleDevice = bleClient.getBleDevice (sbrMAC);
connectionObservable = bleDevice.establishConnection (false).compose (ReplayingShare.instance ());
ReplayingShare is providing an object while an Observable<RxBleConnection> is needed.
I found suggestions in many posts here, but nothing worked. Please indicate where do I have to write what differently.
Thanks
Dieter
Related
I am using parsley 3 with Flex 4 (AIR) for one of my applications. When I make a remote call I am dispatching an event which reaches till command class and then to Java layer service. Till here all works fine. Java layer makes some call etc and returns result back but my result handler (or fault handler) is not getting control back.
Project
bin-debug
libs
parsley-core-3.0.0.swc
parsley-flex-3.0.0.swc
parsley-xml-3.0.0.swc
spicelib-commands-3.1.1.swc
spicelib-reflect-3.0.0.swc
spicelib-util-3.1.0.swc
spicelib-xml-mapper-3.0.2.swc
Main.mxml
ProjectEvent.as
LoadProjectsCommand
ProjectPM.as
and other stuff.
The command class gets control and also able to call java service. The code is as below:
package
{
import mx.collections.ArrayCollection;
import mx.controls.Alert;
import mx.rpc.AsyncToken;
import mx.rpc.events.FaultEvent;
import mx.rpc.events.ResultEvent;
import mx.rpc.remoting.RemoteObject;
/*http://www.spicefactory.org/parsley/docs/3.0/manual/managedcommands.php*/
public class LoadProjectsCommand
{
[Inject(id="projectRemoteService")]
public var projectRemoteService:RemoteObject;
[Inject]
public var model:ProjectScreenPM;
public function execute(event:ProjectEvent):AsyncToken
{
return projectRemoteService.getAllProjectsWithSprintsInSystem() as AsyncToken;
}
public function result(event:ResultEvent):void
{
Alert.show("Result");
}
public function fault(event:FaultEvent):void
{
Alert.show("Fault in retrieving projects","Error");
}
}
}
I have verified every thing is fine in Java service call. Can anybody please help me?
You might find that the result method is not being called because the command is throwing an error.
The failure method in a parsley command is called error, not fault, so your fault method will never be called.
Rename the fault method to error, and see if that makes a change.
I am trying to figure out how to send an email from a Flash Mobile (smartphones: blackberries, iphones, androids) app using mxml and Flash using Flash Builder 4.6. My boss told me to find out if it is possible. So far, I have been doing a lot of searching around on the internet for an answer.
I found this website: http://www.bytearray.org/?p=27, that has some classes for sending email in flash, but #1, I don't know if they work in Mobile apps, and #2, I can't find any instructions or tutorials on how to use the classes to send a simple email.
I downloaded the package from the site and imported into my project, where I am trying to send the code. But without sample code on how to simply send an email, I am not entirely sure what all do, and nor am I sure how to determine things like what port number to construct the SMTPMailer object (the SMTPMailer object is included in that package, and it takes a host string and a port number integer in it's constructor), right now I am trying 80 or 8080 for the port number, and I've tried localhost and one of our server computers, 198.162.1.109 for the host.
Anyway, I keep getting this error: Error #2044: Unhandled IOErrorEvent:. text=Error #2031: Socket Error.
Here is some of my sample code:
[Bindable]
private var mailer : SMTPMailer;
private function init() : void {
tbPass.displayAsPassword = true;
}
protected function btnClick_email(toAddress : String, fromAddress : String, pass : String) : void {
mailer = new SMTPMailer("198.168.1.109", 8080);
mailer.addEventListener(SMTPEvent.MAIL_SENT, onMailSent);
mailer.addEventListener(SMTPEvent.MAIL_ERROR, onMailError);
mailer.addEventListener(SMTPEvent.CONNECTED, onConnected);
mailer.addEventListener(SMTPEvent.DISCONNECTED, onDisconnected);
mailer.connect("hotmail.com", 8080);
mailer.authenticate(toAddress, pass);
mailer.sendHTMLMail(fromAddress, toAddress, "Subect", "Message");
}
private function onMailSent() : void {
lblEmailResult.text = "Sent Mail";
}
private function onMailError() : void {
lblEmailResult.text = "Error";
}
private function onConnected() : void {
lblEmailResult.text = "Connected";
}
private function onDisconnected() : void {
lblEmailResult.text = "Disconnected";
}
I would suggest using a back-end service to send emails, it is same as connecting to a SMTP mail server but it is more flexible.
That being said, it should work, the error you are getting is related to your host IP, are you sure you have SMTP server running on "198.168.1.109:8080"?
First check if you can send mails from it before trying to do it trough Flex, if that is OK, then you should double check socket policy files:
http://www.adobe.com/devnet/flashplayer/articles/socket_policy_files.html
Hope that helps
Can't you just use navigateToURL() for this?
Ie:
var request:URLRequest("mailto:someone#somewhere.com");
navigateToURL(request);
That's all - 2 lines :)
I've accomplished this in a commercial app I worked on. We used a native extension found in distriqt's set of tools. Google them. The full suite of tools is cheap, though if you have any issues, do not expect a quick reply. Their message tool is what you are looking for, and it is easy to use.
Basically, irrespective of what changes I make to my source, compiling alway yields either a transcoding error, or a missing definition.
I'm new to flash so it's difficult for me to understand how to go about fixing the problem.
Anyway here is the source.
The stack overflow link I always put in all my source, to look at for encouragement every time I feel like banging my head against the keyboard.
// Main.as
package
{
// General imports
// http://stackoverflow.com/questions/564756/should-i-just-give-up-on-programming
import com.bit101.components.Label;
import flash.display.*;
import flash.events.*;
import AssetManager;
// Begin external facing class
public class Main extends Sprite
{
public function Main()
{
var globalFont:String = AssetManager.FONT_PFRONDA;
//var myLabel:com.bit101.components.Label = new Label(Main = null, xpos = 25, ypos = 30, text = "Test Successfull");
//addChild(myLabel);
}
}
---
// AssetManager.as
package
{
public class AssetManager
{
[Embed(source = 'C:\\Documents and Settings\\Geko\\Desktop\\Flash\\testclient\\lib\\MinimalComps_0_9_5_\\src\\assets\\pf_ronda_seven.ttf', fontName = 'PF Ronda Seven', fontWeight = 'normal', advancedAntiAliasing = 'true', mimeType = 'application/x-font-truetype')] public static const FONT_PFRONDA:String;
}
}
Currently when I try to compile I get the following error...
C:\Documents and Settings\Geko\Desktop\Flash\testclient\src\Main.as(6): col: 31
Error: Definition com.bit101.components:Label could not be found.
and if I remove the comment from "var myLabel" or "addChild lines" in Main.as, then I get..
C:\Documents and Settings\Geko\Desktop\Flash\testclient\lib\MinimalComps_0_9_5_\src\com\bit101\components\Component.as(51): col: 4: Error: transcoding parameter 'embedAsCFF' is not supported by 'flex2.compiler.media.FontTranscoder'
C:\Documents and Settings\Geko\Desktop\Flash\testclient\lib\MinimalComps_0_9_5_\src\com\bit101\components\Component.as(51): col: 4: Error: Unable to transcode /assets/pf_ronda_seven.ttf.
My classpaths are "src", "lib\MinimalComps_0_9_5_\src\assets", and "lib\MinimalComps_0_9_5_\src\com\bit101\components"
I'm using Flex SDK 3.5.0.12683 on Windows XP with FlashDevelop 3.2.1 RTM
Any ideas as to why I'm constantly receiving errors each time I try to build the project?
C:\Documents and Settings\Geko\Desktop\Flash\testclient\src\Main.as(6): col: 31 Error: Definition com.bit101.components:Label could not be found.
this would suggest that the application can't find the Label class, possible reasons could be a problem with your classes library path, not importing the Label class, problem with the Label class package name etc...
The other two errors have to do with the way your font is embed. "embedAsCFF" requires Flex SDK 4.
In the error message you get a mention to the flex2 compiler.
'flex2.compiler.media.FontTranscoder'
Are you sure to be using the Flex SDK 3.5? I don't use FlashDevelop myself , so I wouldn't know where to look in order to edit the current Flex SDK.
I'm testing Adobe AIR with flex, and I wanted to play a mp3 via an open file dialog, I did that :
import flash.filesystem.*;
import flash.events.Event;
import flash.media.*;
import mx.core.SoundAsset;
public var loadedFile:File;
public var channel:SoundChannel;
public var song:SoundAsset;
private function loadFile():void {
loadedFile = new File();
loadedFile.browseForOpen("Open multimedia File");
loadedFile.addEventListener(Event.SELECT, fileSelected);
}
private function fileSelected(event:Event):void {
song = new SoundAsset()
song.load(URLRequest(loadedFile.url));
channel = song.play();
}
But when I try to open a file, after the Open file dialog close, I get this error :
TypeError: Error #1034: Type Coercion failed: cannot convert "file:///C:/Users/Kedare/Music/05-Scene%20V%20~%20Prelude.mp3" to flash.net.URLRequest.
I can't find anything related to that on Google or another documentation, all the docs I find is related to play a sound using URL and not Local files :(
Any idea of what can be the problem ? What can I do ?
Thank you !
Change
song.load(URLRequest(loadedFile.url));
to
song.load(new URLRequest(loadedFile.url));
I think you can help me out from this little problem.
I am a novice in Facebook developer by choosing ActionScript 3 as my developer platform. I use SWC library from official facebook-actionscript-api that promoted by Adobe.
So I followed their tutorial. So I did following instruction:
Create Flex project.
Download and put Facebook_library_v3.4_flex.swc to \lib in Flex project.
Provide following code:
import com.facebook.Facebook;
import com.facebook.utils.FacebookSessionUtil;
private var fbook:Facebook;
private var session: FacebookSessionUtil;
protected var api_key : String = "my-facebook-app-api-key";
protected var secret_key : String = "my-facebook-app-secret-key";
public function init() : void {
//fbook = new Facebook();
session=new FacebookSessionUtil(api_key,secret_key,this.loaderInfo);
var fbook : Facebook = session.facebook;
session.validateLogin();
}
After trying to run debug session. I got the error after execute this statement:
session=new FacebookSessionUtil(api_key,secret_key,this.loaderInfo);
I think I did something wrong but I couldn't figure it out. Could you help me by giving your advice or any guideline?
This is exception I got:
TypeError: Error #1009: Cannot access a property or method of a null object reference.
at com.facebook.utils::FacebookSessionUtil()[C:\Users\MikeHunt\Work\FacebookAPI\src\com\facebook\utils\FacebookSessionUtil.as:128]
at CheeseZaa/init()[/Users/teerasej/Documents/Flex Builder 3?/freelance/CheeseZaa/src/CheeseZaa.mxml:24]
at CheeseZaa/___CheeseZaa_Application1_creationComplete()[/Users/teerasej/Documents/Flex Builder 3?/freelance/CheeseZaa/src/CheeseZaa.mxml:4]
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at mx.core::UIComponent/dispatchEvent()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:9440]
at mx.core::UIComponent/set initialized()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:1168]
at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:718]
at Function/http://adobe.com/AS3/2006/builtin::apply()
at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8744]
at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.5.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8684]
I notice that the first line of exception show this:
com.facebook.utils::FacebookSessionUtil()[C:\Users\MikeHunt\Work\FacebookAPI\src\com\facebook\utils\FacebookSessionUtil.as:128]
But I don't sure it involve in exception.
My development platform is:
Macbook Pro
OSX Snow Leopard 10.6
Flash Player 10.0.32 Debugger
Mozilla Firefox 3.6
Flex builder 3.2
Flex SDK 3.5
Facebook_library_v3.4_flex.swc
Every suggestion and guideline would be thank you. I think this would be good for other developer that may found the same problem like me.
loaderInfo is not ready and is currently null.
try:-
public function init():void
{
addEventListener(Event.ADDED_TO_STAGE, onAddedToStage, false, 0, true);
}
private function onAddedToStage(event:Event):void
{
removeEventListener(Event.ADDED_TO_STAGE, onAddedToStage);
session = new FacebookSessionUtil(api_key, secret_key, this.loaderInfo);
var fbook:Facebook = session.facebook;
session.validateLogin();
}